@dynamic-labs-sdk/client 0.1.0-alpha.3 → 0.1.0-alpha.5

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/core.cjs.js +1 -0
  3. package/core.esm.js +3 -3
  4. package/getChainFromVerifiedCredentialChain.cjs.js +2 -1
  5. package/getChainFromVerifiedCredentialChain.esm.js +2 -2
  6. package/getNetworkProviderFromNetworkId.esm.js +2 -2
  7. package/getSignedSessionId.esm.js +1 -1
  8. package/getWalletProviderByKey.cjs.js +144 -0
  9. package/getWalletProviderByKey.esm.js +139 -2
  10. package/index.cjs.js +36 -26
  11. package/index.esm.js +16 -7
  12. package/package.json +3 -3
  13. package/refreshUser.cjs.js +1 -125
  14. package/refreshUser.esm.js +3 -122
  15. package/src/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
  16. package/src/client/types/DynamicClient.d.ts +4 -0
  17. package/src/client/types/DynamicClient.d.ts.map +1 -1
  18. package/src/exports/core.d.ts +1 -0
  19. package/src/exports/core.d.ts.map +1 -1
  20. package/src/modules/auth/consts.d.ts +2 -0
  21. package/src/modules/auth/consts.d.ts.map +1 -0
  22. package/src/modules/auth/logout/logout.d.ts.map +1 -1
  23. package/src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
  24. package/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
  25. package/src/modules/state/raiseStateEvents/events.d.ts +4 -0
  26. package/src/modules/state/raiseStateEvents/events.d.ts.map +1 -1
  27. package/src/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
  28. package/src/utils/setCookie/index.d.ts +2 -0
  29. package/src/utils/setCookie/index.d.ts.map +1 -0
  30. package/src/utils/setCookie/setCookie.d.ts +5 -0
  31. package/src/utils/setCookie/setCookie.d.ts.map +1 -0
  32. package/waas.esm.js +2 -2
  33. package/waasCore.cjs.js +2 -1
  34. package/waasCore.esm.js +3 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.1.0-alpha.5 (2025-09-11)
