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.esm.js CHANGED
@@ -201,7 +201,6 @@ var KeyTypeName;
201
201
  KeyTypeName["WallabyShare"] = "wallaby_share";
202
202
  KeyTypeName["OwnerMainDeviceShare"] = "owner_main_device_share";
203
203
  KeyTypeName["OwnerBackupDeviceShare"] = "owner_backup_device_share";
204
- KeyTypeName["AddedUserShare"] = "added_user_share";
205
204
  })(KeyTypeName || (KeyTypeName = {}));
206
205
  var SeedPhraseType;
207
206
  (function (SeedPhraseType) {
@@ -257,6 +256,7 @@ var AuthType;
257
256
  var LocalStorageItems;
258
257
  (function (LocalStorageItems) {
259
258
  LocalStorageItems["AccessToken"] = "access-token";
259
+ LocalStorageItems["RefreshToken"] = "refresh-token";
260
260
  LocalStorageItems["EncryptedStandardSeedPhrase"] = "encrypted-standard-seedPhrase";
261
261
  LocalStorageItems["EncryptedKeyShares"] = "encrypted-key-shares";
262
262
  LocalStorageItems["PrimaryDeviceKeyShare"] = "primary-device-key-share";
@@ -291,6 +291,7 @@ var V1KeyNames;
291
291
  var V2KeyNames;
292
292
  (function (V2KeyNames) {
293
293
  V2KeyNames["AccessToken"] = "access-token";
294
+ V2KeyNames["RefreshToken"] = "refresh-token";
294
295
  V2KeyNames["BackupDeviceKeyShare"] = "backup-device-key-share";
295
296
  V2KeyNames["ClientAuthPublicKey"] = "client-auth-pub-key";
296
297
  V2KeyNames["ClientAuthToken"] = "republic-jwt";
@@ -568,7 +569,7 @@ const MASTER_ENCRYPTION_KEY = '9fa9d3f3c77c20d3a50a08e5299644be29f6e6206ef3479fe
568
569
  { type: 'public-key', alg: PublicKeyCredentialAlgorithm.ES256 },
569
570
  ];
570
571
  const isWeb = typeof window !== 'undefined' && typeof document !== 'undefined';
571
- const currentPackageVersion = "3.0.2" ;
572
+ const currentPackageVersion = "3.1.0" ;
572
573
 
573
574
  /**
574
575
  * Storage keys adapter for Storage interface across different platforms.
@@ -4748,7 +4749,12 @@ class StorageService {
4748
4749
  V2KeyNames.PrimaryDeviceKeyShare,
4749
4750
  V2KeyNames.BackupDeviceKeyShare,
4750
4751
  ];
4751
- this._keysProtectedByMasterKey = [V2KeyNames.AccessToken, V2KeyNames.PasskeyCredential, V2KeyNames.ClientAuthToken];
4752
+ this._keysProtectedByMasterKey = [
4753
+ V2KeyNames.AccessToken,
4754
+ V2KeyNames.RefreshToken,
4755
+ V2KeyNames.PasskeyCredential,
4756
+ V2KeyNames.ClientAuthToken,
4757
+ ];
4752
4758
  this.userId = userId;
4753
4759
  this.environment = environment !== null && environment !== void 0 ? environment : defaultEnvironment;
4754
4760
  this.shortenedEnv = this.environment.slice(0, 1); // d for development
@@ -5110,6 +5116,7 @@ class StorageService {
5110
5116
  async clearLocalStorage(walletId) {
5111
5117
  const userKeysToRemove = [
5112
5118
  LocalStorageItems.AccessToken,
5119
+ LocalStorageItems.RefreshToken,
5113
5120
  V2KeyNames.EncryptedDevicePrivateKey,
5114
5121
  V2KeyNames.WallabyAuthPubKey,
5115
5122
  V2KeyNames.PasskeyCredential,
@@ -5318,7 +5325,7 @@ var ContentType;
5318
5325
  })(ContentType || (ContentType = {}));
5319
5326
  class HttpClient {
5320
5327
  constructor(apiConfig = {}) {
5321
- this.baseUrl = "https://staging-testnet.wallaby.cash";
5328
+ this.baseUrl = "https://dev-testnet.wallaby.cash";
5322
5329
  this.securityData = null;
5323
5330
  this.abortControllers = new Map();
5324
5331
  this.customFetch = (...fetchParams) => fetch(...fetchParams);
@@ -5453,7 +5460,7 @@ class HttpClient {
5453
5460
  /**
5454
5461
  * @title STAGING
5455
5462
  * @version 1.0
5456
- * @baseUrl https://staging-testnet.wallaby.cash
5463
+ * @baseUrl https://dev-testnet.wallaby.cash
5457
5464
  * @contact
5458
5465
  *
5459
5466
  * The STAGING is an API that manages the wallets of the Republic Crypto
@@ -5538,18 +5545,17 @@ class Api {
5538
5545
  *
5539
5546
  * @tags Auth
5540
5547
  * @name RefreshAccessToken
5541
- * @summary Users will be able to sign up by providing a signature and message. Use the same pair keys used on sign up
5548
+ * @summary Exchange a refresh token for a new access token and refresh token pair
5542
5549
  * @request POST:/api/v1/auth/refresh-access-token
5543
- * @deprecated
5544
5550
  * @secure
5545
5551
  */
5546
- refreshAccessToken: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/auth/refresh-access-token`, method: "POST", secure: true, format: "json" }, params)),
5552
+ 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)),
5547
5553
  /**
5548
- * No description
5554
+ * @description Invalidates the current access token and its associated refresh token. Other active sessions are preserved.
5549
5555
  *
5550
5556
  * @tags Auth
5551
5557
  * @name Logout
5552
- * @summary Invalidate the current session by revoking the bearer token
5558
+ * @summary Revoke the current session by invalidating the access token and its linked refresh token.
5553
5559
  * @request POST:/api/v1/auth/logout
5554
5560
  * @secure
5555
5561
  */
@@ -5642,6 +5648,20 @@ class Api {
5642
5648
  * @secure
5643
5649
  */
5644
5650
  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)),
5651
+ /**
5652
+ * No description
5653
+ *
5654
+ * @tags Assets
5655
+ * @name GetAssetConfigById
5656
+ * @summary Get asset configuration by ID
5657
+ * @request GET:/api/v1/assets/configurations/{assetConfigId}
5658
+ * @secure
5659
+ */
5660
+ getAssetConfigById: (_a, params) => {
5661
+ var { assetConfigId } = _a; __rest(_a, ["assetConfigId"]);
5662
+ if (params === void 0) { params = {}; }
5663
+ return this.http.request(Object.assign({ path: `/api/v1/assets/configurations/${assetConfigId}`, method: "GET", secure: true, format: "json" }, params));
5664
+ },
5645
5665
  /**
5646
5666
  * No description
5647
5667
  *
@@ -5974,26 +5994,6 @@ class Api {
5974
5994
  * @secure
5975
5995
  */
5976
5996
  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)),
5977
- /**
5978
- * No description
5979
- *
5980
- * @tags Wallets, MPC
5981
- * @name ShareWallet
5982
- * @summary Share an entity wallet with another user
5983
- * @request POST:/api/v1/wallets/initiate-share-wallet
5984
- * @secure
5985
- */
5986
- 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)),
5987
- /**
5988
- * No description
5989
- *
5990
- * @tags Wallets, MPC
5991
- * @name UnshareWallet
5992
- * @summary Unshare an entity wallet with a user previously granted access
5993
- * @request POST:/api/v1/wallets/unshare-wallet
5994
- * @secure
5995
- */
5996
- 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)),
5997
5997
  /**
5998
5998
  * No description
5999
5999
  *
@@ -6058,16 +6058,6 @@ class Api {
6058
6058
  * @secure
6059
6059
  */
6060
6060
  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)),
6061
- /**
6062
- * No description
6063
- *
6064
- * @tags Wallets, Multisig
6065
- * @name CreateMultisigAsset
6066
- * @summary Initiate creation for a new multisig asset, by specifying participants and the threshold
6067
- * @request POST:/api/v1/wallets/create-multisig-asset
6068
- * @secure
6069
- */
6070
- 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)),
6071
6061
  /**
6072
6062
  * No description
6073
6063
  *
@@ -6075,6 +6065,7 @@ class Api {
6075
6065
  * @name InitiateWalletRecovery
6076
6066
  * @summary Wallet Recovery - Step 1: Initiate wallet recovery
6077
6067
  * @request POST:/api/v1/wallets/recover/init
6068
+ * @deprecated
6078
6069
  * @secure
6079
6070
  */
6080
6071
  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)),
@@ -6085,19 +6076,10 @@ class Api {
6085
6076
  * @name RecoverWallet
6086
6077
  * @summary Wallet Recovery - Step 2 and final: Recover the lost wallet and its assets
6087
6078
  * @request POST:/api/v1/wallets/recover
6079
+ * @deprecated
6088
6080
  * @secure
6089
6081
  */
6090
6082
  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)),
6091
- /**
6092
- * No description
6093
- *
6094
- * @tags Wallets, Algorand
6095
- * @name ConvertStandardPhraseToAlgoSpecific
6096
- * @summary Convert BIP39 Standard seed phrase to Algorand fixed 25 words mnemonic phrase
6097
- * @request POST:/api/v1/wallets/convert-mnemonic-seed
6098
- * @secure
6099
- */
6100
- 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)),
6101
6083
  /**
6102
6084
  * No description
6103
6085
  *
@@ -6143,7 +6125,7 @@ class Api {
6143
6125
  /**
6144
6126
  * No description
6145
6127
  *
6146
- * @tags Wallets, Transactions
6128
+ * @tags Wallets, Swaps
6147
6129
  * @name ExecuteSwap
6148
6130
  * @summary Execute a swap transaction between supported assets
6149
6131
  * @request POST:/api/v1/wallets/execute-swap
@@ -6202,46 +6184,6 @@ class Api {
6202
6184
  * @secure
6203
6185
  */
6204
6186
  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)),
6205
- /**
6206
- * No description
6207
- *
6208
- * @tags Transactions
6209
- * @name InitMultisigTransfer
6210
- * @summary User initiating and signing a multi-sig transfer request
6211
- * @request POST:/api/v1/transactions/init-multisig-transfer
6212
- * @secure
6213
- */
6214
- 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)),
6215
- /**
6216
- * No description
6217
- *
6218
- * @tags Transactions, Multisig
6219
- * @name InitMultisigAssetOptin
6220
- * @summary User initiating a multi-sig asset optin request and subsequently signs the first signature on the request
6221
- * @request POST:/api/v1/transactions/init-multisig-asset-optin
6222
- * @secure
6223
- */
6224
- 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)),
6225
- /**
6226
- * No description
6227
- *
6228
- * @tags Transactions, Multisig
6229
- * @name InitMultisigAppOptin
6230
- * @summary User initiating a multi-sig app optin request and subsequently signs the first signature on the request
6231
- * @request POST:/api/v1/transactions/init-multisig-app-optin
6232
- * @secure
6233
- */
6234
- 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)),
6235
- /**
6236
- * No description
6237
- *
6238
- * @tags Transactions, Multisig
6239
- * @name SignOnMultisigTransactionRequest
6240
- * @summary Append signature to an existing multisig transaction request: It can be a request to transfer, optin, etc, ...
6241
- * @request POST:/api/v1/transactions/sign-multisig-request
6242
- * @secure
6243
- */
6244
- 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)),
6245
6187
  /**
6246
6188
  * No description
6247
6189
  *
@@ -6272,16 +6214,6 @@ class Api {
6272
6214
  * @secure
6273
6215
  */
6274
6216
  getEstimateFee: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/estimate-fee`, method: "GET", query: query, secure: true, format: "json" }, params)),
6275
- /**
6276
- * @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
6277
- *
6278
- * @tags Transactions, Raw, Transactions
6279
- * @name SignAndBroadcastRawTx
6280
- * @summary Sign and broadcast raw transaction API
6281
- * @request POST:/api/v1/transactions/sign-broadcast-rawtx
6282
- * @secure
6283
- */
6284
- 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)),
6285
6217
  /**
6286
6218
  * No description
6287
6219
  *
@@ -6292,16 +6224,6 @@ class Api {
6292
6224
  * @secure
6293
6225
  */
