wallaby-cash 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -230,7 +230,6 @@ exports.KeyTypeName = void 0;
230
230
  KeyTypeName["WallabyShare"] = "wallaby_share";
231
231
  KeyTypeName["OwnerMainDeviceShare"] = "owner_main_device_share";
232
232
  KeyTypeName["OwnerBackupDeviceShare"] = "owner_backup_device_share";
233
- KeyTypeName["AddedUserShare"] = "added_user_share";
234
233
  })(exports.KeyTypeName || (exports.KeyTypeName = {}));
235
234
  exports.SeedPhraseType = void 0;
236
235
  (function (SeedPhraseType) {
@@ -286,6 +285,7 @@ exports.AuthType = void 0;
286
285
  exports.LocalStorageItems = void 0;
287
286
  (function (LocalStorageItems) {
288
287
  LocalStorageItems["AccessToken"] = "access-token";
288
+ LocalStorageItems["RefreshToken"] = "refresh-token";
289
289
  LocalStorageItems["EncryptedStandardSeedPhrase"] = "encrypted-standard-seedPhrase";
290
290
  LocalStorageItems["EncryptedKeyShares"] = "encrypted-key-shares";
291
291
  LocalStorageItems["PrimaryDeviceKeyShare"] = "primary-device-key-share";
@@ -320,6 +320,7 @@ exports.V1KeyNames = void 0;
320
320
  exports.V2KeyNames = void 0;
321
321
  (function (V2KeyNames) {
322
322
  V2KeyNames["AccessToken"] = "access-token";
323
+ V2KeyNames["RefreshToken"] = "refresh-token";
323
324
  V2KeyNames["BackupDeviceKeyShare"] = "backup-device-key-share";
324
325
  V2KeyNames["ClientAuthPublicKey"] = "client-auth-pub-key";
325
326
  V2KeyNames["ClientAuthToken"] = "republic-jwt";
@@ -597,7 +598,7 @@ const MASTER_ENCRYPTION_KEY = '9fa9d3f3c77c20d3a50a08e5299644be29f6e6206ef3479fe
597
598
  { type: 'public-key', alg: exports.PublicKeyCredentialAlgorithm.ES256 },
598
599
  ];
599
600
  const isWeb = typeof window !== 'undefined' && typeof document !== 'undefined';
600
- const currentPackageVersion = "3.0.2" ;
601
+ const currentPackageVersion = "3.1.0" ;
601
602
 
602
603
  /**
603
604
  * Storage keys adapter for Storage interface across different platforms.
@@ -4777,7 +4778,12 @@ class StorageService {
4777
4778
  exports.V2KeyNames.PrimaryDeviceKeyShare,
4778
4779
  exports.V2KeyNames.BackupDeviceKeyShare,
4779
4780
  ];
4780
- this._keysProtectedByMasterKey = [exports.V2KeyNames.AccessToken, exports.V2KeyNames.PasskeyCredential, exports.V2KeyNames.ClientAuthToken];
4781
+ this._keysProtectedByMasterKey = [
4782
+ exports.V2KeyNames.AccessToken,
4783
+ exports.V2KeyNames.RefreshToken,
4784
+ exports.V2KeyNames.PasskeyCredential,
4785
+ exports.V2KeyNames.ClientAuthToken,
4786
+ ];
4781
4787
  this.userId = userId;
4782
4788
  this.environment = environment !== null && environment !== void 0 ? environment : defaultEnvironment;
4783
4789
  this.shortenedEnv = this.environment.slice(0, 1); // d for development
@@ -5139,6 +5145,7 @@ class StorageService {
5139
5145
  async clearLocalStorage(walletId) {
5140
5146
  const userKeysToRemove = [
5141
5147
  exports.LocalStorageItems.AccessToken,
5148
+ exports.LocalStorageItems.RefreshToken,
5142
5149
  exports.V2KeyNames.EncryptedDevicePrivateKey,
5143
5150
  exports.V2KeyNames.WallabyAuthPubKey,
5144
5151
  exports.V2KeyNames.PasskeyCredential,
@@ -5347,7 +5354,7 @@ var ContentType;
5347
5354
  })(ContentType || (ContentType = {}));
5348
5355
  class HttpClient {
5349
5356
  constructor(apiConfig = {}) {
5350
- this.baseUrl = "https://staging-testnet.wallaby.cash";
5357
+ this.baseUrl = "https://dev-testnet.wallaby.cash";
5351
5358
  this.securityData = null;
5352
5359
  this.abortControllers = new Map();
5353
5360
  this.customFetch = (...fetchParams) => fetch(...fetchParams);
@@ -5482,7 +5489,7 @@ class HttpClient {
5482
5489
  /**
5483
5490
  * @title STAGING
5484
5491
  * @version 1.0
5485
- * @baseUrl https://staging-testnet.wallaby.cash
5492
+ * @baseUrl https://dev-testnet.wallaby.cash
5486
5493
  * @contact
5487
5494
  *
5488
5495
  * The STAGING is an API that manages the wallets of the Republic Crypto
@@ -5567,18 +5574,17 @@ class Api {
5567
5574
  *
5568
5575
  * @tags Auth
5569
5576
  * @name RefreshAccessToken
5570
- * @summary Users will be able to sign up by providing a signature and message. Use the same pair keys used on sign up
5577
+ * @summary Exchange a refresh token for a new access token and refresh token pair
5571
5578
  * @request POST:/api/v1/auth/refresh-access-token
5572
- * @deprecated
5573
5579
  * @secure
5574
5580
  */
5575
- refreshAccessToken: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/auth/refresh-access-token`, method: "POST", secure: true, format: "json" }, params)),
5581
+ refreshAccessToken: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/auth/refresh-access-token`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
5576
5582
  /**
5577
- * No description
5583
+ * @description Invalidates the current access token and its associated refresh token. Other active sessions are preserved.
5578
5584
  *
5579
5585
  * @tags Auth
5580
5586
  * @name Logout
5581
- * @summary Invalidate the current session by revoking the bearer token
5587
+ * @summary Revoke the current session by invalidating the access token and its linked refresh token.
5582
5588
  * @request POST:/api/v1/auth/logout
5583
5589
  * @secure
5584
5590
  */
@@ -5671,6 +5677,20 @@ class Api {
5671
5677
  * @secure
5672
5678
  */
5673
5679
  createAssetConfig: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/assets/configurations`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
5680
+ /**
5681
+ * No description
5682
+ *
5683
+ * @tags Assets
5684
+ * @name GetAssetConfigById
5685
+ * @summary Get asset configuration by ID
5686
+ * @request GET:/api/v1/assets/configurations/{assetConfigId}
5687
+ * @secure
5688
+ */
5689
+ getAssetConfigById: (_a, params) => {
5690
+ var { assetConfigId } = _a; __rest(_a, ["assetConfigId"]);
5691
+ if (params === void 0) { params = {}; }
5692
+ return this.http.request(Object.assign({ path: `/api/v1/assets/configurations/${assetConfigId}`, method: "GET", secure: true, format: "json" }, params));
5693
+ },
5674
5694
  /**
5675
5695
  * No description
5676
5696
  *
@@ -6003,26 +6023,6 @@ class Api {
6003
6023
  * @secure
6004
6024
  */
6005
6025
  importWalletSeedPhraseV2: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/create-shares-based-wallet-from-seed`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6006
- /**
6007
- * No description
6008
- *
6009
- * @tags Wallets, MPC
6010
- * @name ShareWallet
6011
- * @summary Share an entity wallet with another user
6012
- * @request POST:/api/v1/wallets/initiate-share-wallet
6013
- * @secure
6014
- */
6015
- shareWallet: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/initiate-share-wallet`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6016
- /**
6017
- * No description
6018
- *
6019
- * @tags Wallets, MPC
6020
- * @name UnshareWallet
6021
- * @summary Unshare an entity wallet with a user previously granted access
6022
- * @request POST:/api/v1/wallets/unshare-wallet
6023
- * @secure
6024
- */
6025
- unshareWallet: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/unshare-wallet`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6026
6026
  /**
6027
6027
  * No description
6028
6028
  *
@@ -6087,16 +6087,6 @@ class Api {
6087
6087
  * @secure
6088
6088
  */
6089
6089
  updateUserAsset: (query, data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/asset/update`, method: "PUT", query: query, body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6090
- /**
6091
- * No description
6092
- *
6093
- * @tags Wallets, Multisig
6094
- * @name CreateMultisigAsset
6095
- * @summary Initiate creation for a new multisig asset, by specifying participants and the threshold
6096
- * @request POST:/api/v1/wallets/create-multisig-asset
6097
- * @secure
6098
- */
6099
- createMultisigAsset: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/create-multisig-asset`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6100
6090
  /**
6101
6091
  * No description
6102
6092
  *
@@ -6104,6 +6094,7 @@ class Api {
6104
6094
  * @name InitiateWalletRecovery
6105
6095
  * @summary Wallet Recovery - Step 1: Initiate wallet recovery
6106
6096
  * @request POST:/api/v1/wallets/recover/init
6097
+ * @deprecated
6107
6098
  * @secure
6108
6099
  */
6109
6100
  initiateWalletRecovery: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/recover/init`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
@@ -6114,19 +6105,10 @@ class Api {
6114
6105
  * @name RecoverWallet
6115
6106
  * @summary Wallet Recovery - Step 2 and final: Recover the lost wallet and its assets
6116
6107
  * @request POST:/api/v1/wallets/recover
6108
+ * @deprecated
6117
6109
  * @secure
6118
6110
  */
6119
6111
  recoverWallet: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/recover`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6120
- /**
6121
- * No description
6122
- *
6123
- * @tags Wallets, Algorand
6124
- * @name ConvertStandardPhraseToAlgoSpecific
6125
- * @summary Convert BIP39 Standard seed phrase to Algorand fixed 25 words mnemonic phrase
6126
- * @request POST:/api/v1/wallets/convert-mnemonic-seed
6127
- * @secure
6128
- */
6129
- convertStandardPhraseToAlgoSpecific: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/wallets/convert-mnemonic-seed`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6130
6112
  /**
6131
6113
  * No description
6132
6114
  *
@@ -6172,7 +6154,7 @@ class Api {
6172
6154
  /**
6173
6155
  * No description
6174
6156
  *
6175
- * @tags Wallets, Transactions
6157
+ * @tags Wallets, Swaps
6176
6158
  * @name ExecuteSwap
6177
6159
  * @summary Execute a swap transaction between supported assets
6178
6160
  * @request POST:/api/v1/wallets/execute-swap
@@ -6231,46 +6213,6 @@ class Api {
6231
6213
  * @secure
6232
6214
  */
6233
6215
  sendV2Transaction: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/transfer-with-shares`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6234
- /**
6235
- * No description
6236
- *
6237
- * @tags Transactions
6238
- * @name InitMultisigTransfer
6239
- * @summary User initiating and signing a multi-sig transfer request
6240
- * @request POST:/api/v1/transactions/init-multisig-transfer
6241
- * @secure
6242
- */
6243
- initMultisigTransfer: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/init-multisig-transfer`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6244
- /**
6245
- * No description
6246
- *
6247
- * @tags Transactions, Multisig
6248
- * @name InitMultisigAssetOptin
6249
- * @summary User initiating a multi-sig asset optin request and subsequently signs the first signature on the request
6250
- * @request POST:/api/v1/transactions/init-multisig-asset-optin
6251
- * @secure
6252
- */
6253
- initMultisigAssetOptin: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/init-multisig-asset-optin`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6254
- /**
6255
- * No description
6256
- *
6257
- * @tags Transactions, Multisig
6258
- * @name InitMultisigAppOptin
6259
- * @summary User initiating a multi-sig app optin request and subsequently signs the first signature on the request
6260
- * @request POST:/api/v1/transactions/init-multisig-app-optin
6261
- * @secure
6262
- */
6263
- initMultisigAppOptin: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/init-multisig-app-optin`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6264
- /**
6265
- * No description
6266
- *
6267
- * @tags Transactions, Multisig
6268
- * @name SignOnMultisigTransactionRequest
6269
- * @summary Append signature to an existing multisig transaction request: It can be a request to transfer, optin, etc, ...
6270
- * @request POST:/api/v1/transactions/sign-multisig-request
6271
- * @secure
6272
- */
6273
- signOnMultisigTransactionRequest: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/sign-multisig-request`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6274
6216
  /**
6275
6217
  * No description
6276
6218
  *
@@ -6301,16 +6243,6 @@ class Api {
6301
6243
  * @secure
6302
6244
  */
6303
6245
  getEstimateFee: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/estimate-fee`, method: "GET", query: query, secure: true, format: "json" }, params)),
6304
- /**
6305
- * @description The sign and broadcast transaction API was designed and implemented specifically for uses cases where the caller has their own custom raw transaction that is not yet currently supported by Wallaby
6306
- *
6307
- * @tags Transactions, Raw, Transactions
6308
- * @name SignAndBroadcastRawTx
6309
- * @summary Sign and broadcast raw transaction API
6310
- * @request POST:/api/v1/transactions/sign-broadcast-rawtx
6311
- * @secure
6312
- */
6313
- signAndBroadcastRawTx: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/sign-broadcast-rawtx`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6314
6246
  /**
6315
6247
  * No description
6316
6248
  *
@@ -6321,16 +6253,6 @@ class Api {
6321
6253
  * @secure
6322
6254
  */
6323
6255
  fetchTransactionByHashOrReference: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/status`, method: "GET", query: query, secure: true, format: "json" }, params)),
6324
- /**
6325
- * No description
6326
- *
6327
- * @tags Transactions, Transactions, Multisig, Raw
6328
- * @name InitMultisigRawTransaction
6329
- * @summary Initiate a multisig raw transaction and sign the first signature on that same transaction
6330
- * @request POST:/api/v1/transactions/init-sign-broadcast-multisig-rawtx
6331
- * @secure
6332
- */
6333
- initMultisigRawTransaction: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/init-sign-broadcast-multisig-rawtx`, method: "POST", body: data, secure: true, type: ContentType.Json }, params)),
6334
6256
  /**
6335
6257
  * No description
6336
6258
  *
@@ -6341,20 +6263,6 @@ class Api {
6341
6263
  * @secure
6342
6264
  */
6343
6265
  getDetailedRawTransactionDataByReference: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/raw-status`, method: "GET", query: query, secure: true, format: "json" }, params)),
6344
- /**
6345
- * No description
6346
- *
6347
- * @tags Transactions, Query
6348
- * @name FetchTransactionParticipants
6349
- * @summary Fetch transaction's participants
6350
- * @request GET:/api/v1/transactions/{reference}/participants
6351
- * @secure
6352
- */
6353
- fetchTransactionParticipants: (_a, params) => {
6354
- var { reference } = _a; __rest(_a, ["reference"]);
6355
- if (params === void 0) { params = {}; }
6356
- return this.http.request(Object.assign({ path: `/api/v1/transactions/${reference}/participants`, method: "GET", secure: true, format: "json" }, params));
6357
- },
6358
6266
  /**
6359
6267
  * No description
6360
6268
  *
@@ -6378,7 +6286,7 @@ class Api {
6378
6286
  /**
6379
6287
  * No description
6380
6288
  *
6381
- * @tags Transactions, Optin
6289
+ * @tags Transactions
6382
6290
  * @name CheckAssetOptinForAddress
6383
6291
  * @summary Get the list of all assets that the current account has opted into. This is only relevant for the Algorand chain
6384
6292
  * @request GET:/api/v1/transactions/check-asset-optin
@@ -6388,7 +6296,7 @@ class Api {
6388
6296
  /**
6389
6297
  * No description
6390
6298
  *
6391
- * @tags Transactions, Optin
6299
+ * @tags Transactions
6392
6300
  * @name CheckAppOptinForAddress
6393
6301
  * @summary Get the list of all apps that the current account has opted into. This is only relevant for the Algorand chain
6394
6302
  * @request GET:/api/v1/transactions/check-app-optin
@@ -6479,26 +6387,6 @@ class Api {
6479
6387
  fetchAssetPairPrice: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/query/get-asset-price`, method: "GET", query: query, secure: true, format: "json" }, params)),
6480
6388
  };
