@dynamic-labs/embedded-wallet 3.0.0-alpha.28 → 3.0.0-alpha.30

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/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
1
 
2
+ ## [3.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.29...v3.0.0-alpha.30) (2024-07-27)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * don't filter out bitcoin.com when searching for bitcoin ([#6408](https://github.com/dynamic-labs/DynamicAuth/issues/6408)) ([6af5456](https://github.com/dynamic-labs/DynamicAuth/commit/6af54567faa430660b2443638adc103e829eb49d))
8
+ * improve metamask starknet snap network polling interval management ([#6424](https://github.com/dynamic-labs/DynamicAuth/issues/6424)) ([22c4376](https://github.com/dynamic-labs/DynamicAuth/commit/22c4376596d5e07d1da30190baf159c43a8956c6))
9
+ * isCookieEnabled should check externalAuth.cookieName ([#6433](https://github.com/dynamic-labs/DynamicAuth/issues/6433)) ([91d95e5](https://github.com/dynamic-labs/DynamicAuth/commit/91d95e5664f70c2eb306082419d6fece9753f220))
10
+ * phantom ledger works on safari ([#6428](https://github.com/dynamic-labs/DynamicAuth/issues/6428)) ([a8a81f6](https://github.com/dynamic-labs/DynamicAuth/commit/a8a81f6fd4d8ae5ba04525ef6ff6a84a1732a03a))
11
+
12
+ ## [3.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.28...v3.0.0-alpha.29) (2024-07-25)
13
+
14
+
15
+ ### Features
16
+
17
+ * add link to starknet snap companion app in network switch modal ([#6417](https://github.com/dynamic-labs/DynamicAuth/issues/6417)) ([132a3f8](https://github.com/dynamic-labs/DynamicAuth/commit/132a3f84af62930583f042f35e9616bc837ee49d))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * improve network switch ux for starknet snap on login ([#6376](https://github.com/dynamic-labs/DynamicAuth/issues/6376)) ([db4af65](https://github.com/dynamic-labs/DynamicAuth/commit/db4af6576dc164876750ad6e13f4624d8a11a1a3))
23
+
2
24
  ## [3.0.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.27...v3.0.0-alpha.28) (2024-07-25)
3
25
 
4
26
  ## [3.0.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.26...v3.0.0-alpha.27) (2024-07-24)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet",
3
- "version": "3.0.0-alpha.28",
3
+ "version": "3.0.0-alpha.30",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -31,9 +31,10 @@
31
31
  "@turnkey/http": "2.7.1",
32
32
  "@turnkey/iframe-stamper": "2.0.0",
33
33
  "@turnkey/webauthn-stamper": "0.5.0",
34
- "@dynamic-labs/utils": "3.0.0-alpha.28",
35
- "@dynamic-labs/wallet-book": "3.0.0-alpha.28",
36
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.28"
34
+ "@dynamic-labs/logger": "3.0.0-alpha.30",
35
+ "@dynamic-labs/utils": "3.0.0-alpha.30",
36
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.30",
37
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.30"
37
38
  },
38
39
  "peerDependencies": {}
39
40
  }
package/src/index.cjs CHANGED
@@ -8,6 +8,7 @@ var types = require('./types.cjs');
8
8
  var PasskeyService = require('./lib/utils/PasskeyService/PasskeyService.cjs');
9
9
  var findTurnkeyVerifiedCredential = require('./lib/utils/findTurnkeyVerifiedCredential/findTurnkeyVerifiedCredential.cjs');
10
10
  require('./lib/utils/convertAttestationTransports/convertAttestationTransports.cjs');
11
+ var logger = require('./lib/utils/logger/logger.cjs');
11
12
  var TurnkeyAuthenticatorRecoveryHandler = require('./lib/AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.cjs');
12
13
  var ExportHandler = require('./lib/ExportHandler/ExportHandler.cjs');
13
14
  var constants = require('./lib/constants.cjs');
@@ -18,8 +19,14 @@ exports.TurnkeyWalletConnectorBase = TurnkeyWalletConnectorBase.TurnkeyWalletCon
18
19
  exports.TurnkeyWalletConnectorInfo = types.TurnkeyWalletConnectorInfo;
19
20
  exports.PasskeyService = PasskeyService.PasskeyService;
20
21
  exports.findTurnkeyVerifiedCredential = findTurnkeyVerifiedCredential.findTurnkeyVerifiedCredential;
22
+ exports.logger = logger.logger;
21
23
  exports.turnkeyAuthenticatorRecoveryHandler = TurnkeyAuthenticatorRecoveryHandler.turnkeyAuthenticatorRecoveryHandler;
22
24
  exports.ExportHandler = ExportHandler.ExportHandler;
25
+ exports.INVALID_PASSKEY_SELECTED = constants.INVALID_PASSKEY_SELECTED;
23
26
  exports.TURNKEY_API_BASE_URL = constants.TURNKEY_API_BASE_URL;
24
27
  exports.TURNKEY_API_KEY_EXPIRY_MESSAGE = constants.TURNKEY_API_KEY_EXPIRY_MESSAGE;
25
28
  exports.TURNKEY_API_KEY_NOT_FOUND_MESSAGE = constants.TURNKEY_API_KEY_NOT_FOUND_MESSAGE;
29
+ exports.TURNKEY_SDK_BENIGN_ERRORS = constants.TURNKEY_SDK_BENIGN_ERRORS;
30
+ exports.TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS = constants.TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS;
31
+ exports.WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE = constants.WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE;
32
+ exports.WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE = constants.WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE;
package/src/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { TurnkeyWalletConnectorBase, type SessionKeys, } from './lib/TurnkeyWalletConnectorBase';
2
2
  export * from './types';
3
3
  export * from './lib/utils/PasskeyService';
4
- export { findTurnkeyVerifiedCredential } from './lib/utils';
4
+ export { findTurnkeyVerifiedCredential, logger } from './lib/utils';
5
5
  export * from './lib/AuthenticatorHandler';
6
6
  export { ExportHandler } from './lib/ExportHandler';
7
- export { TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE, } from './lib/constants';
7
+ export * from './lib/constants';
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ export { TurnkeyWalletConnectorInfo } from './types.js';
4
4
  export { PasskeyService } from './lib/utils/PasskeyService/PasskeyService.js';
5
5
  export { findTurnkeyVerifiedCredential } from './lib/utils/findTurnkeyVerifiedCredential/findTurnkeyVerifiedCredential.js';
6
6
  import './lib/utils/convertAttestationTransports/convertAttestationTransports.js';
7
+ export { logger } from './lib/utils/logger/logger.js';
7
8
  export { turnkeyAuthenticatorRecoveryHandler } from './lib/AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.js';
8
9
  export { ExportHandler } from './lib/ExportHandler/ExportHandler.js';
9
- export { TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE } from './lib/constants.js';
10
+ export { INVALID_PASSKEY_SELECTED, TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE, TURNKEY_SDK_BENIGN_ERRORS, TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS, WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE, WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE } from './lib/constants.js';
@@ -7,8 +7,9 @@ var _tslib = require('../../../_virtual/_tslib.cjs');
7
7
  var iframeStamper = require('@turnkey/iframe-stamper');
8
8
  var http = require('@turnkey/http');
9
9
  var utils = require('@dynamic-labs/utils');
10
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
10
  var PasskeyService = require('../utils/PasskeyService/PasskeyService.cjs');
11
+ require('../utils/convertAttestationTransports/convertAttestationTransports.cjs');
12
+ var logger = require('../utils/logger/logger.cjs');
12
13
 
13
14
  const turnkeyBaseUrl = 'https://api.turnkey.com';
14
15
  const turnkeyPasskeyRecoveryUrl = 'https://recovery.turnkey.com';
@@ -127,7 +128,7 @@ class TurnkeyAuthenticatorRecoveryHandler {
127
128
  }
128
129
  }
129
130
  catch (err) {
130
- walletConnectorCore.logger.error('Error while verifying recovery code', err);
131
+ logger.logger.error('Error while verifying recovery code', err);
131
132
  if (err instanceof utils.DynamicError) {
132
133
  throw err;
133
134
  }
@@ -156,7 +157,7 @@ class TurnkeyAuthenticatorRecoveryHandler {
156
157
  });
157
158
  }
158
159
  catch (err) {
159
- walletConnectorCore.logger.error('[TK] Error while completing recovery process', err);
160
+ logger.logger.error('[TK] Error while completing recovery process', err);
160
161
  throw err;
161
162
  }
162
163
  });
@@ -184,7 +185,7 @@ class TurnkeyAuthenticatorRecoveryHandler {
184
185
  });
185
186
  }