6294
6226
  fetchTransactionByHashOrReference: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/status`, method: "GET", query: query, secure: true, format: "json" }, params)),
6295
- /**
6296
- * No description
6297
- *
6298
- * @tags Transactions, Transactions, Multisig, Raw
6299
- * @name InitMultisigRawTransaction
6300
- * @summary Initiate a multisig raw transaction and sign the first signature on that same transaction
6301
- * @request POST:/api/v1/transactions/init-sign-broadcast-multisig-rawtx
6302
- * @secure
6303
- */
6304
- 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)),
6305
6227
  /**
6306
6228
  * No description
6307
6229
  *
@@ -6312,20 +6234,6 @@ class Api {
6312
6234
  * @secure
6313
6235
  */
6314
6236
  getDetailedRawTransactionDataByReference: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/raw-status`, method: "GET", query: query, secure: true, format: "json" }, params)),
6315
- /**
6316
- * No description
6317
- *
6318
- * @tags Transactions, Query
6319
- * @name FetchTransactionParticipants
6320
- * @summary Fetch transaction's participants
6321
- * @request GET:/api/v1/transactions/{reference}/participants
6322
- * @secure
6323
- */
6324
- fetchTransactionParticipants: (_a, params) => {
6325
- var { reference } = _a; __rest(_a, ["reference"]);
6326
- if (params === void 0) { params = {}; }
6327
- return this.http.request(Object.assign({ path: `/api/v1/transactions/${reference}/participants`, method: "GET", secure: true, format: "json" }, params));
6328
- },
6329
6237
  /**
6330
6238
  * No description
6331
6239
  *
@@ -6349,7 +6257,7 @@ class Api {
6349
6257
  /**
6350
6258
  * No description
6351
6259
  *
6352
- * @tags Transactions, Optin
6260
+ * @tags Transactions
6353
6261
  * @name CheckAssetOptinForAddress
6354
6262
  * @summary Get the list of all assets that the current account has opted into. This is only relevant for the Algorand chain
6355
6263
  * @request GET:/api/v1/transactions/check-asset-optin
@@ -6359,7 +6267,7 @@ class Api {
6359
6267
  /**
6360
6268
  * No description
6361
6269
  *
6362
- * @tags Transactions, Optin
6270
+ * @tags Transactions
6363
6271
  * @name CheckAppOptinForAddress
6364
6272
  * @summary Get the list of all apps that the current account has opted into. This is only relevant for the Algorand chain
6365
6273
  * @request GET:/api/v1/transactions/check-app-optin
@@ -6450,26 +6358,6 @@ class Api {
6450
6358
  fetchAssetPairPrice: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/query/get-asset-price`, method: "GET", query: query, secure: true, format: "json" }, params)),
6451
6359
  };
6452
6360
  this.mpc = {
6453
- /**
6454
- * No description
6455
- *
6456
- * @tags Mpc
6457
- * @name InitKeyExchange
6458
- * @summary Initialize key exchange process, the keys exchanged will be later used for encryption/decryption of the payloads exchanged
6459
- * @request POST:/api/v1/mpc/init-key-exchange
6460
- * @secure
6461
- */
6462
- 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)),
6463
- /**
6464
- * No description
6465
- *
6466
- * @tags Mpc
6467
- * @name RequestSeedphraseSplit
6468
- * @summary Request seed phrase split and return shares that can be used later for recovery
6469
- * @request POST:/api/v1/mpc/request-seed-split
6470
- * @secure
6471
- */
6472
- 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)),
6473
6361
  /**
6474
6362
  * No description
6475
6363
  *
@@ -6622,20 +6510,6 @@ class Api {
6622
6510
  if (params === void 0) { params = {}; }
6623
6511
  return this.http.request(Object.assign({ path: `/api/v1/users/${externalUserId}/externalUserId`, method: "GET", secure: true, format: "json" }, params));
6624
6512
  },
6625
- /**
6626
- * No description
6627
- *
6628
- * @tags Users
6629
- * @name GetParticipantsByUserId
6630
- * @summary Returns multisig participants by user id
6631
- * @request GET:/api/v1/users/{userId}/multisig-transactions
6632
- * @secure
6633
- */
6634
- getParticipantsByUserId: (_a, params) => {
6635
- var { userId } = _a, query = __rest(_a, ["userId"]);
6636
- if (params === void 0) { params = {}; }
6637
- return this.http.request(Object.assign({ path: `/api/v1/users/${userId}/multisig-transactions`, method: "GET", query: query, secure: true, format: "json" }, params));
6638
- },
6639
6513
  };