6481
6389
  this.mpc = {
6482
- /**
6483
- * No description
6484
- *
6485
- * @tags Mpc
6486
- * @name InitKeyExchange
6487
- * @summary Initialize key exchange process, the keys exchanged will be later used for encryption/decryption of the payloads exchanged
6488
- * @request POST:/api/v1/mpc/init-key-exchange
6489
- * @secure
6490
- */
6491
- initKeyExchange: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/mpc/init-key-exchange`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6492
- /**
6493
- * No description
6494
- *
6495
- * @tags Mpc
6496
- * @name RequestSeedphraseSplit
6497
- * @summary Request seed phrase split and return shares that can be used later for recovery
6498
- * @request POST:/api/v1/mpc/request-seed-split
6499
- * @secure
6500
- */
6501
- requestSeedphraseSplit: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/mpc/request-seed-split`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6502
6390
  /**
6503
6391
  * No description
6504
6392
  *
@@ -6651,20 +6539,6 @@ class Api {
6651
6539
  if (params === void 0) { params = {}; }
6652
6540
  return this.http.request(Object.assign({ path: `/api/v1/users/${externalUserId}/externalUserId`, method: "GET", secure: true, format: "json" }, params));
6653
6541
  },
6654
- /**
6655
- * No description
6656
- *
6657
- * @tags Users
6658
- * @name GetParticipantsByUserId
6659
- * @summary Returns multisig participants by user id
6660
- * @request GET:/api/v1/users/{userId}/multisig-transactions
6661
- * @secure
6662
- */
6663
- getParticipantsByUserId: (_a, params) => {
6664
- var { userId } = _a, query = __rest(_a, ["userId"]);
6665
- if (params === void 0) { params = {}; }
6666
- return this.http.request(Object.assign({ path: `/api/v1/users/${userId}/multisig-transactions`, method: "GET", query: query, secure: true, format: "json" }, params));
6667
- },
6668
6542
  };