186
187
  catch (err) {
187
- walletConnectorCore.logger.error('[TK] Error while creating new authenticator', err);
188
+ logger.logger.error('[TK] Error while creating new authenticator', err);
188
189
  throw err;
189
190
  }
190
191
  });
@@ -215,7 +216,7 @@ class TurnkeyAuthenticatorRecoveryHandler {
215
216
  return { signedRequest, userId: turnkeyUserId };
216
217
  }
217
218
  catch (err) {
218
- walletConnectorCore.logger.error('Error while adding email recovery', err);
219
+ logger.logger.error('Error while adding email recovery', err);
219
220
  throw err;
220
221
  }
221
222
  });
@@ -3,8 +3,9 @@ import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { IframeStamper } from '@turnkey/iframe-stamper';
4
4
  import { TurnkeyClient } from '@turnkey/http';
5
5
  import { DynamicError, getTLD, PlatformService } from '@dynamic-labs/utils';
6
- import { logger } from '@dynamic-labs/wallet-connector-core';
7
6
  import { PasskeyService } from '../utils/PasskeyService/PasskeyService.js';
7
+ import '../utils/convertAttestationTransports/convertAttestationTransports.js';
8
+ import { logger } from '../utils/logger/logger.js';
8
9
 
9
10
  const turnkeyBaseUrl = 'https://api.turnkey.com';