2
+
3
+ ### 🚀 Features
4
+
5
+ - expose the session expires at date ([#420](https://github.com/dynamic-labs/dynamic-sdk/pull/420))
6
+
7
+ ## 0.1.0-alpha.4 (2025-09-10)
8
+
9
+ ### 🩹 Fixes
10
+
11
+ - set client version to project settings api call ([#414](https://github.com/dynamic-labs/dynamic-sdk/pull/414))
12
+
1
13
  ## 0.1.0-alpha.3 (2025-09-09)
2
14
 
3
15
  This was a version bump only, there were no code changes.
package/core.cjs.js CHANGED
@@ -258,6 +258,7 @@ exports.formatWalletProviderKey = getWalletProviderByKey.formatWalletProviderKey
258
258
  exports.getWalletProviderFromWalletAccount = getWalletProviderByKey.getWalletProviderFromWalletAccount;
259
259
  exports.getWalletProviderRegistry = getWalletProviderByKey.getWalletProviderRegistry;
260
260
  exports.getWalletProviders = getWalletProviderByKey.getWalletProviders;
261
+ exports.updateAuthFromVerifyResponse = getWalletProviderByKey.updateAuthFromVerifyResponse;
261
262
  exports.consumeMfaTokenIfRequiredForAction = getSignedSessionId.consumeMfaTokenIfRequiredForAction;
262
263
  exports.getSignedSessionId = getSignedSessionId.getSignedSessionId;
263
264
  exports.ClientsDoNotMatchError = ClientsDoNotMatchError;
package/core.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
2
  import { B as BaseError, a as getCore, e as assertDefined, b as getBuffer, n as name, v as version } from './getChainFromVerifiedCredentialChain.esm.js';
3
- export { A as APIError, h as ClientNotFoundError, D as DYNAMIC_SDK_API_VERSION, V as ValueMustBeDefinedError, c as createApiClient, j as getChainFromVerifiedCredentialChain, g as getDefaultClient, i as isCookieEnabled } from './getChainFromVerifiedCredentialChain.esm.js';
3
+ export { A as APIError, j as ClientNotFoundError, D as DYNAMIC_SDK_API_VERSION, V as ValueMustBeDefinedError, c as createApiClient, k as getChainFromVerifiedCredentialChain, g as getDefaultClient, i as isCookieEnabled } from './getChainFromVerifiedCredentialChain.esm.js';
4
4
  import { c as createStorageKeySchema, d as getNetworkProviders, N as NoNetworkProvidersError } from './getNetworkProviderFromNetworkId.esm.js';
5
5
  export { C as CannotTrackError, I as InvalidStorageSet, a as createLogger, f as formatSignInMessage, e as getNetworkProviderBuilderRegistry, b as getNetworkProviderFromNetworkId, h as hasExtension, s as subscribeWithSelector } from './getNetworkProviderFromNetworkId.esm.js';
6
- import { a as getWalletProviderByKey, f as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
7
- export { N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent, h as formatWalletProviderKey, g as getWalletProviderFromWalletAccount, i as getWalletProviderRegistry, b as getWalletProviders } from './getWalletProviderByKey.esm.js';
6
+ import { b as getWalletProviderByKey, j as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
7
+ export { N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent, k as formatWalletProviderKey, a as getWalletProviderFromWalletAccount, l as getWalletProviderRegistry, f as getWalletProviders, u as updateAuthFromVerifyResponse } from './getWalletProviderByKey.esm.js';
8
8
  export { c as consumeMfaTokenIfRequiredForAction, g as getSignedSessionId } from './getSignedSessionId.esm.js';
9
9
  import * as z from 'zod/mini';
10
10
  import EventEmitter from 'eventemitter3';
@@ -4,7 +4,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
4
4
  var buffer = require('buffer');
5
5
 
6
6
  var name = "@dynamic-labs-sdk/client";
7
- var version = "0.1.0-alpha.3";
7
+ var version = "0.1.0-alpha.5";
8
8
  var dependencies = {
9
9
  "@dynamic-labs/sdk-api-core": "0.0.762"};
10
10
 
@@ -449,6 +449,7 @@ const getChainFromVerifiedCredentialChain = (verifiedCredentialChain)=>{
449
449
  exports.APIError = APIError;
450
450
  exports.BaseError = BaseError;
451
451
  exports.CHAINS_INFO_MAP = CHAINS_INFO_MAP;
452
+ exports.CLIENT_SDK_NAME = CLIENT_SDK_NAME;
452
453
  exports.ClientNotFoundError = ClientNotFoundError;
453
454
  exports.DYNAMIC_SDK_API_VERSION = DYNAMIC_SDK_API_VERSION;
454
455
  exports.InvalidExternalAuthError = InvalidExternalAuthError;
@@ -2,7 +2,7 @@ import { AuthStorageEnum, SDKApi, Configuration } from '@dynamic-labs/sdk-api-co
2
2
  import { Buffer as Buffer$1 } from 'buffer';
3
3
 
4
4
  var name = "@dynamic-labs-sdk/client";
5
- var version = "0.1.0-alpha.3";
5
+ var version = "0.1.0-alpha.5";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/sdk-api-core": "0.0.762"};
8
8
 
@@ -444,4 +444,4 @@ const getChainFromVerifiedCredentialChain = (verifiedCredentialChain)=>{
444
444
  return chain;
445
445
  };
446
446
 
447
- export { APIError as A, BaseError as B, CHAINS_INFO_MAP as C, DYNAMIC_SDK_API_VERSION as D, InvalidExternalAuthError as I, MfaInvalidOtpError as M, SandboxMaximumThresholdReachedError as S, ValueMustBeDefinedError as V, _extends as _, getCore as a, getBuffer as b, createApiClient as c, dependencies as d, assertDefined as e, MfaRateLimitedError as f, getDefaultClient as g, ClientNotFoundError as h, isCookieEnabled as i, getChainFromVerifiedCredentialChain as j, getSessionKeys as k, name as n, randomString as r, setDefaultClient as s, version as v };
447
+ export { APIError as A, BaseError as B, CLIENT_SDK_NAME as C, DYNAMIC_SDK_API_VERSION as D, InvalidExternalAuthError as I, MfaInvalidOtpError as M, SandboxMaximumThresholdReachedError as S, ValueMustBeDefinedError as V, _extends as _, getCore as a, getBuffer as b, createApiClient as c, dependencies as d, assertDefined as e, CHAINS_INFO_MAP as f, getDefaultClient as g, MfaRateLimitedError as h, isCookieEnabled as i, ClientNotFoundError as j, getChainFromVerifiedCredentialChain as k, getSessionKeys as l, name as n, randomString as r, setDefaultClient as s, version as v };
@@ -1,6 +1,6 @@
1
- import { B as BaseError, g as getDefaultClient, a as getCore, C as CHAINS_INFO_MAP, e as assertDefined } from './getChainFromVerifiedCredentialChain.esm.js';
1
+ import { B as BaseError, g as getDefaultClient, a as getCore, f as CHAINS_INFO_MAP, e as assertDefined } from './getChainFromVerifiedCredentialChain.esm.js';
2
2
  import { EventEmitter } from 'eventemitter3';
3
- import { f as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
3
+ import { j as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
4
4
 
5
5
  /**
6
6
  * Shallow compare two objects.
@@ -1,5 +1,5 @@
1
1
  import { i as isMfaRequiredForAction, c as consumeMfaToken, b as bufferToHex } from './isMfaRequiredForAction.esm.js';
2
- import { k as getSessionKeys, e as assertDefined, a as getCore } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { l as getSessionKeys, e as assertDefined, a as getCore } from './getChainFromVerifiedCredentialChain.esm.js';
3
3
 
4
4
  const consumeMfaTokenIfRequiredForAction = async ({ mfaAction }, client)=>{
5
5
  const isRequiredForAction = await isMfaRequiredForAction({
@@ -1,6 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var getChainFromVerifiedCredentialChain = require('./getChainFromVerifiedCredentialChain.cjs.js');
4
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
5
+
6
+ /**
7
+ * Sefelly sets the cookie in the browser.
8
+ */ const setCookie = (cookie)=>{
9
+ // eslint-disable-next-line no-restricted-globals
10
+ document.cookie = cookie;
11
+ };
4
12
 
5
13
  /**
6
14
  * Adds an event listener for Dynamic client events.
@@ -63,6 +71,34 @@ var getChainFromVerifiedCredentialChain = require('./getChainFromVerifiedCredent
63
71
  eventEmitter.emit(event, args);
64
72
  };
65
73
 
74
+ const normalizeAddress = (address, chain)=>{
75
+ let normalizedAddress = address;
76
+ if (normalizedAddress == null ? void 0 : normalizedAddress.startsWith('0x')) {
77
+ normalizedAddress = normalizedAddress.slice(2);
78
+ }
79
+ /**
80
+ * These are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
81
+ * see also: https://github.com/ChainAgnostic/namespaces
82
+ * note: no standard namespace currently exists for flow
83
+ */ const chainsThatRequireLowercaseAddress = [
84
+ 'EVM',
85
+ 'FLOW'
86
+ ];
87
+ normalizedAddress = chainsThatRequireLowercaseAddress.includes(chain) ? normalizedAddress == null ? void 0 : normalizedAddress.toLowerCase() : normalizedAddress;
88
+ return normalizedAddress;
89
+ };
90
+
91
+ const createWalletAccountId = (chain, address)=>`${chain}-${normalizeAddress(address, chain)}`;
92
+
93
+ const convertUnverifiedWalletAccountToWalletAccount = (unverifiedWalletAccount)=>({
94
+ address: unverifiedWalletAccount.address,
95
+ chain: unverifiedWalletAccount.chain,
96
+ id: createWalletAccountId(unverifiedWalletAccount.chain, unverifiedWalletAccount.address),
97
+ lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
98
+ verifiedCredentialId: null,
99
+ walletProviderKey: unverifiedWalletAccount.walletProviderKey
100
+ });
101
+
66
102
  /**
67
103
  * Format the wallet name and chain to get a wallet provider key.
68
104
  */ const formatWalletProviderKey = (walletName, chain)=>{
@@ -70,6 +106,57 @@ var getChainFromVerifiedCredentialChain = require('./getChainFromVerifiedCredent
70
106
  return `${sanitizedWalletName}${chain.toLocaleLowerCase()}`;
71
107
  };
72
108
 
109
+ const convertVerifiedCredentialToWalletAccount = (verified)=>{
110
+ getChainFromVerifiedCredentialChain.assertDefined(verified.address, 'Missing address in verified credential');
111
+ getChainFromVerifiedCredentialChain.assertDefined(verified.chain, 'Missing chain in verified credential');
112
+ getChainFromVerifiedCredentialChain.assertDefined(verified.walletName, 'Missing wallet name in verified credential');
113
+ const chain = getChainFromVerifiedCredentialChain.getChainFromVerifiedCredentialChain(verified.chain);
114
+ const hasChainInWalletName = verified.walletName.endsWith(chain.toLowerCase());
115
+ // we need to make sure the walletProviderKey follows the correct format ([walletName][chain])
116
+ // some walletNames will follow the legacy format (e.g. "phantom" instead of "phantomsol", "metamask" instead of "metamaskevm")
117
+ // so we need to make sure we parse it correctly
118
+ const walletProviderKey = hasChainInWalletName ? verified.walletName : formatWalletProviderKey(verified.walletName, chain);
119
+ var _verified_lastSelectedAt;
120
+ return {
121
+ address: verified.address,
122
+ chain,
123
+ id: createWalletAccountId(chain, verified.address),
124
+ lastSelectedAt: (_verified_lastSelectedAt = verified.lastSelectedAt) != null ? _verified_lastSelectedAt : null,
125
+ verifiedCredentialId: verified.id,
126
+ walletProviderKey
127
+ };
128
+ };
129
+
130
+ const getWalletAccountsFromState = (state)=>{
131
+ const { unverifiedWalletAccounts, user } = state;
132
+ const walletAccountsMap = new Map();
133
+ /**
134
+ * Handle the unverified wallet accounts before the user verified credentials
135
+ * so the later verified wallet accounts can override the unverified wallet accounts
136
+ */ unverifiedWalletAccounts.forEach((unverifiedWalletAccount)=>{
137
+ const walletAccount = convertUnverifiedWalletAccountToWalletAccount(unverifiedWalletAccount);
138
+ walletAccountsMap.set(walletAccount.id, walletAccount);
139
+ });
140
+ var _user_verifiedCredentials;
141
+ /**
142
+ * Handle user verified credentials
143
+ */ const verifiedCredentials = (_user_verifiedCredentials = user == null ? void 0 : user.verifiedCredentials) != null ? _user_verifiedCredentials : [];
144
+ verifiedCredentials.filter((verified)=>verified.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain).map((verifiedWalletAccount)=>convertVerifiedCredentialToWalletAccount(verifiedWalletAccount)).forEach((verifiedWalletAccount)=>walletAccountsMap.set(verifiedWalletAccount.id, verifiedWalletAccount));
145
+ return Array.from(walletAccountsMap.values());
146
+ };
147
+
148
+ /**
149
+ * Retrieves all wallet accounts associated with the current session.
150
+ *
151
+ * This function returns both verified and unverified wallet accounts,
152
+ * combining data from user credentials and local unverified accounts.
153
+ * You can differentiate between verified and unverified wallet accounts by
154
+ * checking the `verifiedCredentialId` property.
155
+ *
156
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
157
+ * @returns An array of wallet accounts associated with the session.
158
+ */ const getWalletAccounts = (client = getChainFromVerifiedCredentialChain.getDefaultClient())=>getWalletAccountsFromState(getChainFromVerifiedCredentialChain.getCore(client).state.get());
159
+
73
160
  class NoWalletProviderFoundError extends getChainFromVerifiedCredentialChain.BaseError {
74
161
  constructor({ walletProviderKey }){
75
162
  super({
@@ -212,6 +299,56 @@ const getWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
212
299
  return walletProvider;
213
300
  };
214
301
 
302
+ const DYNAMIC_AUTH_COOKIE_NAME = 'DYNAMIC_JWT_TOKEN';
303
+
304
+ /**
305
+ * Emits the `walletAccountsChanged` event.
306
+ */ const emitWalletAccountsChangedEvent = (client)=>{
307
+ const walletAccounts = getWalletAccounts(client);
308
+ emitEvent({
309
+ args: {
310
+ walletAccounts
311
+ },
312
+ event: 'walletAccountsChanged'
313
+ }, client);
314
+ };
315
+
316
+ const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client)=>{
317
+ const core = getChainFromVerifiedCredentialChain.getCore(client);
318
+ const walletAccountsHashBefore = getWalletAccountsHash(previousState);
319
+ const walletAccountsHashAfter = getWalletAccountsHash(core.state.get());
320
+ if (walletAccountsHashBefore !== walletAccountsHashAfter) {
321
+ emitWalletAccountsChangedEvent(client);
322
+ }
323
+ };
324
+ const getWalletAccountsHash = (state)=>getWalletAccountsFromState(state).map(({ id })=>id).sort().join('-');
325
+
326
+ const updateAuthFromVerifyResponse = ({ response }, client)=>{
327
+ const core = getChainFromVerifiedCredentialChain.getCore(client);
328
+ const previousState = getChainFromVerifiedCredentialChain._extends({}, core.state.get());
329
+ const { user, minifiedJwt, jwt, expiresAt, mfaToken } = response;
330
+ // Expires at is in seconds, so we need to convert it to milliseconds
331
+ const sessionExpiresAt = new Date(expiresAt * 1000);
332
+ core.state.set({
333
+ legacyToken: jwt != null ? jwt : null,
334
+ mfaToken: mfaToken != null ? mfaToken : null,
335
+ sessionExpiresAt: sessionExpiresAt,
336
+ token: minifiedJwt != null ? minifiedJwt : null,
337
+ user
338
+ });
339
+ /**
340
+ * For customers using a sandbox environment with cookies enabled, we need to set the cookie
341
+ * programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically
342
+ * so customers can access the cookie from document.cookie consistently between sandbox and live environments.
343
+ */ if (minifiedJwt && getChainFromVerifiedCredentialChain.isCookieEnabled(client)) {
344
+ const expireDate = sessionExpiresAt.toUTCString();
345
+ setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`);
346
+ }
347
+ checkAndRaiseWalletAccountsChangedEvent({
348
+ previousState
349
+ }, client);
350
+ };
351
+
215
352
  /**
216
353
  * Get all available wallet providers to interact with internally.
217
354
  */ const getWalletProviders = (client)=>{
@@ -230,14 +367,21 @@ const getWalletProviderByKey = ({ walletProviderKey }, client)=>{
230
367
  return walletProvider;
231
368
  };
232
369
 
370
+ exports.DYNAMIC_AUTH_COOKIE_NAME = DYNAMIC_AUTH_COOKIE_NAME;
233
371
  exports.NoWalletProviderFoundError = NoWalletProviderFoundError;
234
372
  exports.createRuntimeServiceAccessKey = createRuntimeServiceAccessKey;
373
+ exports.createWalletAccountId = createWalletAccountId;
235
374
  exports.emitEvent = emitEvent;
375
+ exports.emitWalletAccountsChangedEvent = emitWalletAccountsChangedEvent;
236
376
  exports.formatWalletProviderKey = formatWalletProviderKey;
377
+ exports.getWalletAccounts = getWalletAccounts;
237
378
  exports.getWalletProviderByKey = getWalletProviderByKey;
238
379
  exports.getWalletProviderFromWalletAccount = getWalletProviderFromWalletAccount;
239
380
  exports.getWalletProviderRegistry = getWalletProviderRegistry;
240
381
  exports.getWalletProviders = getWalletProviders;
382
+ exports.normalizeAddress = normalizeAddress;
241
383
  exports.offEvent = offEvent;
242
384
  exports.onEvent = onEvent;
243
385
  exports.onceEvent = onceEvent;
386
+ exports.setCookie = setCookie;
387
+ exports.updateAuthFromVerifyResponse = updateAuthFromVerifyResponse;
@@ -1,4 +1,12 @@
1
- import { g as getDefaultClient, a as getCore, B as BaseError } from './getChainFromVerifiedCredentialChain.esm.js';
1
+ import { g as getDefaultClient, a as getCore, e as assertDefined, k as getChainFromVerifiedCredentialChain, B as BaseError, _ as _extends, i as isCookieEnabled } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
3
+
4
+ /**
5
+ * Sefelly sets the cookie in the browser.
6
+ */ const setCookie = (cookie)=>{
7
+ // eslint-disable-next-line no-restricted-globals
8
+ document.cookie = cookie;
9
+ };
2
10
 
3
11
  /**
4
12
  * Adds an event listener for Dynamic client events.
@@ -61,6 +69,34 @@ import { g as getDefaultClient, a as getCore, B as BaseError } from './getChainF
61
69
  eventEmitter.emit(event, args);
62
70
  };
63
71
 
72
+ const normalizeAddress = (address, chain)=>{
73
+ let normalizedAddress = address;
74
+ if (normalizedAddress == null ? void 0 : normalizedAddress.startsWith('0x')) {
75
+ normalizedAddress = normalizedAddress.slice(2);
76
+ }
77
+ /**
78
+ * These are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
79
+ * see also: https://github.com/ChainAgnostic/namespaces
80
+ * note: no standard namespace currently exists for flow
81
+ */ const chainsThatRequireLowercaseAddress = [
82
+ 'EVM',
83
+ 'FLOW'
84
+ ];
85
+ normalizedAddress = chainsThatRequireLowercaseAddress.includes(chain) ? normalizedAddress == null ? void 0 : normalizedAddress.toLowerCase() : normalizedAddress;
86
+ return normalizedAddress;
87
+ };
88
+
89
+ const createWalletAccountId = (chain, address)=>`${chain}-${normalizeAddress(address, chain)}`;
90
+
91
+ const convertUnverifiedWalletAccountToWalletAccount = (unverifiedWalletAccount)=>({
92
+ address: unverifiedWalletAccount.address,
93
+ chain: unverifiedWalletAccount.chain,
94
+ id: createWalletAccountId(unverifiedWalletAccount.chain, unverifiedWalletAccount.address),
95
+ lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
96
+ verifiedCredentialId: null,
97
+ walletProviderKey: unverifiedWalletAccount.walletProviderKey
98
+ });
99
+
64
100
  /**
65
101
  * Format the wallet name and chain to get a wallet provider key.
66
102
  */ const formatWalletProviderKey = (walletName, chain)=>{
@@ -68,6 +104,57 @@ import { g as getDefaultClient, a as getCore, B as BaseError } from './getChainF
68
104
  return `${sanitizedWalletName}${chain.toLocaleLowerCase()}`;
69
105
  };
70
106
 
107
+ const convertVerifiedCredentialToWalletAccount = (verified)=>{
108
+ assertDefined(verified.address, 'Missing address in verified credential');
109
+ assertDefined(verified.chain, 'Missing chain in verified credential');
110
+ assertDefined(verified.walletName, 'Missing wallet name in verified credential');
111
+ const chain = getChainFromVerifiedCredentialChain(verified.chain);
112
+ const hasChainInWalletName = verified.walletName.endsWith(chain.toLowerCase());
113
+ // we need to make sure the walletProviderKey follows the correct format ([walletName][chain])
114
+ // some walletNames will follow the legacy format (e.g. "phantom" instead of "phantomsol", "metamask" instead of "metamaskevm")
115
+ // so we need to make sure we parse it correctly
116
+ const walletProviderKey = hasChainInWalletName ? verified.walletName : formatWalletProviderKey(verified.walletName, chain);
117
+ var _verified_lastSelectedAt;
118
+ return {
119
+ address: verified.address,
120
+ chain,
121
+ id: createWalletAccountId(chain, verified.address),
122
+ lastSelectedAt: (_verified_lastSelectedAt = verified.lastSelectedAt) != null ? _verified_lastSelectedAt : null,
123
+ verifiedCredentialId: verified.id,
124
+ walletProviderKey
125
+ };
126
+ };
127
+
128
+ const getWalletAccountsFromState = (state)=>{
129
+ const { unverifiedWalletAccounts, user } = state;
130
+ const walletAccountsMap = new Map();
131
+ /**
132
+ * Handle the unverified wallet accounts before the user verified credentials
133
+ * so the later verified wallet accounts can override the unverified wallet accounts
134
+ */ unverifiedWalletAccounts.forEach((unverifiedWalletAccount)=>{
135
+ const walletAccount = convertUnverifiedWalletAccountToWalletAccount(unverifiedWalletAccount);
136
+ walletAccountsMap.set(walletAccount.id, walletAccount);
137
+ });
138
+ var _user_verifiedCredentials;
139
+ /**
140
+ * Handle user verified credentials
141
+ */ const verifiedCredentials = (_user_verifiedCredentials = user == null ? void 0 : user.verifiedCredentials) != null ? _user_verifiedCredentials : [];
142
+ verifiedCredentials.filter((verified)=>verified.format === JwtVerifiedCredentialFormatEnum.Blockchain).map((verifiedWalletAccount)=>convertVerifiedCredentialToWalletAccount(verifiedWalletAccount)).forEach((verifiedWalletAccount)=>walletAccountsMap.set(verifiedWalletAccount.id, verifiedWalletAccount));
143
+ return Array.from(walletAccountsMap.values());
144
+ };
145
+
146
+ /**
147
+ * Retrieves all wallet accounts associated with the current session.
148
+ *
149
+ * This function returns both verified and unverified wallet accounts,
150
+ * combining data from user credentials and local unverified accounts.
151
+ * You can differentiate between verified and unverified wallet accounts by
152
+ * checking the `verifiedCredentialId` property.
153
+ *
154
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
155
+ * @returns An array of wallet accounts associated with the session.
156
+ */ const getWalletAccounts = (client = getDefaultClient())=>getWalletAccountsFromState(getCore(client).state.get());
157
+
71
158
  class NoWalletProviderFoundError extends BaseError {
72
159
  constructor({ walletProviderKey }){
73
160
  super({
@@ -210,6 +297,56 @@ const getWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
210
297
  return walletProvider;
211
298
  };
212
299
 
300
+ const DYNAMIC_AUTH_COOKIE_NAME = 'DYNAMIC_JWT_TOKEN';
301
+
302
+ /**
303
+ * Emits the `walletAccountsChanged` event.
304
+ */ const emitWalletAccountsChangedEvent = (client)=>{
305
+ const walletAccounts = getWalletAccounts(client);
306
+ emitEvent({
307
+ args: {
308
+ walletAccounts
309
+ },
310
+ event: 'walletAccountsChanged'
311
+ }, client);
312
+ };
313
+
314
+ const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client)=>{
315
+ const core = getCore(client);
316
+ const walletAccountsHashBefore = getWalletAccountsHash(previousState);
317
+ const walletAccountsHashAfter = getWalletAccountsHash(core.state.get());
318
+ if (walletAccountsHashBefore !== walletAccountsHashAfter) {
319
+ emitWalletAccountsChangedEvent(client);
320
+ }
321
+ };
322
+ const getWalletAccountsHash = (state)=>getWalletAccountsFromState(state).map(({ id })=>id).sort().join('-');
323
+
324
+ const updateAuthFromVerifyResponse = ({ response }, client)=>{
325
+ const core = getCore(client);
326
+ const previousState = _extends({}, core.state.get());
327
+ const { user, minifiedJwt, jwt, expiresAt, mfaToken } = response;
328
+ // Expires at is in seconds, so we need to convert it to milliseconds
329
+ const sessionExpiresAt = new Date(expiresAt * 1000);
330
+ core.state.set({
331
+ legacyToken: jwt != null ? jwt : null,
332
+ mfaToken: mfaToken != null ? mfaToken : null,
333
+ sessionExpiresAt: sessionExpiresAt,
334
+ token: minifiedJwt != null ? minifiedJwt : null,
335
+ user
336
+ });
337
+ /**
338
+ * For customers using a sandbox environment with cookies enabled, we need to set the cookie
339
+ * programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically
340
+ * so customers can access the cookie from document.cookie consistently between sandbox and live environments.
341
+ */ if (minifiedJwt && isCookieEnabled(client)) {
342
+ const expireDate = sessionExpiresAt.toUTCString();
343
+ setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`);
344
+ }
345
+ checkAndRaiseWalletAccountsChangedEvent({
346
+ previousState
347
+ }, client);
348
+ };
349
+
213
350
  /**
214
351
  * Get all available wallet providers to interact with internally.
215
352
  */ const getWalletProviders = (client)=>{
@@ -228,4 +365,4 @@ const getWalletProviderByKey = ({ walletProviderKey }, client)=>{
228
365
  return walletProvider;
229
366
  };
230
367
 
231
- export { NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderByKey as a, getWalletProviders as b, onceEvent as c, onEvent as d, emitEvent as e, createRuntimeServiceAccessKey as f, getWalletProviderFromWalletAccount as g, formatWalletProviderKey as h, getWalletProviderRegistry as i, offEvent as o };
368
+ export { DYNAMIC_AUTH_COOKIE_NAME as D, NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderFromWalletAccount as a, getWalletProviderByKey as b, createWalletAccountId as c, emitWalletAccountsChangedEvent as d, emitEvent as e, getWalletProviders as f, getWalletAccounts as g, onceEvent as h, onEvent as i, createRuntimeServiceAccessKey as j, formatWalletProviderKey as k, getWalletProviderRegistry as l, normalizeAddress as n, offEvent as o, setCookie as s, updateAuthFromVerifyResponse as u };
package/index.cjs.js CHANGED
@@ -4,12 +4,12 @@ var assertPackageVersion = require('@dynamic-labs-sdk/assert-package-version');
4
4
  var getChainFromVerifiedCredentialChain = require('./getChainFromVerifiedCredentialChain.cjs.js');
5
5
  var getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId.cjs.js');
6
6
  var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
7
- var refreshUser = require('./refreshUser.cjs.js');
8
7
  var z = require('zod/mini');
9
8
  var isMfaRequiredForAction = require('./isMfaRequiredForAction.cjs.js');
10
9
  var EventEmitter = require('eventemitter3');
11
10
  var browser = require('@simplewebauthn/browser');
12
11
  var InvalidParamError = require('./InvalidParamError.cjs.js');
12
+ var refreshUser = require('./refreshUser.cjs.js');
13
13
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
14
14
  require('buffer');
15
15
 
@@ -41,6 +41,7 @@ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
41
41
  initStatus: 'initStatusChanged',
42
42
  mfaToken: 'mfaTokenChanged',
43
43
  projectSettings: 'projectSettingsChanged',
44
+ sessionExpiresAt: 'sessionExpiresAtChanged',
44
45
  token: 'tokenChanged',
45
46
  user: 'userChanged'
46
47
  };
@@ -84,7 +85,7 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries })=>{
84
85
  *
85
86
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
86
87
  * @returns True if the user is signed in, false otherwise.
87
- */ const isSignedIn = (client = getChainFromVerifiedCredentialChain.getDefaultClient())=>Boolean(client.user || refreshUser.getWalletAccounts(client).length > 0);
88
+ */ const isSignedIn = (client = getChainFromVerifiedCredentialChain.getDefaultClient())=>Boolean(client.user || getWalletProviderByKey.getWalletAccounts(client).length > 0);
88
89
 
89
90
  /**
90
91
  * Returns whether the given string is a valid ISO date string.
@@ -196,7 +197,7 @@ const parseFromStorage = (value)=>{
196
197
  const apiClient = getChainFromVerifiedCredentialChain.createApiClient({}, client);
197
198
  const doFetch = async ()=>apiClient.getEnvironmentSettings({
198
199
  environmentId: core.environmentId,
199
- sdkVersion: `WalletKit/${core.version}`
200
+ sdkVersion: `${getChainFromVerifiedCredentialChain.CLIENT_SDK_NAME}/${core.version}`
200
201
  }, {
201
202
  credentials: 'omit'
202
203
  });
@@ -292,7 +293,7 @@ const generateSessionKeys = async (client)=>{
292
293
  const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
293
294
  const core = getChainFromVerifiedCredentialChain.getCore(client);
294
295
  const walletProvidersMap = new Map();
295
- const walletAccounts = refreshUser.getWalletAccounts(client);
296
+ const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
296
297
  walletAccounts.forEach((walletAccount)=>{
297
298
  if (walletProvidersMap.has(walletAccount.walletProviderKey)) {
298
299
  return;
@@ -347,6 +348,12 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
347
348
  } catch (error) {
348
349
  core.logger.error('Failed to revoke session', error);
349
350
  }
351
+ /**
352
+ * This deletes the auth cookie if it exists.
353
+ * If the cookie doesn't exist, this sets a new cookie that expires immediately.
354
+ */ if (getChainFromVerifiedCredentialChain.isCookieEnabled(client)) {
355
+ getWalletProviderByKey.setCookie(`${getWalletProviderByKey.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
356
+ }
350
357
  core.state.set({
351
358
  legacyToken: null,
352
359
  sessionExpiresAt: null,
@@ -885,6 +892,9 @@ class InvalidStorageValue extends getChainFromVerifiedCredentialChain.BaseError
885
892
  get projectSettings () {
886
893
  return core.state.get().projectSettings;
887
894
  },
895
+ get sessionExpiresAt () {
896
+ return core.state.get().sessionExpiresAt;
897
+ },
888
898
  get token () {
889
899
  return core.state.get().token;
890
900
  },
@@ -1099,7 +1109,7 @@ class WalletProviderMethodUnavailableError extends getChainFromVerifiedCredentia
1099
1109
  sessionPublicKey
1100
1110
  }
1101
1111
  });
1102
- refreshUser.updateAuthFromVerifyResponse({
1112
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1103
1113
  response
1104
1114
  }, client);
1105
1115
  return response;
@@ -1184,7 +1194,7 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
1184
1194
  const response = await serverRegisterPasskey({
1185
1195
  registration
1186
1196
  }, client);
1187
- refreshUser.updateAuthFromVerifyResponse({
1197
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1188
1198
  response
1189
1199
  }, client);
1190
1200
  return response;
@@ -1237,7 +1247,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client)=>
1237
1247
  const response = await serverSigninPasskey({
1238
1248
  authentication
1239
1249
  }, client);
1240
- refreshUser.updateAuthFromVerifyResponse({
1250
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1241
1251
  response
1242
1252
  }, client);
1243
1253
  return response;
@@ -1293,7 +1303,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client)=>
1293
1303
  },
1294
1304
  providerType: provider
1295
1305
  });
1296
- refreshUser.updateAuthFromVerifyResponse({
1306
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1297
1307
  response
1298
1308
  }, client);
1299
1309
  return response.user;
@@ -1488,7 +1498,7 @@ const providersRequiringPkce = [
1488
1498
  environmentId: core.environmentId,
1489
1499
  userFields
1490
1500
  });
1491
- refreshUser.updateAuthFromVerifyResponse({
1501
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1492
1502
  response
1493
1503
  }, client);
1494
1504
  if (response.emailVerification) {
@@ -1544,7 +1554,7 @@ const providersRequiringPkce = [
1544
1554
  createMfaToken: createMfaTokenOptions
1545
1555
  }
1546
1556
  });
1547
- refreshUser.updateAuthFromVerifyResponse({
1557
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1548
1558
  response
1549
1559
  }, client);
1550
1560
  getWalletProviderByKey.emitEvent({
@@ -1625,7 +1635,7 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1625
1635
  authentication,
1626
1636
  createMfaToken
1627
1637
  }, client);
1628
- refreshUser.updateAuthFromVerifyResponse({
1638
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1629
1639
  response
1630
1640
  }, client);
1631
1641
  getWalletProviderByKey.emitEvent({
@@ -1669,7 +1679,7 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1669
1679
  id: deviceId
1670
1680
  }
1671
1681
  });
1672
- refreshUser.updateAuthFromVerifyResponse({
1682
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
1673
1683
  response
1674
1684
  }, client);
1675
1685
  getWalletProviderByKey.emitEvent({
@@ -2859,7 +2869,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
2859
2869
  otpVerification,
2860
2870
  verificationToken
2861
2871
  }, client);
2862
- refreshUser.updateAuthFromVerifyResponse({
2872
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
2863
2873
  response
2864
2874
  }, client);
2865
2875
  return response.user;
@@ -2977,7 +2987,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
2977
2987
  }, client);
2978
2988
  assertWalletProviderMethodDefined(walletProvider, 'connect');
2979
2989
  const { addresses: [selectedAddress] } = await walletProvider.connect();
2980
- const currentAddresses = refreshUser.getWalletAccounts(client).map(({ address })=>address);
2990
+ const currentAddresses = getWalletProviderByKey.getWalletAccounts(client).map(({ address })=>address);
2981
2991
  /**
2982
2992
  * This error is thrown in case the wallet has no addresses connected
2983
2993
  * to the dapp. Then the error is thrown so the consumer can instruct the
@@ -2988,7 +2998,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
2988
2998
  const walletAccount = {
2989
2999
  address: selectedAddress,
2990
3000
  chain: walletProvider.chain,
2991
- id: refreshUser.createWalletAccountId(walletProvider.chain, selectedAddress),
3001
+ id: getWalletProviderByKey.createWalletAccountId(walletProvider.chain, selectedAddress),
2992
3002
  lastSelectedAt: null,
2993
3003
  verifiedCredentialId: null,
2994
3004
  walletProviderKey: walletProvider.key
@@ -3000,7 +3010,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
3000
3010
  setUnverifiedWalletAccount({
3001
3011
  unverifiedWalletAccountToUpdate: walletAccount
3002
3012
  }, client);
3003
- refreshUser.emitWalletAccountsChangedEvent(client);
3013
+ getWalletProviderByKey.emitWalletAccountsChangedEvent(client);
3004
3014
  /*
3005
3015
  * send information to backend to kick off background jobs
3006
3016
  * this is an async work, but does not need to be awaited
@@ -3109,7 +3119,7 @@ const getSignInMessage = async ({ walletAccount }, client)=>{
3109
3119
  });
3110
3120
  };
3111
3121
 
3112
- const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, chain) === refreshUser.normalizeAddress(right, chain);
3122
+ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddress(left, chain) === getWalletProviderByKey.normalizeAddress(right, chain);
3113
3123
 
3114
3124
  /**
3115
3125
  * Verifies ownership of a wallet account and adds it to the user's profile.
@@ -3156,7 +3166,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3156
3166
  /**
3157
3167
  * Adds the user with the new wallet verified credential
3158
3168
  * This will add the new verified wallet account to the client`s state
3159
- */ refreshUser.updateAuthFromVerifyResponse({
3169
+ */ getWalletProviderByKey.updateAuthFromVerifyResponse({
3160
3170
  response
3161
3171
  }, client);
3162
3172
  } catch (error) {
@@ -3167,7 +3177,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3167
3177
  }
3168
3178
  throw error;
3169
3179
  }
3170
- const verifiedWalletAccount = refreshUser.getWalletAccounts(client).find(({ address })=>isSameAddress(address, walletAccount.address, walletAccount.chain));
3180
+ const verifiedWalletAccount = getWalletProviderByKey.getWalletAccounts(client).find(({ address })=>isSameAddress(address, walletAccount.address, walletAccount.chain));
3171
3181
  getChainFromVerifiedCredentialChain.assertDefined(verifiedWalletAccount, 'Verified wallet account not found');
3172
3182
  return verifiedWalletAccount;
3173
3183
  };
@@ -3368,7 +3378,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3368
3378
  * This information is stored in both unverified and verified wallet accounts.
3369
3379
  * This function consolidates this information to determine which wallet was most recently selected.
3370
3380
  */ const getPrimaryWalletAccount = (client = getChainFromVerifiedCredentialChain.getDefaultClient())=>{
3371
- const walletAccounts = refreshUser.getWalletAccounts(client);
3381
+ const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
3372
3382
  const sortedLastSelectedWalletAccounts = walletAccounts.filter((walletAccount)=>Boolean(walletAccount.lastSelectedAt)).sort((a, b)=>b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
3373
3383
  if (sortedLastSelectedWalletAccounts.length === 0) {
3374
3384
  return null;
@@ -3393,7 +3403,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3393
3403
  walletId: walletAccount.verifiedCredentialId
3394
3404
  }
3395
3405
  });
3396
- refreshUser.updateAuthFromVerifyResponse({
3406
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
3397
3407
  response
3398
3408
  }, client);
3399
3409
  } else {
@@ -3430,7 +3440,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3430
3440
  walletId: walletAccount.verifiedCredentialId
3431
3441
  }
3432
3442
  });
3433
- refreshUser.updateAuthFromVerifyResponse({
3443
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
3434
3444
  response
3435
3445
  }, client);
3436
3446
  };
@@ -3470,7 +3480,7 @@ const isSameAddress = (left, right, chain)=>refreshUser.normalizeAddress(left, c
3470
3480
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3471
3481
  * @returns The matching wallet account, or undefined if not found.
3472
3482
  */ const getWalletAccountFromAddress = ({ address, chain }, client = getChainFromVerifiedCredentialChain.getDefaultClient())=>{
3473
- const walletAccounts = refreshUser.getWalletAccounts(client);
3483
+ const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
3474
3484
  return walletAccounts.find((walletAccount)=>walletAccount.address === address && walletAccount.chain === chain);
3475
3485
  };
3476
3486
 
@@ -3526,16 +3536,16 @@ exports.getDefaultClient = getChainFromVerifiedCredentialChain.getDefaultClient;
3526
3536
  exports.NoNetworkProvidersError = getNetworkProviderFromNetworkId.NoNetworkProvidersError;
3527
3537
  exports.getNetworksData = getNetworkProviderFromNetworkId.getNetworksData;
3528
3538
  exports.hasExtension = getNetworkProviderFromNetworkId.hasExtension;
3539
+ exports.getWalletAccounts = getWalletProviderByKey.getWalletAccounts;
3529
3540
  exports.offEvent = getWalletProviderByKey.offEvent;
3530
3541
  exports.onEvent = getWalletProviderByKey.onEvent;
3531
3542
  exports.onceEvent = getWalletProviderByKey.onceEvent;
3532
- exports.NotWaasWalletAccountError = refreshUser.NotWaasWalletAccountError;
3533
- exports.getWalletAccounts = refreshUser.getWalletAccounts;
3534
- exports.refreshUser = refreshUser.refreshUser;
3535
3543
  exports.consumeMfaToken = isMfaRequiredForAction.consumeMfaToken;
3536
3544
  exports.getMfaMethods = isMfaRequiredForAction.getMfaMethods;
3537
3545
  exports.isMfaRequiredForAction = isMfaRequiredForAction.isMfaRequiredForAction;
3538
3546
  exports.InvalidParamError = InvalidParamError.InvalidParamError;
3547
+ exports.NotWaasWalletAccountError = refreshUser.NotWaasWalletAccountError;
3548
+ exports.refreshUser = refreshUser.refreshUser;
3539
3549
  exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
3540
3550
  exports.InvalidRedirectStorageStateError = InvalidRedirectStorageStateError;
3541
3551
  exports.MissingRedirectStorageStateError = MissingRedirectStorageStateError;
package/index.esm.js CHANGED
@@ -1,18 +1,17 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
- import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClient, b as getBuffer, d as dependencies, v as version, s as setDefaultClient, _ as _extends, e as assertDefined, r as randomString, C as CHAINS_INFO_MAP, n as name } from './getChainFromVerifiedCredentialChain.esm.js';
3
- export { I as InvalidExternalAuthError, M as MfaInvalidOtpError, f as MfaRateLimitedError, S as SandboxMaximumThresholdReachedError } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClient, C as CLIENT_SDK_NAME, b as getBuffer, i as isCookieEnabled, d as dependencies, v as version, s as setDefaultClient, _ as _extends, e as assertDefined, r as randomString, f as CHAINS_INFO_MAP, n as name } from './getChainFromVerifiedCredentialChain.esm.js';
3
+ export { I as InvalidExternalAuthError, M as MfaInvalidOtpError, h as MfaRateLimitedError, S as SandboxMaximumThresholdReachedError } from './getChainFromVerifiedCredentialChain.esm.js';
4
4
  import { I as InvalidStorageSet, c as createStorageKeySchema, s as subscribeWithSelector, i as isEqualShallow, C as CannotTrackError, a as createLogger, f as formatSignInMessage, g as getNetworksData, b as getNetworkProviderFromNetworkId } from './getNetworkProviderFromNetworkId.esm.js';
5
5
  export { N as NoNetworkProvidersError, h as hasExtension } from './getNetworkProviderFromNetworkId.esm.js';
6
- import { g as getWalletProviderFromWalletAccount, e as emitEvent, a as getWalletProviderByKey, b as getWalletProviders } from './getWalletProviderByKey.esm.js';
7
- export { o as offEvent, d as onEvent, c as onceEvent } from './getWalletProviderByKey.esm.js';
8
- import { g as getWalletAccounts, u as updateAuthFromVerifyResponse, c as createWalletAccountId, e as emitWalletAccountsChangedEvent, n as normalizeAddress } from './refreshUser.esm.js';
9
- export { N as NotWaasWalletAccountError, r as refreshUser } from './refreshUser.esm.js';
6
+ import { g as getWalletAccounts, a as getWalletProviderFromWalletAccount, s as setCookie, e as emitEvent, D as DYNAMIC_AUTH_COOKIE_NAME, u as updateAuthFromVerifyResponse, b as getWalletProviderByKey, c as createWalletAccountId, d as emitWalletAccountsChangedEvent, n as normalizeAddress, f as getWalletProviders } from './getWalletProviderByKey.esm.js';
7
+ export { o as offEvent, i as onEvent, h as onceEvent } from './getWalletProviderByKey.esm.js';
10
8
  import * as z from 'zod/mini';
11
9
  import { b as bufferToHex } from './isMfaRequiredForAction.esm.js';
12
10
  export { c as consumeMfaToken, g as getMfaMethods, i as isMfaRequiredForAction } from './isMfaRequiredForAction.esm.js';
13
11
  import EventEmitter$1, { EventEmitter } from 'eventemitter3';
14
12
  import { startRegistration, browserSupportsWebAuthn, startAuthentication } from '@simplewebauthn/browser';
15
13
  export { I as InvalidParamError } from './InvalidParamError.esm.js';
14
+ export { N as NotWaasWalletAccountError, r as refreshUser } from './refreshUser.esm.js';
16
15
  import { ProviderEnum, MfaBackupCodeAcknowledgement, AuthModeEnum } from '@dynamic-labs/sdk-api-core';
17
16
  import 'buffer';
18
17
 
@@ -25,6 +24,7 @@ import 'buffer';
25
24
  initStatus: 'initStatusChanged',
26
25
  mfaToken: 'mfaTokenChanged',
27
26
  projectSettings: 'projectSettingsChanged',
27
+ sessionExpiresAt: 'sessionExpiresAtChanged',
28
28
  token: 'tokenChanged',
29
29
  user: 'userChanged'
30
30
  };
@@ -180,7 +180,7 @@ const parseFromStorage = (value)=>{
180
180
  const apiClient = createApiClient({}, client);
181
181
  const doFetch = async ()=>apiClient.getEnvironmentSettings({
182
182
  environmentId: core.environmentId,
183
- sdkVersion: `WalletKit/${core.version}`
183
+ sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`
184
184
  }, {
185
185
  credentials: 'omit'
186
186
  });
@@ -331,6 +331,12 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
331
331
  } catch (error) {
332
332
  core.logger.error('Failed to revoke session', error);
333
333
  }
334
+ /**
335
+ * This deletes the auth cookie if it exists.
336
+ * If the cookie doesn't exist, this sets a new cookie that expires immediately.
337
+ */ if (isCookieEnabled(client)) {
338
+ setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
339
+ }
334
340
  core.state.set({
335
341
  legacyToken: null,
336
342
  sessionExpiresAt: null,
@@ -869,6 +875,9 @@ class InvalidStorageValue extends BaseError {
869
875
  get projectSettings () {
870
876
  return core.state.get().projectSettings;
871
877
  },
878
+ get sessionExpiresAt () {
879
+ return core.state.get().sessionExpiresAt;
880
+ },
872
881
  get token () {
873
882
  return core.state.get().token;
874
883
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs-sdk/client",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-alpha.5",
4
4
  "type": "module",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.3",
32
+ "@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.5",
33
33
  "@dynamic-labs/sdk-api-core": "0.0.762",
34
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.144",
34
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.155",
35
35
  "@simplewebauthn/browser": "^13.1.0",
36
36
  "buffer": "6.0.3",
37
37
  "eventemitter3": "^5.0.1",
@@ -2,86 +2,6 @@
2
2
 
3
3
  var getChainFromVerifiedCredentialChain = require('./getChainFromVerifiedCredentialChain.cjs.js');
4
4
  var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
5
- var sdkApiCore = require('@dynamic-labs/sdk-api-core');
6
-
7
- const normalizeAddress = (address, chain)=>{
8
- let normalizedAddress = address;
9
- if (normalizedAddress == null ? void 0 : normalizedAddress.startsWith('0x')) {
10
- normalizedAddress = normalizedAddress.slice(2);
11
- }
12
- /**
13
- * These are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
14
- * see also: https://github.com/ChainAgnostic/namespaces
15
- * note: no standard namespace currently exists for flow
16
- */ const chainsThatRequireLowercaseAddress = [
17
- 'EVM',
18
- 'FLOW'
19
- ];
20
- normalizedAddress = chainsThatRequireLowercaseAddress.includes(chain) ? normalizedAddress == null ? void 0 : normalizedAddress.toLowerCase() : normalizedAddress;
21
- return normalizedAddress;
22
- };
23
-
24
- const createWalletAccountId = (chain, address)=>`${chain}-${normalizeAddress(address, chain)}`;
25
-
26
- const convertUnverifiedWalletAccountToWalletAccount = (unverifiedWalletAccount)=>({
27
- address: unverifiedWalletAccount.address,
28
- chain: unverifiedWalletAccount.chain,
29
- id: createWalletAccountId(unverifiedWalletAccount.chain, unverifiedWalletAccount.address),
30
- lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
31
- verifiedCredentialId: null,
32
- walletProviderKey: unverifiedWalletAccount.walletProviderKey
33
- });
34
-
35
- const convertVerifiedCredentialToWalletAccount = (verified)=>{
36
- getChainFromVerifiedCredentialChain.assertDefined(verified.address, 'Missing address in verified credential');
37
- getChainFromVerifiedCredentialChain.assertDefined(verified.chain, 'Missing chain in verified credential');
38
- getChainFromVerifiedCredentialChain.assertDefined(verified.walletName, 'Missing wallet name in verified credential');
39
- const chain = getChainFromVerifiedCredentialChain.getChainFromVerifiedCredentialChain(verified.chain);
40
- const hasChainInWalletName = verified.walletName.endsWith(chain.toLowerCase());
41
- // we need to make sure the walletProviderKey follows the correct format ([walletName][chain])
42
- // some walletNames will follow the legacy format (e.g. "phantom" instead of "phantomsol", "metamask" instead of "metamaskevm")
43
- // so we need to make sure we parse it correctly
44
- const walletProviderKey = hasChainInWalletName ? verified.walletName : getWalletProviderByKey.formatWalletProviderKey(verified.walletName, chain);
45
- var _verified_lastSelectedAt;
46
- return {
47
- address: verified.address,
48
- chain,
49
- id: createWalletAccountId(chain, verified.address),
50
- lastSelectedAt: (_verified_lastSelectedAt = verified.lastSelectedAt) != null ? _verified_lastSelectedAt : null,
51
- verifiedCredentialId: verified.id,
52
- walletProviderKey
53
- };
54
- };
55
-
56
- const getWalletAccountsFromState = (state)=>{
57
- const { unverifiedWalletAccounts, user } = state;
58
- const walletAccountsMap = new Map();
59
- /**
60
- * Handle the unverified wallet accounts before the user verified credentials
61
- * so the later verified wallet accounts can override the unverified wallet accounts
62
- */ unverifiedWalletAccounts.forEach((unverifiedWalletAccount)=>{
63
- const walletAccount = convertUnverifiedWalletAccountToWalletAccount(unverifiedWalletAccount);
64
- walletAccountsMap.set(walletAccount.id, walletAccount);
65
- });
66
- var _user_verifiedCredentials;
67
- /**
68
- * Handle user verified credentials
69
- */ const verifiedCredentials = (_user_verifiedCredentials = user == null ? void 0 : user.verifiedCredentials) != null ? _user_verifiedCredentials : [];
70
- verifiedCredentials.filter((verified)=>verified.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain).map((verifiedWalletAccount)=>convertVerifiedCredentialToWalletAccount(verifiedWalletAccount)).forEach((verifiedWalletAccount)=>walletAccountsMap.set(verifiedWalletAccount.id, verifiedWalletAccount));
71
- return Array.from(walletAccountsMap.values());
72
- };
73
-
74
- /**
75
- * Retrieves all wallet accounts associated with the current session.
76
- *
77
- * This function returns both verified and unverified wallet accounts,
78
- * combining data from user credentials and local unverified accounts.
79
- * You can differentiate between verified and unverified wallet accounts by
80
- * checking the `verifiedCredentialId` property.
81
- *
82
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
83
- * @returns An array of wallet accounts associated with the session.
84
- */ const getWalletAccounts = (client = getChainFromVerifiedCredentialChain.getDefaultClient())=>getWalletAccountsFromState(getChainFromVerifiedCredentialChain.getCore(client).state.get());
85
5
 
86
6
  class NotWaasWalletAccountError extends getChainFromVerifiedCredentialChain.BaseError {
87
7
  constructor({ walletAddress }){
@@ -95,45 +15,6 @@ class NotWaasWalletAccountError extends getChainFromVerifiedCredentialChain.Base
95
15
  }
96
16
  }
97
17
 
98
- /**
99
- * Emits the `walletAccountsChanged` event.
100
- */ const emitWalletAccountsChangedEvent = (client)=>{
101
- const walletAccounts = getWalletAccounts(client);
102
- getWalletProviderByKey.emitEvent({
103
- args: {
104
- walletAccounts
105
- },
106
- event: 'walletAccountsChanged'
107
- }, client);
108
- };
109
-
110
- const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client)=>{
111
- const core = getChainFromVerifiedCredentialChain.getCore(client);
112
- const walletAccountsHashBefore = getWalletAccountsHash(previousState);
113
- const walletAccountsHashAfter = getWalletAccountsHash(core.state.get());
114
- if (walletAccountsHashBefore !== walletAccountsHashAfter) {
115
- emitWalletAccountsChangedEvent(client);
116
- }
117
- };
118
- const getWalletAccountsHash = (state)=>getWalletAccountsFromState(state).map(({ id })=>id).sort().join('-');
119
-
120
- const updateAuthFromVerifyResponse = ({ response }, client)=>{
121
- const core = getChainFromVerifiedCredentialChain.getCore(client);
122
- const previousState = getChainFromVerifiedCredentialChain._extends({}, core.state.get());
123
- const { user, minifiedJwt, jwt, expiresAt, mfaToken } = response;
124
- core.state.set({
125
- legacyToken: jwt != null ? jwt : null,
126
- mfaToken: mfaToken != null ? mfaToken : null,
127
- // Expires at is in seconds, so we need to convert it to milliseconds
128
- sessionExpiresAt: new Date(expiresAt * 1000),
129
- token: minifiedJwt != null ? minifiedJwt : null,
130
- user
131
- });
132
- checkAndRaiseWalletAccountsChangedEvent({
133
- previousState
134
- }, client);
135
- };
136
-
137
18
  /**
138
19
  * Refreshes the current user's data from the server.
139
20
  *
@@ -148,15 +29,10 @@ const updateAuthFromVerifyResponse = ({ response }, client)=>{
148
29
  const response = await apiClient.refreshAuth({
149
30
  environmentId: core.environmentId
150
31
  });
151
- updateAuthFromVerifyResponse({
32
+ getWalletProviderByKey.updateAuthFromVerifyResponse({
152
33
  response
153
34
  }, client);
154
35
  };
155
36
 
156
37
  exports.NotWaasWalletAccountError = NotWaasWalletAccountError;
157
- exports.createWalletAccountId = createWalletAccountId;
158
- exports.emitWalletAccountsChangedEvent = emitWalletAccountsChangedEvent;
159
- exports.getWalletAccounts = getWalletAccounts;
160
- exports.normalizeAddress = normalizeAddress;
161
38
  exports.refreshUser = refreshUser;
162
- exports.updateAuthFromVerifyResponse = updateAuthFromVerifyResponse;
@@ -1,85 +1,5 @@
1
- import { e as assertDefined, j as getChainFromVerifiedCredentialChain, g as getDefaultClient, a as getCore, B as BaseError, _ as _extends, c as createApiClient } from './getChainFromVerifiedCredentialChain.esm.js';
2
- import { h as formatWalletProviderKey, e as emitEvent } from './getWalletProviderByKey.esm.js';
3
- import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
4
-
5
- const normalizeAddress = (address, chain)=>{
6
- let normalizedAddress = address;
7
- if (normalizedAddress == null ? void 0 : normalizedAddress.startsWith('0x')) {
8
- normalizedAddress = normalizedAddress.slice(2);
9
- }
10
- /**
11
- * These are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
12
- * see also: https://github.com/ChainAgnostic/namespaces
13
- * note: no standard namespace currently exists for flow
14
- */ const chainsThatRequireLowercaseAddress = [
15
- 'EVM',
16
- 'FLOW'
17
- ];
18
- normalizedAddress = chainsThatRequireLowercaseAddress.includes(chain) ? normalizedAddress == null ? void 0 : normalizedAddress.toLowerCase() : normalizedAddress;
19
- return normalizedAddress;
20
- };
21
-
22
- const createWalletAccountId = (chain, address)=>`${chain}-${normalizeAddress(address, chain)}`;
23
-
24
- const convertUnverifiedWalletAccountToWalletAccount = (unverifiedWalletAccount)=>({
25
- address: unverifiedWalletAccount.address,
26
- chain: unverifiedWalletAccount.chain,
27
- id: createWalletAccountId(unverifiedWalletAccount.chain, unverifiedWalletAccount.address),
28
- lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
29
- verifiedCredentialId: null,
30
- walletProviderKey: unverifiedWalletAccount.walletProviderKey
31
- });
32
-
33
- const convertVerifiedCredentialToWalletAccount = (verified)=>{
34
- assertDefined(verified.address, 'Missing address in verified credential');
35
- assertDefined(verified.chain, 'Missing chain in verified credential');
36
- assertDefined(verified.walletName, 'Missing wallet name in verified credential');
37
- const chain = getChainFromVerifiedCredentialChain(verified.chain);
38
- const hasChainInWalletName = verified.walletName.endsWith(chain.toLowerCase());
39
- // we need to make sure the walletProviderKey follows the correct format ([walletName][chain])
40
- // some walletNames will follow the legacy format (e.g. "phantom" instead of "phantomsol", "metamask" instead of "metamaskevm")
41
- // so we need to make sure we parse it correctly
42
- const walletProviderKey = hasChainInWalletName ? verified.walletName : formatWalletProviderKey(verified.walletName, chain);
43
- var _verified_lastSelectedAt;
44
- return {
45
- address: verified.address,
46
- chain,
47
- id: createWalletAccountId(chain, verified.address),
48
- lastSelectedAt: (_verified_lastSelectedAt = verified.lastSelectedAt) != null ? _verified_lastSelectedAt : null,
49
- verifiedCredentialId: verified.id,
50
- walletProviderKey
51
- };
52
- };
53
-
54
- const getWalletAccountsFromState = (state)=>{
55
- const { unverifiedWalletAccounts, user } = state;
56
- const walletAccountsMap = new Map();
57
- /**
58
- * Handle the unverified wallet accounts before the user verified credentials
59
- * so the later verified wallet accounts can override the unverified wallet accounts
60
- */ unverifiedWalletAccounts.forEach((unverifiedWalletAccount)=>{
61
- const walletAccount = convertUnverifiedWalletAccountToWalletAccount(unverifiedWalletAccount);
62
- walletAccountsMap.set(walletAccount.id, walletAccount);
63
- });
64
- var _user_verifiedCredentials;
65
- /**
66
- * Handle user verified credentials
67
- */ const verifiedCredentials = (_user_verifiedCredentials = user == null ? void 0 : user.verifiedCredentials) != null ? _user_verifiedCredentials : [];
68
- verifiedCredentials.filter((verified)=>verified.format === JwtVerifiedCredentialFormatEnum.Blockchain).map((verifiedWalletAccount)=>convertVerifiedCredentialToWalletAccount(verifiedWalletAccount)).forEach((verifiedWalletAccount)=>walletAccountsMap.set(verifiedWalletAccount.id, verifiedWalletAccount));
69
- return Array.from(walletAccountsMap.values());
70
- };
71
-
72
- /**
73
- * Retrieves all wallet accounts associated with the current session.
74
- *
75
- * This function returns both verified and unverified wallet accounts,
76
- * combining data from user credentials and local unverified accounts.
77
- * You can differentiate between verified and unverified wallet accounts by
78
- * checking the `verifiedCredentialId` property.
79
- *
80
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
81
- * @returns An array of wallet accounts associated with the session.
82
- */ const getWalletAccounts = (client = getDefaultClient())=>getWalletAccountsFromState(getCore(client).state.get());
1
+ import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClient } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { u as updateAuthFromVerifyResponse } from './getWalletProviderByKey.esm.js';
83
3
 
84
4
  class NotWaasWalletAccountError extends BaseError {
85
5
  constructor({ walletAddress }){
@@ -93,45 +13,6 @@ class NotWaasWalletAccountError extends BaseError {
93
13
  }
94
14
  }
95
15
 
96
- /**
97
- * Emits the `walletAccountsChanged` event.
98
- */ const emitWalletAccountsChangedEvent = (client)=>{
99
- const walletAccounts = getWalletAccounts(client);
100
- emitEvent({
101
- args: {
102
- walletAccounts
103
- },
104
- event: 'walletAccountsChanged'
105
- }, client);
106
- };
107
-
108
- const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client)=>{
109
- const core = getCore(client);
110
- const walletAccountsHashBefore = getWalletAccountsHash(previousState);
111
- const walletAccountsHashAfter = getWalletAccountsHash(core.state.get());
112
- if (walletAccountsHashBefore !== walletAccountsHashAfter) {
113
- emitWalletAccountsChangedEvent(client);
114
- }
115
- };
116
- const getWalletAccountsHash = (state)=>getWalletAccountsFromState(state).map(({ id })=>id).sort().join('-');
117
-
118
- const updateAuthFromVerifyResponse = ({ response }, client)=>{
119
- const core = getCore(client);
120
- const previousState = _extends({}, core.state.get());
121
- const { user, minifiedJwt, jwt, expiresAt, mfaToken } = response;
122
- core.state.set({
123
- legacyToken: jwt != null ? jwt : null,
124
- mfaToken: mfaToken != null ? mfaToken : null,
125
- // Expires at is in seconds, so we need to convert it to milliseconds
126
- sessionExpiresAt: new Date(expiresAt * 1000),
127
- token: minifiedJwt != null ? minifiedJwt : null,
128
- user
129
- });
130
- checkAndRaiseWalletAccountsChangedEvent({
131
- previousState
132
- }, client);
133
- };
134
-
135
16
  /**
136
17
  * Refreshes the current user's data from the server.
137
18
  *
@@ -151,4 +32,4 @@ const updateAuthFromVerifyResponse = ({ response }, client)=>{
151
32
  }, client);
152
33
  };
153
34
 
154
- export { NotWaasWalletAccountError as N, createWalletAccountId as c, emitWalletAccountsChangedEvent as e, getWalletAccounts as g, normalizeAddress as n, refreshUser as r, updateAuthFromVerifyResponse as u };
35
+ export { NotWaasWalletAccountError as N, refreshUser as r };
@@ -1 +1 @@
1
- {"version":3,"file":"createDynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/createDynamicClient/createDynamicClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,WACtB,mBAAmB,KAC1B,aAkCF,CAAC"}
1
+ {"version":3,"file":"createDynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/createDynamicClient/createDynamicClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,WACtB,mBAAmB,KAC1B,aAqCF,CAAC"}
@@ -16,6 +16,10 @@ export type DynamicClient = {
16
16
  * The settings of your Dynamic project as configured in dashboard.
17
17
  */
18
18
  readonly projectSettings: ProjectSettings | null;
19
+ /**
20
+ * The session expiration date.
21
+ */
22
+ readonly sessionExpiresAt: DynamicCoreState['sessionExpiresAt'];
19
23
  /**
20
24
  * The JWT of the current user.
21
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/types/DynamicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAEpD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACzC,CAAC"}
1
+ {"version":3,"file":"DynamicClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/client/types/DynamicClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAEpD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAEhE;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACzC,CAAC"}
@@ -11,6 +11,7 @@ export { MultipleClientsFoundError } from '../errors/MultipleClientsFoundError';
11
11
  export { NoWalletProviderFoundError } from '../errors/NoWalletProviderFoundError';
12
12
  export { ValueMustBeDefinedError } from '../errors/ValueMustBeDefinedError';
13
13
  export { createApiClient, DYNAMIC_SDK_API_VERSION } from '../modules/apiClient';
14
+ export { updateAuthFromVerifyResponse } from '../modules/auth/updateAuthFromVerifyResponse';
14
15
  export { emitEvent } from '../modules/clientEvents';
15
16
  export { hasExtension } from '../modules/extension/hasExtension';
16
17
  export { registerExtension } from '../modules/extension/registerExtension';
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/core.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/core.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export declare const DYNAMIC_AUTH_COOKIE_NAME = "DYNAMIC_JWT_TOKEN";
2
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/auth/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/logout/logout.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,sEA6BlB,CAAC"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/logout/logout.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,sEAuClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateAuthFromVerifyResponse.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,KAAK,kCAAkC,GAAG;IACxC,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,iBACzB,kCAAkC,UACxC,aAAa,SAkBtB,CAAC"}
1
+ {"version":3,"file":"updateAuthFromVerifyResponse.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,KAAK,kCAAkC,GAAG;IACxC,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,iBACzB,kCAAkC,UACxC,aAAa,SAiCtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,6HA0ChC,CAAC"}
1
+ {"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,6HA0ChC,CAAC"}
@@ -9,6 +9,7 @@ export declare const stateChangeEvents: {
9
9
  initStatus: "initStatusChanged";
10
10
  mfaToken: "mfaTokenChanged";
11
11
  projectSettings: "projectSettingsChanged";
12
+ sessionExpiresAt: "sessionExpiresAtChanged";
12
13
  token: "tokenChanged";
13
14
  user: "userChanged";
14
15
  };
@@ -23,6 +24,9 @@ declare global {
23
24
  projectSettingsChanged: (args: {
24
25
  projectSettings: DynamicClient['projectSettings'];
25
26
  }) => void;
27
+ sessionExpiresAtChanged: (args: {
28
+ sessionExpiresAt: DynamicClient['sessionExpiresAt'];
29
+ }) => void;
26
30
  tokenChanged: (args: {
27
31
  token: DynamicClient['token'];
28
32
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/state/raiseStateEvents/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAQ7B,CAAC;AAGF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa;QACrB,iBAAiB,EAAE,CAAC,IAAI,EAAE;YACxB,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;SACzC,KAAK,IAAI,CAAC;QAEX,eAAe,EAAE,CAAC,IAAI,EAAE;YAAE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;QAEzE,sBAAsB,EAAE,CAAC,IAAI,EAAE;YAC7B,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;SACnD,KAAK,IAAI,CAAC;QAEX,YAAY,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;QAEhE,WAAW,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;KAC9D;CACF;AAED,MAAM,MAAM,wBAAwB,GAClC,aAAa,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/state/raiseStateEvents/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;CAS7B,CAAC;AAGF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa;QACrB,iBAAiB,EAAE,CAAC,IAAI,EAAE;YACxB,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;SACzC,KAAK,IAAI,CAAC;QAEX,eAAe,EAAE,CAAC,IAAI,EAAE;YAAE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;QAEzE,sBAAsB,EAAE,CAAC,IAAI,EAAE;YAC7B,eAAe,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;SACnD,KAAK,IAAI,CAAC;QAEX,uBAAuB,EAAE,CAAC,IAAI,EAAE;YAC9B,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;SACrD,KAAK,IAAI,CAAC;QAEX,YAAY,EAAE,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;QAEhE,WAAW,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;SAAE,KAAK,IAAI,CAAC;KAC9D;CACF;AAED,MAAM,MAAM,wBAAwB,GAClC,aAAa,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createWaasClient.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/createWaasClient/createWaasClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAOzE,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,kBACZ,sBAAsB,UAC7B,aAAa,wBAmBtB,CAAC"}
1
+ {"version":3,"file":"createWaasClient.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/createWaasClient/createWaasClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAQzE,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,kBACZ,sBAAsB,UAC7B,aAAa,wBAiBtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { setCookie } from './setCookie';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/utils/setCookie/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Sefelly sets the cookie in the browser.
3
+ */
4
+ export declare const setCookie: (cookie: string) => void;
5
+ //# sourceMappingURL=setCookie.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCookie.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/utils/setCookie/setCookie.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS,WAAY,MAAM,SAGvC,CAAC"}
package/waas.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
- import { B as BaseError, g as getDefaultClient, j as getChainFromVerifiedCredentialChain, e as assertDefined, n as name, v as version } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { B as BaseError, g as getDefaultClient, k as getChainFromVerifiedCredentialChain, e as assertDefined, n as name, v as version } from './getChainFromVerifiedCredentialChain.esm.js';
3
3
  import { N as NotWaasWalletAccountError, r as refreshUser } from './refreshUser.esm.js';
4
- import { g as getWalletProviderFromWalletAccount, h as formatWalletProviderKey, a as getWalletProviderByKey, N as NoWalletProviderFoundError, b as getWalletProviders } from './getWalletProviderByKey.esm.js';
4
+ import { a as getWalletProviderFromWalletAccount, k as formatWalletProviderKey, b as getWalletProviderByKey, N as NoWalletProviderFoundError, f as getWalletProviders } from './getWalletProviderByKey.esm.js';
5
5
  import { D as DYNAMIC_WAAS_METADATA } from './constants.esm.js';
6
6
  import { WalletProviderEnum, EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
7
7
  import 'buffer';
package/waasCore.cjs.js CHANGED
@@ -19,7 +19,8 @@ const createWaasClient = ({ chainName }, client)=>{
19
19
  baseApiUrl: (core.apiBaseUrl || constants.DEFAULT_WAAS_BASE_API_URL).replace('/api/v0', ''),
20
20
  baseMPCRelayApiUrl: ((_client_projectSettings = client.projectSettings) == null ? void 0 : (_client_projectSettings_sdk_waas = _client_projectSettings.sdk.waas) == null ? void 0 : _client_projectSettings_sdk_waas.relayUrl) || constants.DEFAULT_WAAS_BASE_MPC_RELAY_API_URL,
21
21
  chainName,
22
- environmentId: core.environmentId
22
+ environmentId: core.environmentId,
23
+ sdkVersion: `${getChainFromVerifiedCredentialChain.CLIENT_SDK_NAME}/${core.version}`
23
24
  });
24
25
  };
25
26
 
package/waasCore.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
- import { a as getCore, i as isCookieEnabled, C as CHAINS_INFO_MAP, j as getChainFromVerifiedCredentialChain, n as name, v as version } from './getChainFromVerifiedCredentialChain.esm.js';
2
+ import { a as getCore, C as CLIENT_SDK_NAME, i as isCookieEnabled, f as CHAINS_INFO_MAP, k as getChainFromVerifiedCredentialChain, n as name, v as version } from './getChainFromVerifiedCredentialChain.esm.js';
3
3
  import { a as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, b as DEFAULT_WAAS_BASE_API_URL, D as DYNAMIC_WAAS_METADATA } from './constants.esm.js';
4
4
  import { DynamicWalletClient, ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';
5
5
  import { MFAAction, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
@@ -17,7 +17,8 @@ const createWaasClient = ({ chainName }, client)=>{
17
17
  baseApiUrl: (core.apiBaseUrl || DEFAULT_WAAS_BASE_API_URL).replace('/api/v0', ''),
18
18
  baseMPCRelayApiUrl: ((_client_projectSettings = client.projectSettings) == null ? void 0 : (_client_projectSettings_sdk_waas = _client_projectSettings.sdk.waas) == null ? void 0 : _client_projectSettings_sdk_waas.relayUrl) || DEFAULT_WAAS_BASE_MPC_RELAY_API_URL,
19
19
  chainName,
20
- environmentId: core.environmentId
20
+ environmentId: core.environmentId,
21
+ sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`
21
22
  });
22
23
  };
23
24