6669
6543
  this.adminTransactions = {
6670
6544
  /**
@@ -6766,7 +6640,7 @@ class Api {
6766
6640
  * @request GET:/api/v1/transactions/admin/callback_pk
6767
6641
  * @secure
6768
6642
  */
6769
- getCallbackPublicKey: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/admin/callback_pk`, method: "GET", secure: true }, params)),
6643
+ getCallbackPublicKey: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/admin/callback_pk`, method: "GET", query: query, secure: true }, params)),
6770
6644
  /**
6771
6645
  * No description
6772
6646
  *
@@ -6792,19 +6666,23 @@ class Api {
6792
6666
  */
6793
6667
  upsideCallback: (data, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/admin/callback`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params)),
6794
6668
  };
6795
- this.v1 = {
6669
+ this.dashboard = {
6796
6670
  /**
6797
6671
  * No description
6798
6672
  *
6673
+ * @tags Dashboard
6799
6674
  * @name GetDashboardData
6800
6675
  * @summary Create new merchant. This endpoint is only available for super admin and republic admin
6801
6676
  * @request GET:/api/v1/dashboard
6802
6677
  * @secure
6803
6678
  */
6804
6679
  getDashboardData: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/dashboard`, method: "GET", secure: true }, params)),
6680
+ };
6681
+ this.userActivity = {
6805
6682
  /**
6806
6683
  * No description
6807
6684
  *
6685
+ * @tags UserActivity
6808
6686
  * @name GetActivitiees
6809
6687
  * @summary Get all activities. This endpoint is only available for super admin and republic admin
6810
6688
  * @request GET:/api/v1/users-activities
@@ -7409,28 +7287,35 @@ class Authenticator {
7409
7287
  */
7410
7288
  handlePasskeyError(error) {
7411
7289
  logger.error('SDK::Authenticator::handlePasskeyError', error);
7290
+ return this.throwPasskeyError(this.classifyPasskeyError(error), error);
7291
+ }
7292
+ classifyPasskeyError(error) {
7412
7293
  if (error instanceof WebAuthn__namespace.WebAuthnError) {
7413
7294
  logger.debug('SDK::Authenticator::handlePasskeyError - WebAuthnError', error);
7414
- return this.throwPasskeyError({ errorCode: error.code });
7295
+ return { errorCode: error.code };
7415
7296
  }
7416
7297
  else if (error instanceof Error) {
7417
7298
  logger.debug('SDK::Authenticator::handlePasskeyError - Error', error);
7418
- return this.throwPasskeyError({ errorMessage: error.message });
7299
+ return { errorMessage: error.message };
7419
7300
  }
7420
- else if (typeof error === 'object' && error.error && error.message) {
7301
+ else if (error !== null && typeof error === 'object' && error.error && error.message) {
7421
7302
  logger.debug('SDK::Authenticator::handlePasskeyError - Object', error);
7422
- return this.throwPasskeyError({ errorCode: error.error, errorMessage: error.message });
7303
+ return { errorCode: error.error, errorMessage: error.message };
7423
7304
  }
7424
7305
  else if (typeof error === 'string') {
7425
7306
  logger.debug('SDK::Authenticator::handlePasskeyError - String', error);
7426
- return this.throwPasskeyError({ errorMessage: error });
7307
+ return { errorMessage: error };
7427
7308
  }
7428
7309
  else {
7429
7310
  logger.debug('SDK::Authenticator::handlePasskeyError - Unknown', error);
7430
- return this.throwPasskeyError({});
7311
+ return {};
7431
7312
  }
7432
7313
  }
7433
- throwPasskeyError({ errorCode, errorMessage }) {
7314
+ // `cause` is the original caught error, preserved so consumers can inspect the
7315
+ // underlying DOMException (e.g. NotAllowedError for a user-cancelled prompt).
7316
+ // Without it the wrapped WallabyError only carries an opaque message and the
7317
+ // real failure is unrecoverable downstream.
7318
+ throwPasskeyError({ errorCode, errorMessage }, cause) {
7434
7319
  var _a, _b, _c;
7435
7320
  logger.error('SDK::Authenticator::throwPasskeyError', errorCode);
7436
7321
  const errorToThrow = PasskeyErrorCodes.find((error) => {
@@ -7441,6 +7326,7 @@ class Authenticator {
7441
7326
  message: (_b = (_a = errorToThrow === null || errorToThrow === void 0 ? void 0 : errorToThrow.message) !== null && _a !== void 0 ? _a : errorMessage) !== null && _b !== void 0 ? _b : UnknownError.message,
7442
7327
  statusCode: 400,
7443
7328
  errorCode: (_c = errorToThrow === null || errorToThrow === void 0 ? void 0 : errorToThrow.error) !== null && _c !== void 0 ? _c : errorCode,
7329
+ cause,
7444
7330
  });
7445
7331
  }
7446
7332
  }
@@ -7894,6 +7780,9 @@ class PasskeyService {
7894
7780
  key: exports.LocalStorageItems.AccessToken,
7895
7781
  value: authenticationResponse.accessToken,
7896
7782
  },
7783
+ ...(authenticationResponse.refreshToken
7784
+ ? [{ key: exports.LocalStorageItems.RefreshToken, value: authenticationResponse.refreshToken }]
7785
+ : []),
7897
7786
  ]);
7898
7787
  }