10
11
  const turnkeyPasskeyRecoveryUrl = 'https://recovery.turnkey.com';
@@ -7,9 +7,10 @@ var _tslib = require('../../../_virtual/_tslib.cjs');
7
7
  var iframeStamper = require('@turnkey/iframe-stamper');
8
8
  var http = require('@turnkey/http');
9
9
  var utils = require('@dynamic-labs/utils');
10
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
10
  var TurnkeyAuthenticatorRecoveryHandler = require('../AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.cjs');
12
11
  var PasskeyService = require('../utils/PasskeyService/PasskeyService.cjs');
12
+ require('../utils/convertAttestationTransports/convertAttestationTransports.cjs');
13
+ var logger = require('../utils/logger/logger.cjs');
13
14
 
14
15
  const turnkeyBaseUrl = 'https://api.turnkey.com';
15
16
  const turnkeyExportUrl = 'https://export.turnkey.com';
@@ -62,7 +63,7 @@ class ExportHandler {
62
63
  return yield this.__iframeStamper.injectWalletExportBundle(exportBundle, organizationId);
63
64
  }
64
65
  catch (err) {
65
- walletConnectorCore.logger.error('Error while verifying export wallet', err);
66
+ logger.logger.error('Error while verifying export wallet', err);
66
67
  throw err;
67
68
  }
68
69
  });
@@ -76,7 +77,7 @@ class ExportHandler {
76
77
  return yield this.__iframeStamper.injectKeyExportBundle(exportBundle, organizationId, chain === 'solana' ? iframeStamper.KeyFormat.Solana : iframeStamper.KeyFormat.Hexadecimal);
77
78
  }
78
79
  catch (err) {
79
- walletConnectorCore.logger.error('Error while verifying export private key', err);
80
+ logger.logger.error('Error while verifying export private key', err);
80
81
  throw err;
81
82
  }
82
83
  });
@@ -105,7 +106,7 @@ class ExportHandler {
105
106
  return newActivity.activity;
106
107
  }
107
108
  catch (err) {
108
- walletConnectorCore.logger.error('[TK] Error while completing export private key process', err);
109
+ logger.logger.error('[TK] Error while completing export private key process', err);
109
110
  throw err;
110
111
  }
111
112
  });