6640
6514
  this.adminTransactions = {
6641
6515
  /**
@@ -6737,7 +6611,7 @@ class Api {
6737
6611
  * @request GET:/api/v1/transactions/admin/callback_pk
6738
6612
  * @secure
6739
6613
  */
6740
- getCallbackPublicKey: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/admin/callback_pk`, method: "GET", secure: true }, params)),
6614
+ getCallbackPublicKey: (query, params = {}) => this.http.request(Object.assign({ path: `/api/v1/transactions/admin/callback_pk`, method: "GET", query: query, secure: true }, params)),
6741
6615
  /**
6742
6616
  * No description
6743
6617
  *
@@ -6763,19 +6637,23 @@ class Api {
6763
6637
  */
6764
6638
  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)),
6765
6639
  };
6766
- this.v1 = {
6640
+ this.dashboard = {
6767
6641
  /**
6768
6642
  * No description
6769
6643
  *
6644
+ * @tags Dashboard
6770
6645
  * @name GetDashboardData
6771
6646
  * @summary Create new merchant. This endpoint is only available for super admin and republic admin
6772
6647
  * @request GET:/api/v1/dashboard
6773
6648
  * @secure
6774
6649
  */
6775
6650
  getDashboardData: (params = {}) => this.http.request(Object.assign({ path: `/api/v1/dashboard`, method: "GET", secure: true }, params)),
6651
+ };
6652
+ this.userActivity = {
6776
6653
  /**
6777
6654
  * No description
6778
6655
  *
6656
+ * @tags UserActivity
6779
6657
  * @name GetActivitiees
6780
6658
  * @summary Get all activities. This endpoint is only available for super admin and republic admin
6781
6659
  * @request GET:/api/v1/users-activities
@@ -7380,28 +7258,35 @@ class Authenticator {
7380
7258
  */
7381
7259
  handlePasskeyError(error) {
7382
7260
  logger.error('SDK::Authenticator::handlePasskeyError', error);
7261
+ return this.throwPasskeyError(this.classifyPasskeyError(error), error);
7262
+ }
7263
+ classifyPasskeyError(error) {
7383
7264
  if (error instanceof WebAuthn.WebAuthnError) {
7384
7265
  logger.debug('SDK::Authenticator::handlePasskeyError - WebAuthnError', error);
7385
- return this.throwPasskeyError({ errorCode: error.code });
7266
+ return { errorCode: error.code };
7386
7267
  }
7387
7268
  else if (error instanceof Error) {
7388
7269
  logger.debug('SDK::Authenticator::handlePasskeyError - Error', error);
7389
- return this.throwPasskeyError({ errorMessage: error.message });
7270
+ return { errorMessage: error.message };
7390
7271
  }
7391
- else if (typeof error === 'object' && error.error && error.message) {
7272
+ else if (error !== null && typeof error === 'object' && error.error && error.message) {
7392
7273
  logger.debug('SDK::Authenticator::handlePasskeyError - Object', error);
7393
- return this.throwPasskeyError({ errorCode: error.error, errorMessage: error.message });
7274
+ return { errorCode: error.error, errorMessage: error.message };
7394
7275
  }
7395
7276
  else if (typeof error === 'string') {
7396
7277
  logger.debug('SDK::Authenticator::handlePasskeyError - String', error);
7397
- return this.throwPasskeyError({ errorMessage: error });
7278
+ return { errorMessage: error };
7398
7279
  }
7399
7280
  else {
7400
7281
  logger.debug('SDK::Authenticator::handlePasskeyError - Unknown', error);
7401
- return this.throwPasskeyError({});
7282
+ return {};
7402
7283
  }
7403
7284
  }
7404
- throwPasskeyError({ errorCode, errorMessage }) {
7285
+ // `cause` is the original caught error, preserved so consumers can inspect the
7286
+ // underlying DOMException (e.g. NotAllowedError for a user-cancelled prompt).
7287
+ // Without it the wrapped WallabyError only carries an opaque message and the
7288
+ // real failure is unrecoverable downstream.
7289
+ throwPasskeyError({ errorCode, errorMessage }, cause) {
7405
7290
  var _a, _b, _c;
7406
7291
  logger.error('SDK::Authenticator::throwPasskeyError', errorCode);
7407
7292
  const errorToThrow = PasskeyErrorCodes.find((error) => {
@@ -7412,6 +7297,7 @@ class Authenticator {
7412
7297
  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,
7413
7298
  statusCode: 400,
7414
7299
  errorCode: (_c = errorToThrow === null || errorToThrow === void 0 ? void 0 : errorToThrow.error) !== null && _c !== void 0 ? _c : errorCode,
7300
+ cause,
7415
7301
  });
7416
7302
  }
7417
7303
  }
@@ -7865,6 +7751,9 @@ class PasskeyService {
7865
7751
  key: LocalStorageItems.AccessToken,
7866
7752
  value: authenticationResponse.accessToken,
7867
7753
  },
7754
+ ...(authenticationResponse.refreshToken
7755
+ ? [{ key: LocalStorageItems.RefreshToken, value: authenticationResponse.refreshToken }]
7756
+ : []),
7868
7757
  ]);
7869
7758
  }
7870
7759
  /**
@@ -8001,10 +7890,8 @@ class AuthService extends Base {
8001
7890
  */
8002
7891
  async validateSession() {
8003
7892
  const accessToken = await this.localStorageService.fetch(LocalStorageItems.AccessToken);
8004
- if (!accessToken) {
8005
- return false;
8006
- }
8007
- return !jwtHasExpired(accessToken);
7893
+ const refreshToken = await this.localStorageService.fetch(LocalStorageItems.RefreshToken);
7894
+ return (!!accessToken && !jwtHasExpired(accessToken)) || !!refreshToken;
8008
7895
  }
8009
7896
  /**
8010
7897
  * @description Validates the user's password by decrypting the stored private key.
@@ -8189,6 +8076,9 @@ class AuthService extends Base {
8189
8076
  });
8190
8077
  }
8191
8078
  await this.localStorageService.save(LocalStorageItems.AccessToken, authentication.accessToken);
8079
+ if (authentication.refreshToken) {
8080
+ await this.localStorageService.save(LocalStorageItems.RefreshToken, authentication.refreshToken);
8081
+ }
8192
8082
  return Object.freeze(Object.assign(Object.assign({}, authentication), input));
8193
8083
  }
8194
8084
  catch (error) {
@@ -8390,6 +8280,7 @@ class AuthService extends Base {
8390
8280
  key: LocalStorageItems.AccessToken,
8391
8281
  value: authResponse.accessToken,
8392
8282
  },
8283
+ ...(authResponse.refreshToken ? [{ key: LocalStorageItems.RefreshToken, value: authResponse.refreshToken }] : []),
8393
8284
  ]);
8394
8285
  return authResponse;
8395
8286
  });
@@ -8513,8 +8404,8 @@ class WalletHandlersService extends Base {
8513
8404
  encryptedSeed: readyForTransportSeedPhrase,
8514
8405
  clientAuthPubKey: deviceAuthKeys.publicKey,
8515
8406
  returnWalletOption: importWalletInput.returnWalletOption,
8516
- numShares: numberOfKeyShares !== null && numberOfKeyShares !== void 0 ? numberOfKeyShares : 0,
8517
- threshold: threshold !== null && threshold !== void 0 ? threshold : 0,
8407
+ numShares: numberOfKeyShares,
8408
+ threshold: threshold,
8518
8409
  walletOwnershipType: WalletOwnershipType.SingleOwner,
8519
8410
  wallabyKeepsOne: (_d = (_c = importWalletInput.keyShareOptions) === null || _c === void 0 ? void 0 : _c.storeOneKeyShareWithWallaby) !== null && _d !== void 0 ? _d : false,
8520
8411
  };
@@ -8602,8 +8493,8 @@ class WalletHandlersService extends Base {
8602
8493
  hashedMessage,
8603
8494
  clientAuthPubKey: deviceAuthKeys.publicKey,
8604
8495
  returnWalletOption: walletCreationInput.returnWalletOption,
8605
- numShares: numberOfKeyShares !== null && numberOfKeyShares !== void 0 ? numberOfKeyShares : 0,
8606
- threshold: threshold !== null && threshold !== void 0 ? threshold : 0,
8496
+ numShares: numberOfKeyShares,
8497
+ threshold: threshold,
8607
8498
  wallabyKeepsOne: (_c = (_b = walletCreationInput.keyShareOptions) === null || _b === void 0 ? void 0 : _b.storeOneKeyShareWithWallaby) !== null && _c !== void 0 ? _c : false,
8608
8499
  walletOwnershipType: (_d = walletCreationInput.walletOwnershipType) !== null && _d !== void 0 ? _d : WalletOwnershipType.SingleOwner,
8609
8500
  };