7899
7788
  /**
@@ -8030,10 +7919,8 @@ class AuthService extends Base {
8030
7919
  */
8031
7920
  async validateSession() {
8032
7921
  const accessToken = await this.localStorageService.fetch(exports.LocalStorageItems.AccessToken);
8033
- if (!accessToken) {
8034
- return false;
8035
- }
8036
- return !jwtHasExpired(accessToken);
7922
+ const refreshToken = await this.localStorageService.fetch(exports.LocalStorageItems.RefreshToken);
7923
+ return (!!accessToken && !jwtHasExpired(accessToken)) || !!refreshToken;
8037
7924
  }
8038
7925
  /**
8039
7926
  * @description Validates the user's password by decrypting the stored private key.
@@ -8218,6 +8105,9 @@ class AuthService extends Base {
8218
8105
  });
8219
8106
  }
8220
8107
  await this.localStorageService.save(exports.LocalStorageItems.AccessToken, authentication.accessToken);
8108
+ if (authentication.refreshToken) {
8109
+ await this.localStorageService.save(exports.LocalStorageItems.RefreshToken, authentication.refreshToken);
8110
+ }
8221
8111
  return Object.freeze(Object.assign(Object.assign({}, authentication), input));
8222
8112
  }
8223
8113
  catch (error) {
@@ -8419,6 +8309,7 @@ class AuthService extends Base {
8419
8309
  key: exports.LocalStorageItems.AccessToken,
8420
8310
  value: authResponse.accessToken,
8421
8311
  },
8312
+ ...(authResponse.refreshToken ? [{ key: exports.LocalStorageItems.RefreshToken, value: authResponse.refreshToken }] : []),
8422
8313
  ]);
8423
8314
  return authResponse;
8424
8315
  });
@@ -8542,8 +8433,8 @@ class WalletHandlersService extends Base {
8542
8433
  encryptedSeed: readyForTransportSeedPhrase,
8543
8434
  clientAuthPubKey: deviceAuthKeys.publicKey,
8544
8435
  returnWalletOption: importWalletInput.returnWalletOption,
8545
- numShares: numberOfKeyShares !== null && numberOfKeyShares !== void 0 ? numberOfKeyShares : 0,
8546
- threshold: threshold !== null && threshold !== void 0 ? threshold : 0,
8436
+ numShares: numberOfKeyShares,
8437
+ threshold: threshold,
8547
8438
  walletOwnershipType: exports.WalletOwnershipType.SingleOwner,
8548
8439
  wallabyKeepsOne: (_d = (_c = importWalletInput.keyShareOptions) === null || _c === void 0 ? void 0 : _c.storeOneKeyShareWithWallaby) !== null && _d !== void 0 ? _d : false,
8549
8440
  };
@@ -8631,8 +8522,8 @@ class WalletHandlersService extends Base {
8631
8522
  hashedMessage,
8632
8523
  clientAuthPubKey: deviceAuthKeys.publicKey,
8633
8524
  returnWalletOption: walletCreationInput.returnWalletOption,
8634
- numShares: numberOfKeyShares !== null && numberOfKeyShares !== void 0 ? numberOfKeyShares : 0,
8635
- threshold: threshold !== null && threshold !== void 0 ? threshold : 0,
8525
+ numShares: numberOfKeyShares,
8526
+ threshold: threshold,
8636
8527
  wallabyKeepsOne: (_c = (_b = walletCreationInput.keyShareOptions) === null || _b === void 0 ? void 0 : _b.storeOneKeyShareWithWallaby) !== null && _c !== void 0 ? _c : false,
8637
8528
  walletOwnershipType: (_d = walletCreationInput.walletOwnershipType) !== null && _d !== void 0 ? _d : exports.WalletOwnershipType.SingleOwner,
8638
8529
  };