@@ -143,7 +144,7 @@ class ExportHandler {
143
144
  return newActivity.activity;
144
145
  }
145
146
  catch (err) {
146
- walletConnectorCore.logger.error('[TK] Error while completing export wallet process', err);
147
+ logger.logger.error('[TK] Error while completing export wallet process', err);
147
148
  throw err;
148
149
  }
149
150
  });
@@ -3,9 +3,10 @@ import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { IframeStamper, KeyFormat } from '@turnkey/iframe-stamper';
4
4
  import { TurnkeyClient } from '@turnkey/http';
5
5
  import { getTLD, PlatformService, DynamicError } from '@dynamic-labs/utils';
6
- import { logger } from '@dynamic-labs/wallet-connector-core';
7
6
  import { turnkeyAuthenticatorRecoveryHandler } from '../AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.js';
8
7
  import { PasskeyService } from '../utils/PasskeyService/PasskeyService.js';
8
+ import '../utils/convertAttestationTransports/convertAttestationTransports.js';
9
+ import { logger } from '../utils/logger/logger.js';
9
10
 
10
11
  const turnkeyBaseUrl = 'https://api.turnkey.com';
11
12
  const turnkeyExportUrl = 'https://export.turnkey.com';
@@ -10,6 +10,7 @@ var utils = require('@dynamic-labs/utils');
10
10
  var base64UrlEncode = require('../utils/base64UrlEncode/base64UrlEncode.cjs');
11
11
  var generateRandomBuffer = require('../utils/generateRandomBuffer/generateRandomBuffer.cjs');
12
12
  var convertAttestationTransports = require('../utils/convertAttestationTransports/convertAttestationTransports.cjs');
13
+ var logger = require('../utils/logger/logger.cjs');
13
14
  var TurnkeyAuthenticatorRecoveryHandler = require('../AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.cjs');
14
15
  var ExportHandler = require('../ExportHandler/ExportHandler.cjs');
15
16
  var PasskeyService = require('../utils/PasskeyService/PasskeyService.cjs');
@@ -77,7 +78,7 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
77
78
  attestation = yield PasskeyService.PasskeyService.getWebAuthnAttestation(webAuthnCreateParams);
78
79
  }
79
80
  catch (error) {
80
- walletConnectorCore.logger.warn(`Unable to register webauthn credential on the current page's TLD ${utils.getTLD()}. Falling back to using hostname. ${utils.PlatformService.getHostname()}`, error);
81
+ logger.logger.warn(`Unable to register webauthn credential on the current page's TLD ${utils.getTLD()}. Falling back to using hostname. ${utils.PlatformService.getHostname()}`, error);
81
82
  // Create the passkey on the hostname instead.
82
83
  webAuthnCreateParams.publicKey.rp.id = utils.PlatformService.getHostname();
83
84
  attestation = yield PasskeyService.PasskeyService.getWebAuthnAttestation(webAuthnCreateParams);
@@ -187,7 +188,7 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
187
188
  apiPublicKey: sessionKeys.publicKey,
188
189
  });
189
190
  ExportHandler.ExportHandler.apiKeyStamper = TurnkeyWalletConnectorBase.apiKeyStamper;
190
- walletConnectorCore.logger.setMetaData('sessionApiPublicKey', sessionKeys.publicKey);
191
+ logger.logger.setMetaData('sessionApiPublicKey', sessionKeys.publicKey);
191
192
  return sessionKeys.publicKey;
192
193
  }
193
194
  catch (error) {
@@ -217,8 +218,8 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
217
218
  }
218
219
  setLoggerMetadata() {
219
220
  var _a, _b, _c;
220
- walletConnectorCore.logger.setMetaData('turnkeySubOrganizationId', (_b = (_a = this._verifiedCredential) === null || _a === void 0 ? void 0 : _a.walletProperties) === null || _b === void 0 ? void 0 : _b.turnkeySubOrganizationId);
221
- walletConnectorCore.logger.setMetaData('walletId', (_c = this._verifiedCredential) === null || _c === void 0 ? void 0 : _c.id);
221
+ logger.logger.setMetaData('turnkeySubOrganizationId', (_b = (_a = this._verifiedCredential) === null || _a === void 0 ? void 0 : _a.walletProperties) === null || _b === void 0 ? void 0 : _b.turnkeySubOrganizationId);
222
+ logger.logger.setMetaData('walletId', (_c = this._verifiedCredential) === null || _c === void 0 ? void 0 : _c.id);
222
223
  }
223
224
  }
224
225
  TurnkeyWalletConnectorBase.isLoadingSession = false;
@@ -1,11 +1,12 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { ApiKeyStamper } from '@turnkey/api-key-stamper';
4
- import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
4
+ import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
5
5
  import { getTLD, PlatformService, DynamicError } from '@dynamic-labs/utils';
6
6
  import { base64UrlEncode } from '../utils/base64UrlEncode/base64UrlEncode.js';
7
7
  import { generateRandomBuffer } from '../utils/generateRandomBuffer/generateRandomBuffer.js';
8
8
  import { convertAttestationTransports } from '../utils/convertAttestationTransports/convertAttestationTransports.js';
9
+ import { logger } from '../utils/logger/logger.js';
9
10
  import { turnkeyAuthenticatorRecoveryHandler } from '../AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.js';
10
11
  import { ExportHandler } from '../ExportHandler/ExportHandler.js';
11
12
  import { PasskeyService } from '../utils/PasskeyService/PasskeyService.js';
@@ -6,7 +6,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  const TURNKEY_API_BASE_URL = 'https://api.turnkey.com';
7
7
  const TURNKEY_API_KEY_EXPIRY_MESSAGE = 'Turnkey error 16: expired api key';
8
8
  const TURNKEY_API_KEY_NOT_FOUND_MESSAGE = 'Turnkey error 16: could not find public key';
9
+ const WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE = 'The operation either timed out or was not allowed';
10
+ const WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE = 'The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.';
11
+ const INVALID_PASSKEY_SELECTED = 'Turnkey error 5: webauthn authenticator not found in organization or parent organization';
12
+ const TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS = [
13
+ TURNKEY_API_KEY_EXPIRY_MESSAGE,
14
+ TURNKEY_API_KEY_NOT_FOUND_MESSAGE,
15
+ ];
16
+ const TURNKEY_SDK_BENIGN_ERRORS = [
17
+ WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,
18
+ WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,
19
+ INVALID_PASSKEY_SELECTED,
20
+ ];
9
21
 
22
+ exports.INVALID_PASSKEY_SELECTED = INVALID_PASSKEY_SELECTED;
10
23
  exports.TURNKEY_API_BASE_URL = TURNKEY_API_BASE_URL;
11
24
  exports.TURNKEY_API_KEY_EXPIRY_MESSAGE = TURNKEY_API_KEY_EXPIRY_MESSAGE;
12
25
  exports.TURNKEY_API_KEY_NOT_FOUND_MESSAGE = TURNKEY_API_KEY_NOT_FOUND_MESSAGE;
26
+ exports.TURNKEY_SDK_BENIGN_ERRORS = TURNKEY_SDK_BENIGN_ERRORS;
27
+ exports.TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS = TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS;
28
+ exports.WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE = WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE;
29
+ exports.WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE = WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE;
@@ -1,3 +1,8 @@
1
1
  export declare const TURNKEY_API_BASE_URL = "https://api.turnkey.com";
2
2
  export declare const TURNKEY_API_KEY_EXPIRY_MESSAGE = "Turnkey error 16: expired api key";
3
3
  export declare const TURNKEY_API_KEY_NOT_FOUND_MESSAGE = "Turnkey error 16: could not find public key";
4
+ export declare const WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE = "The operation either timed out or was not allowed";
5
+ export declare const WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE = "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.";
6
+ export declare const INVALID_PASSKEY_SELECTED = "Turnkey error 5: webauthn authenticator not found in organization or parent organization";
7
+ export declare const TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS: string[];
8
+ export declare const TURNKEY_SDK_BENIGN_ERRORS: string[];
@@ -2,5 +2,17 @@
2
2
  const TURNKEY_API_BASE_URL = 'https://api.turnkey.com';
3
3
  const TURNKEY_API_KEY_EXPIRY_MESSAGE = 'Turnkey error 16: expired api key';
4
4
  const TURNKEY_API_KEY_NOT_FOUND_MESSAGE = 'Turnkey error 16: could not find public key';
5
+ const WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE = 'The operation either timed out or was not allowed';
6
+ const WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE = 'The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.';
7
+ const INVALID_PASSKEY_SELECTED = 'Turnkey error 5: webauthn authenticator not found in organization or parent organization';
8
+ const TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS = [
9
+ TURNKEY_API_KEY_EXPIRY_MESSAGE,
10
+ TURNKEY_API_KEY_NOT_FOUND_MESSAGE,
11
+ ];
12
+ const TURNKEY_SDK_BENIGN_ERRORS = [
13
+ WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,
14
+ WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,
15
+ INVALID_PASSKEY_SELECTED,
16
+ ];
5
17
 
6
- export { TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE };
18
+ export { INVALID_PASSKEY_SELECTED, TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE, TURNKEY_SDK_BENIGN_ERRORS, TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS, WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE, WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE };
@@ -2,3 +2,4 @@ export * from './findTurnkeyVerifiedCredential';
2
2
  export * from './base64UrlEncode';
3
3
  export * from './generateRandomBuffer';
4
4
  export * from './convertAttestationTransports';
5
+ export * from './logger';
@@ -0,0 +1 @@
1
+ export * from './logger';
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var logger$1 = require('@dynamic-labs/logger');
7
+ var constants = require('../../constants.cjs');
8
+
9
+ class DynamicEmbeddedWalletsLogger extends logger$1.Logger {
10
+ constructor(name, level) {
11
+ super(name, level);
12
+ }
13
+ error(message, ...args) {
14
+ const [err] = args;
15
+ if (!(err === null || err === void 0 ? void 0 : err.message) ||
16
+ !constants.TURNKEY_SDK_BENIGN_ERRORS.some((errorMsg) => err.message.includes(errorMsg))) {
17
+ logger$1.Logger.events.emit('error', message);
18
+ this.log(logger$1.LogLevel.ERROR, message, ...args);
19
+ }
20
+ else {
21
+ // log benign turnkey sdk errors as WARN
22
+ this.warn(message, ...args);
23
+ }
24
+ }
25
+ }
26
+ const logger = new DynamicEmbeddedWalletsLogger('Dynamic embedded wallets', logger$1.LogLevel.INFO);
27
+
28
+ exports.DynamicEmbeddedWalletsLogger = DynamicEmbeddedWalletsLogger;
29
+ exports.logger = logger;
@@ -0,0 +1,6 @@
1
+ import { LogLevel, Logger, Message } from '@dynamic-labs/logger';
2
+ export declare class DynamicEmbeddedWalletsLogger extends Logger {
3
+ constructor(name: string | string[], level?: LogLevel);
4
+ error(message: Message, ...args: any[]): void;
5
+ }
6
+ export declare const logger: DynamicEmbeddedWalletsLogger;
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ import { LogLevel, Logger } from '@dynamic-labs/logger';
3
+ import { TURNKEY_SDK_BENIGN_ERRORS } from '../../constants.js';
4
+
5
+ class DynamicEmbeddedWalletsLogger extends Logger {
6
+ constructor(name, level) {
7
+ super(name, level);
8
+ }
9
+ error(message, ...args) {
10
+ const [err] = args;
11
+ if (!(err === null || err === void 0 ? void 0 : err.message) ||
12
+ !TURNKEY_SDK_BENIGN_ERRORS.some((errorMsg) => err.message.includes(errorMsg))) {
13
+ Logger.events.emit('error', message);
14
+ this.log(LogLevel.ERROR, message, ...args);
15
+ }
16
+ else {
17
+ // log benign turnkey sdk errors as WARN
18
+ this.warn(message, ...args);
19
+ }
20
+ }
21
+ }
22
+ const logger = new DynamicEmbeddedWalletsLogger('Dynamic embedded wallets', LogLevel.INFO);
23
+
24
+ export { DynamicEmbeddedWalletsLogger, logger };