@dynamic-labs-sdk/client 1.33.1 → 1.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apiClient-BbjPoAwE.native.esm.js → apiClient-CpfEx6Uc.native.esm.js} +3 -3
- package/dist/{apiClient-BbjPoAwE.native.esm.js.map → apiClient-CpfEx6Uc.native.esm.js.map} +1 -1
- package/dist/core.cjs +5 -78
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +8 -79
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +6 -77
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +0 -2
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +13 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BXoTukxv.cjs → getNetworkProviderFromNetworkId-Cez8TM-n.cjs} +9 -2
- package/dist/getNetworkProviderFromNetworkId-Cez8TM-n.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-D_Hg6kP7.esm.js → getNetworkProviderFromNetworkId-Cf-CfYM4.esm.js} +9 -8
- package/dist/getNetworkProviderFromNetworkId-Cf-CfYM4.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-Cs3hLqBS.native.esm.js → getNetworkProviderFromNetworkId-CuTEQ9dg.native.esm.js} +5 -4
- package/dist/getNetworkProviderFromNetworkId-CuTEQ9dg.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-Bk-8is5J.native.esm.js → getSignedSessionId-Bt4obN3w.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-Bk-8is5J.native.esm.js.map → getSignedSessionId-Bt4obN3w.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-D_TknHwX.esm.js → getSignedSessionId-Cx7WP4ZJ.esm.js} +3 -3
- package/dist/{getSignedSessionId-D_TknHwX.esm.js.map → getSignedSessionId-Cx7WP4ZJ.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-2O_cJtIV.cjs → getSignedSessionId-DiVxv0qz.cjs} +3 -3
- package/dist/{getSignedSessionId-2O_cJtIV.cjs.map → getSignedSessionId-DiVxv0qz.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-BmsHgXbj.esm.js → getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-BmsHgXbj.esm.js.map → getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-upiwolAi.cjs → getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-upiwolAi.cjs.map → getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs.map} +1 -1
- package/dist/index.cjs +56 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +50 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +48 -61
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-D7b7mUT9.native.esm.js → isMfaRequiredForAction-CxYft5KR.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-D7b7mUT9.native.esm.js.map → isMfaRequiredForAction-CxYft5KR.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DF65MJNN.cjs → isMfaRequiredForAction-Czx-uPFY.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-DF65MJNN.cjs.map → isMfaRequiredForAction-Czx-uPFY.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-CHqeZeTS.esm.js → isMfaRequiredForAction-DS8fcwxO.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CHqeZeTS.esm.js.map → isMfaRequiredForAction-DS8fcwxO.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-CpHVw8ee.esm.js → isUserOnboardingComplete-COmYFW26.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-CpHVw8ee.esm.js.map → isUserOnboardingComplete-COmYFW26.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-CYpgo52t.native.esm.js → isUserOnboardingComplete-DYnRDLep.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-CYpgo52t.native.esm.js.map → isUserOnboardingComplete-DYnRDLep.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-BAL-3zu7.cjs → isUserOnboardingComplete-FbjleMQm.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BAL-3zu7.cjs.map → isUserOnboardingComplete-FbjleMQm.cjs.map} +1 -1
- package/dist/{logoutWithReason-CFjm8dbR.cjs → logoutWithReason-BKwWBsCT.cjs} +73 -55
- package/dist/logoutWithReason-BKwWBsCT.cjs.map +1 -0
- package/dist/{logoutWithReason-CX9hGTPw.esm.js → logoutWithReason-DO0kP7nf.esm.js} +62 -50
- package/dist/logoutWithReason-DO0kP7nf.esm.js.map +1 -0
- package/dist/{logoutWithReason-Bd1qUh7l.native.esm.js → logoutWithReason-DWkIKoLk.native.esm.js} +61 -49
- package/dist/logoutWithReason-DWkIKoLk.native.esm.js.map +1 -0
- package/dist/{migrateFromFireblocks-BLz9aHOY.native.esm.js → migrateFromFireblocks-BwYnNAAh.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-BLz9aHOY.native.esm.js.map → migrateFromFireblocks-BwYnNAAh.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-C8KXMXk-.esm.js → migrateFromFireblocks-C_cap--b.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-C8KXMXk-.esm.js.map → migrateFromFireblocks-C_cap--b.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-BiZmnKp9.cjs → migrateFromFireblocks-ycJIYcrm.cjs} +2 -2
- package/dist/{migrateFromFireblocks-BiZmnKp9.cjs.map → migrateFromFireblocks-ycJIYcrm.cjs.map} +1 -1
- package/dist/modules/initializeClient/consts.d.ts +1 -0
- package/dist/modules/initializeClient/consts.d.ts.map +1 -1
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +4 -5
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
- package/dist/modules/sessionKeys/canonicalizeJson/canonicalizeJson.d.ts +20 -0
- package/dist/modules/sessionKeys/canonicalizeJson/canonicalizeJson.d.ts.map +1 -0
- package/dist/modules/sessionKeys/canonicalizeJson/index.d.ts +2 -0
- package/dist/modules/sessionKeys/canonicalizeJson/index.d.ts.map +1 -0
- package/dist/modules/sessionKeys/signBusinessAccountIntent/signBusinessAccountIntent.d.ts +39 -6
- package/dist/modules/sessionKeys/signBusinessAccountIntent/signBusinessAccountIntent.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts +9 -3
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts +10 -3
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/approveBusinessAccountProposal/approveBusinessAccountProposal.d.ts +43 -0
- package/dist/modules/waas/businessAccounts/approveBusinessAccountProposal/approveBusinessAccountProposal.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/approveBusinessAccountProposal/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/approveBusinessAccountProposal/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +249 -0
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/defineBusinessAccountRole/defineBusinessAccountRole.d.ts +45 -0
- package/dist/modules/waas/businessAccounts/defineBusinessAccountRole/defineBusinessAccountRole.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/defineBusinessAccountRole/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/defineBusinessAccountRole/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/deleteBusinessAccountRole/deleteBusinessAccountRole.d.ts +41 -0
- package/dist/modules/waas/businessAccounts/deleteBusinessAccountRole/deleteBusinessAccountRole.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/deleteBusinessAccountRole/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/deleteBusinessAccountRole/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/executeBusinessAccountProposal/executeBusinessAccountProposal.d.ts +39 -0
- package/dist/modules/waas/businessAccounts/executeBusinessAccountProposal/executeBusinessAccountProposal.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/executeBusinessAccountProposal/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/executeBusinessAccountProposal/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountGovernance/getBusinessAccountGovernance.d.ts +30 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountGovernance/getBusinessAccountGovernance.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountGovernance/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountGovernance/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposals/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposals/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposals/listBusinessAccountProposals.d.ts +26 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposals/listBusinessAccountProposals.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposalsAwaitingMyApproval/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposalsAwaitingMyApproval/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposalsAwaitingMyApproval/listBusinessAccountProposalsAwaitingMyApproval.d.ts +21 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountProposalsAwaitingMyApproval/listBusinessAccountProposalsAwaitingMyApproval.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountRoles/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountRoles/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountRoles/listBusinessAccountRoles.d.ts +26 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccountRoles/listBusinessAccountRoles.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.d.ts +11 -2
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.d.ts +11 -2
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.d.ts +12 -4
- package/dist/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/resendFields.d.ts +39 -0
- package/dist/modules/waas/businessAccounts/resendFields.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/setBusinessAccountGovernance/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/setBusinessAccountGovernance/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/setBusinessAccountGovernance/setBusinessAccountGovernance.d.ts +49 -0
- package/dist/modules/waas/businessAccounts/setBusinessAccountGovernance/setBusinessAccountGovernance.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts +11 -2
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.d.ts +11 -2
- package/dist/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/vetoBusinessAccountProposal/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/vetoBusinessAccountProposal/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/vetoBusinessAccountProposal/vetoBusinessAccountProposal.d.ts +29 -0
- package/dist/modules/waas/businessAccounts/vetoBusinessAccountProposal/vetoBusinessAccountProposal.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/withdrawBusinessAccountProposalApproval/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/withdrawBusinessAccountProposalApproval/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/withdrawBusinessAccountProposalApproval/withdrawBusinessAccountProposalApproval.d.ts +29 -0
- package/dist/modules/waas/businessAccounts/withdrawBusinessAccountProposalApproval/withdrawBusinessAccountProposalApproval.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{waas-oKD6ZDP9.native.esm.js → waas-C4jtRxx1.native.esm.js} +688 -26
- package/dist/waas-C4jtRxx1.native.esm.js.map +1 -0
- package/dist/{waas-G-4JvdgJ.cjs → waas-CioG-_yp.cjs} +764 -24
- package/dist/waas-CioG-_yp.cjs.map +1 -0
- package/dist/{waas-DjgZ-ghV.esm.js → waas-DjivkzyT.esm.js} +688 -26
- package/dist/waas-DjivkzyT.esm.js.map +1 -0
- package/dist/waas.cjs +18 -5
- package/dist/waas.esm.js +5 -5
- package/dist/waas.native.esm.js +5 -5
- package/dist/waasCore.cjs +5 -5
- package/dist/waasCore.esm.js +5 -5
- package/dist/waasCore.native.esm.js +5 -5
- package/package.json +3 -4
- package/dist/getNetworkProviderFromNetworkId-BXoTukxv.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-Cs3hLqBS.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-D_Hg6kP7.esm.js.map +0 -1
- package/dist/logoutWithReason-Bd1qUh7l.native.esm.js.map +0 -1
- package/dist/logoutWithReason-CFjm8dbR.cjs.map +0 -1
- package/dist/logoutWithReason-CX9hGTPw.esm.js.map +0 -1
- package/dist/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.d.ts +0 -5
- package/dist/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.d.ts.map +0 -1
- package/dist/waas-DjgZ-ghV.esm.js.map +0 -1
- package/dist/waas-G-4JvdgJ.cjs.map +0 -1
- package/dist/waas-oKD6ZDP9.native.esm.js.map +0 -1
package/dist/{getSignedSessionId-Bk-8is5J.native.esm.js → getSignedSessionId-Bt4obN3w.native.esm.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ct as getCore, Y as getNonce, _t as getElevatedAccessToken, ht as assertDefined } from "./apiClient-
|
|
2
|
-
import { r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { Ct as getCore, Y as getNonce, _t as getElevatedAccessToken, ht as assertDefined } from "./apiClient-CpfEx6Uc.native.esm.js";
|
|
2
|
+
import { r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-CxYft5KR.native.esm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts
|
|
5
5
|
/** @notInstrumented */
|
|
@@ -70,4 +70,4 @@ const getSignedSessionId = async (client) => {
|
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
72
|
export { getActionAuthorizationTokens as n, consumeMfaTokenIfRequiredForAction as r, getSignedSessionId as t };
|
|
73
|
-
//# sourceMappingURL=getSignedSessionId-
|
|
73
|
+
//# sourceMappingURL=getSignedSessionId-Bt4obN3w.native.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSignedSessionId-
|
|
1
|
+
{"version":3,"file":"getSignedSessionId-Bt4obN3w.native.esm.js","names":["consumeMfaToken"],"sources":["../src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts","../src/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.ts","../src/modules/sessionKeys/generateNonceSignature/generateNonceSignature.ts","../src/modules/sessionKeys/generateSessionSignature/generateSessionSignature.ts","../src/modules/sessionKeys/getSignedSessionId/getSignedSessionId.ts"],"sourcesContent":["import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { consumeMfaToken } from '../consumeMfaToken';\nimport { isMfaRequiredForAction } from '../isMfaRequiredForAction';\n\ntype ConsumeMfaTokenIfRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/** @notInstrumented */\nexport const consumeMfaTokenIfRequiredForAction = async (\n { mfaAction }: ConsumeMfaTokenIfRequiredForActionParams,\n client: DynamicClient\n): Promise<string | undefined> => {\n const isRequiredForAction = await isMfaRequiredForAction(\n { mfaAction },\n client\n );\n\n if (!isRequiredForAction) {\n return;\n }\n\n return consumeMfaToken(client);\n};\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { TokenScope } from '../consts';\nimport type { MFAAction } from '../../mfa/mfa.consts';\nimport { consumeMfaTokenIfRequiredForAction } from '../../mfa/consumeMfaTokenIfRequiredForAction';\nimport { getElevatedAccessToken } from '../getElevatedAccessToken';\n\ntype GetActionAuthorizationTokensParams = {\n mfaAction: MFAAction;\n scope: TokenScope;\n};\n\ntype ActionAuthorizationTokens = {\n elevatedAccessToken: string | undefined;\n mfaToken: string | undefined;\n};\n\n/**\n * Resolves the tokens that authorize a verification-gated wallet action.\n *\n * An elevated access token for `scope` is the current proof of verification, so\n * it takes precedence: when one has been banked, the legacy per-action MFA token\n * is left untouched. Demanding both would break every user who has a verified\n * MFA method, because satisfying the challenge with `requestedScopes` mints an\n * elevated access token and no MFA token -- leaving nothing for\n * `consumeMfaTokenIfRequiredForAction` to consume, which then throws.\n *\n * @param params.mfaAction - The action whose legacy MFA requirement to evaluate.\n * @param params.scope - The scope of the elevated access token that authorizes the action.\n * @param client - The Dynamic client instance.\n * @returns The elevated access token, or the legacy MFA token when no elevated token exists.\n * @notInstrumented\n */\nexport const getActionAuthorizationTokens = async (\n { mfaAction, scope }: GetActionAuthorizationTokensParams,\n client: DynamicClient\n): Promise<ActionAuthorizationTokens> => {\n const elevatedAccessToken = getElevatedAccessToken({ scope }, client);\n\n if (elevatedAccessToken) {\n return { elevatedAccessToken, mfaToken: undefined };\n }\n\n const mfaToken = await consumeMfaTokenIfRequiredForAction(\n { mfaAction },\n client\n );\n\n return { elevatedAccessToken: undefined, mfaToken };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\n\ntype GenerateNonceSignatureParams = {\n nonce: string;\n};\n\ntype GenerateNonceSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateNonceSignature = async (\n { nonce }: GenerateNonceSignatureParams,\n client: DynamicClient\n): Promise<GenerateNonceSignatureResult> => {\n const core = getCore(client);\n\n assertDefined(core.keychain, 'Keychain service not available');\n\n const signature = await core.keychain.sign('session', nonce);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\n\ntype GenerateSessionSignatureParams = {\n sessionId: string;\n};\n\ntype GenerateSessionSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateSessionSignature = async (\n { sessionId }: GenerateSessionSignatureParams,\n client: DynamicClient\n): Promise<GenerateSessionSignatureResult> => {\n const core = getCore(client);\n\n const signature = await core.keychain.sign('session', sessionId);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getNonce } from '../../../utils/getNonce';\nimport { generateNonceSignature } from '../generateNonceSignature';\nimport { generateSessionSignature } from '../generateSessionSignature';\n\ntype GetSignedSessionIdResult = { signature: string };\n\n/** @notInstrumented */\nexport const getSignedSessionId = async (\n client: DynamicClient\n): Promise<GetSignedSessionIdResult> => {\n const core = getCore(client);\n\n const sessionId = core.state.get().user?.sessionId;\n assertDefined(sessionId, 'Session ID is required');\n\n const { signature: signedSessionId } = await generateSessionSignature(\n {\n sessionId,\n },\n client\n );\n\n assertDefined(signedSessionId, 'Signed session ID is required');\n\n const nonce = await getNonce(client);\n\n const { signature: nonceSignature } = await generateNonceSignature(\n {\n nonce,\n },\n client\n );\n\n assertDefined(nonceSignature, 'Nonce signature is required');\n\n const signature = `${signedSessionId}/${nonceSignature}/${nonce}`;\n\n return { signature };\n};\n"],"mappings":";;;;;AAWA,MAAa,qCAAqC,OAChD,EAAE,aACF,WACgC;AAMhC,KAAI,CALwB,MAAM,uBAChC,EAAE,WAAW,EACb,OACD,CAGC;AAGF,QAAOA,0BAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;ACQhC,MAAa,+BAA+B,OAC1C,EAAE,WAAW,SACb,WACuC;CACvC,MAAM,sBAAsB,uBAAuB,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,oBACF,QAAO;EAAE;EAAqB,UAAU;EAAW;AAQrD,QAAO;EAAE,qBAAqB;EAAW,UALxB,MAAM,mCACrB,EAAE,WAAW,EACb,OACD;EAEkD;;;;;;ACpCrD,MAAa,yBAAyB,OACpC,EAAE,SACF,WAC0C;CAC1C,MAAM,OAAO,QAAQ,OAAO;AAE5B,eAAc,KAAK,UAAU,iCAAiC;AAI9D,QAAO,EAAE,WAFS,MAAM,KAAK,SAAS,KAAK,WAAW,MAAM,EAExC;;;;;;ACXtB,MAAa,2BAA2B,OACtC,EAAE,aACF,WAC4C;AAK5C,QAAO,EAAE,WAFS,MAFL,QAAQ,OAAO,CAEC,SAAS,KAAK,WAAW,UAAU,EAE5C;;;;;;ACRtB,MAAa,qBAAqB,OAChC,WACsC;CAGtC,MAAM,YAFO,QAAQ,OAAO,CAEL,MAAM,KAAK,CAAC,MAAM;AACzC,eAAc,WAAW,yBAAyB;CAElD,MAAM,EAAE,WAAW,oBAAoB,MAAM,yBAC3C,EACE,WACD,EACD,OACD;AAED,eAAc,iBAAiB,gCAAgC;CAE/D,MAAM,QAAQ,MAAM,SAAS,OAAO;CAEpC,MAAM,EAAE,WAAW,mBAAmB,MAAM,uBAC1C,EACE,OACD,EACD,OACD;AAED,eAAc,gBAAgB,8BAA8B;AAI5D,QAAO,EAAE,WAFS,GAAG,gBAAgB,GAAG,eAAe,GAAG,SAEtC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { $ as getNonce, Tt as getCore, _t as assertDefined, yt as getElevatedAccessToken } from "./logoutWithReason-DO0kP7nf.esm.js";
|
|
2
|
+
import { r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-DS8fcwxO.esm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts
|
|
5
5
|
/** @notInstrumented */
|
|
@@ -70,4 +70,4 @@ const getSignedSessionId = async (client) => {
|
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
72
|
export { getActionAuthorizationTokens as n, consumeMfaTokenIfRequiredForAction as r, getSignedSessionId as t };
|
|
73
|
-
//# sourceMappingURL=getSignedSessionId-
|
|
73
|
+
//# sourceMappingURL=getSignedSessionId-Cx7WP4ZJ.esm.js.map
|
package/dist/{getSignedSessionId-D_TknHwX.esm.js.map → getSignedSessionId-Cx7WP4ZJ.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSignedSessionId-
|
|
1
|
+
{"version":3,"file":"getSignedSessionId-Cx7WP4ZJ.esm.js","names":["consumeMfaToken"],"sources":["../src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts","../src/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.ts","../src/modules/sessionKeys/generateNonceSignature/generateNonceSignature.ts","../src/modules/sessionKeys/generateSessionSignature/generateSessionSignature.ts","../src/modules/sessionKeys/getSignedSessionId/getSignedSessionId.ts"],"sourcesContent":["import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { consumeMfaToken } from '../consumeMfaToken';\nimport { isMfaRequiredForAction } from '../isMfaRequiredForAction';\n\ntype ConsumeMfaTokenIfRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/** @notInstrumented */\nexport const consumeMfaTokenIfRequiredForAction = async (\n { mfaAction }: ConsumeMfaTokenIfRequiredForActionParams,\n client: DynamicClient\n): Promise<string | undefined> => {\n const isRequiredForAction = await isMfaRequiredForAction(\n { mfaAction },\n client\n );\n\n if (!isRequiredForAction) {\n return;\n }\n\n return consumeMfaToken(client);\n};\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { TokenScope } from '../consts';\nimport type { MFAAction } from '../../mfa/mfa.consts';\nimport { consumeMfaTokenIfRequiredForAction } from '../../mfa/consumeMfaTokenIfRequiredForAction';\nimport { getElevatedAccessToken } from '../getElevatedAccessToken';\n\ntype GetActionAuthorizationTokensParams = {\n mfaAction: MFAAction;\n scope: TokenScope;\n};\n\ntype ActionAuthorizationTokens = {\n elevatedAccessToken: string | undefined;\n mfaToken: string | undefined;\n};\n\n/**\n * Resolves the tokens that authorize a verification-gated wallet action.\n *\n * An elevated access token for `scope` is the current proof of verification, so\n * it takes precedence: when one has been banked, the legacy per-action MFA token\n * is left untouched. Demanding both would break every user who has a verified\n * MFA method, because satisfying the challenge with `requestedScopes` mints an\n * elevated access token and no MFA token -- leaving nothing for\n * `consumeMfaTokenIfRequiredForAction` to consume, which then throws.\n *\n * @param params.mfaAction - The action whose legacy MFA requirement to evaluate.\n * @param params.scope - The scope of the elevated access token that authorizes the action.\n * @param client - The Dynamic client instance.\n * @returns The elevated access token, or the legacy MFA token when no elevated token exists.\n * @notInstrumented\n */\nexport const getActionAuthorizationTokens = async (\n { mfaAction, scope }: GetActionAuthorizationTokensParams,\n client: DynamicClient\n): Promise<ActionAuthorizationTokens> => {\n const elevatedAccessToken = getElevatedAccessToken({ scope }, client);\n\n if (elevatedAccessToken) {\n return { elevatedAccessToken, mfaToken: undefined };\n }\n\n const mfaToken = await consumeMfaTokenIfRequiredForAction(\n { mfaAction },\n client\n );\n\n return { elevatedAccessToken: undefined, mfaToken };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\n\ntype GenerateNonceSignatureParams = {\n nonce: string;\n};\n\ntype GenerateNonceSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateNonceSignature = async (\n { nonce }: GenerateNonceSignatureParams,\n client: DynamicClient\n): Promise<GenerateNonceSignatureResult> => {\n const core = getCore(client);\n\n assertDefined(core.keychain, 'Keychain service not available');\n\n const signature = await core.keychain.sign('session', nonce);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\n\ntype GenerateSessionSignatureParams = {\n sessionId: string;\n};\n\ntype GenerateSessionSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateSessionSignature = async (\n { sessionId }: GenerateSessionSignatureParams,\n client: DynamicClient\n): Promise<GenerateSessionSignatureResult> => {\n const core = getCore(client);\n\n const signature = await core.keychain.sign('session', sessionId);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getNonce } from '../../../utils/getNonce';\nimport { generateNonceSignature } from '../generateNonceSignature';\nimport { generateSessionSignature } from '../generateSessionSignature';\n\ntype GetSignedSessionIdResult = { signature: string };\n\n/** @notInstrumented */\nexport const getSignedSessionId = async (\n client: DynamicClient\n): Promise<GetSignedSessionIdResult> => {\n const core = getCore(client);\n\n const sessionId = core.state.get().user?.sessionId;\n assertDefined(sessionId, 'Session ID is required');\n\n const { signature: signedSessionId } = await generateSessionSignature(\n {\n sessionId,\n },\n client\n );\n\n assertDefined(signedSessionId, 'Signed session ID is required');\n\n const nonce = await getNonce(client);\n\n const { signature: nonceSignature } = await generateNonceSignature(\n {\n nonce,\n },\n client\n );\n\n assertDefined(nonceSignature, 'Nonce signature is required');\n\n const signature = `${signedSessionId}/${nonceSignature}/${nonce}`;\n\n return { signature };\n};\n"],"mappings":";;;;;AAWA,MAAa,qCAAqC,OAChD,EAAE,aACF,WACgC;AAMhC,KAAI,CALwB,MAAM,uBAChC,EAAE,WAAW,EACb,OACD,CAGC;AAGF,QAAOA,0BAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;ACQhC,MAAa,+BAA+B,OAC1C,EAAE,WAAW,SACb,WACuC;CACvC,MAAM,sBAAsB,uBAAuB,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,oBACF,QAAO;EAAE;EAAqB,UAAU;EAAW;AAQrD,QAAO;EAAE,qBAAqB;EAAW,UALxB,MAAM,mCACrB,EAAE,WAAW,EACb,OACD;EAEkD;;;;;;ACpCrD,MAAa,yBAAyB,OACpC,EAAE,SACF,WAC0C;CAC1C,MAAM,OAAO,QAAQ,OAAO;AAE5B,eAAc,KAAK,UAAU,iCAAiC;AAI9D,QAAO,EAAE,WAFS,MAAM,KAAK,SAAS,KAAK,WAAW,MAAM,EAExC;;;;;;ACXtB,MAAa,2BAA2B,OACtC,EAAE,aACF,WAC4C;AAK5C,QAAO,EAAE,WAFS,MAFL,QAAQ,OAAO,CAEC,SAAS,KAAK,WAAW,UAAU,EAE5C;;;;;;ACRtB,MAAa,qBAAqB,OAChC,WACsC;CAGtC,MAAM,YAFO,QAAQ,OAAO,CAEL,MAAM,KAAK,CAAC,MAAM;AACzC,eAAc,WAAW,yBAAyB;CAElD,MAAM,EAAE,WAAW,oBAAoB,MAAM,yBAC3C,EACE,WACD,EACD,OACD;AAED,eAAc,iBAAiB,gCAAgC;CAE/D,MAAM,QAAQ,MAAM,SAAS,OAAO;CAEpC,MAAM,EAAE,WAAW,mBAAmB,MAAM,uBAC1C,EACE,OACD,EACD,OACD;AAED,eAAc,gBAAgB,8BAA8B;AAI5D,QAAO,EAAE,WAFS,GAAG,gBAAgB,GAAG,eAAe,GAAG,SAEtC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
2
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-BKwWBsCT.cjs');
|
|
2
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Czx-uPFY.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts
|
|
5
5
|
/** @notInstrumented */
|
|
@@ -87,4 +87,4 @@ Object.defineProperty(exports, 'getSignedSessionId', {
|
|
|
87
87
|
return getSignedSessionId;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
//# sourceMappingURL=getSignedSessionId-
|
|
90
|
+
//# sourceMappingURL=getSignedSessionId-DiVxv0qz.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSignedSessionId-
|
|
1
|
+
{"version":3,"file":"getSignedSessionId-DiVxv0qz.cjs","names":["isMfaRequiredForAction","consumeMfaToken","getElevatedAccessToken","getCore","getCore","getCore","getNonce"],"sources":["../src/modules/mfa/consumeMfaTokenIfRequiredForAction/consumeMfaTokenIfRequiredForAction.ts","../src/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.ts","../src/modules/sessionKeys/generateNonceSignature/generateNonceSignature.ts","../src/modules/sessionKeys/generateSessionSignature/generateSessionSignature.ts","../src/modules/sessionKeys/getSignedSessionId/getSignedSessionId.ts"],"sourcesContent":["import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { consumeMfaToken } from '../consumeMfaToken';\nimport { isMfaRequiredForAction } from '../isMfaRequiredForAction';\n\ntype ConsumeMfaTokenIfRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/** @notInstrumented */\nexport const consumeMfaTokenIfRequiredForAction = async (\n { mfaAction }: ConsumeMfaTokenIfRequiredForActionParams,\n client: DynamicClient\n): Promise<string | undefined> => {\n const isRequiredForAction = await isMfaRequiredForAction(\n { mfaAction },\n client\n );\n\n if (!isRequiredForAction) {\n return;\n }\n\n return consumeMfaToken(client);\n};\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { TokenScope } from '../consts';\nimport type { MFAAction } from '../../mfa/mfa.consts';\nimport { consumeMfaTokenIfRequiredForAction } from '../../mfa/consumeMfaTokenIfRequiredForAction';\nimport { getElevatedAccessToken } from '../getElevatedAccessToken';\n\ntype GetActionAuthorizationTokensParams = {\n mfaAction: MFAAction;\n scope: TokenScope;\n};\n\ntype ActionAuthorizationTokens = {\n elevatedAccessToken: string | undefined;\n mfaToken: string | undefined;\n};\n\n/**\n * Resolves the tokens that authorize a verification-gated wallet action.\n *\n * An elevated access token for `scope` is the current proof of verification, so\n * it takes precedence: when one has been banked, the legacy per-action MFA token\n * is left untouched. Demanding both would break every user who has a verified\n * MFA method, because satisfying the challenge with `requestedScopes` mints an\n * elevated access token and no MFA token -- leaving nothing for\n * `consumeMfaTokenIfRequiredForAction` to consume, which then throws.\n *\n * @param params.mfaAction - The action whose legacy MFA requirement to evaluate.\n * @param params.scope - The scope of the elevated access token that authorizes the action.\n * @param client - The Dynamic client instance.\n * @returns The elevated access token, or the legacy MFA token when no elevated token exists.\n * @notInstrumented\n */\nexport const getActionAuthorizationTokens = async (\n { mfaAction, scope }: GetActionAuthorizationTokensParams,\n client: DynamicClient\n): Promise<ActionAuthorizationTokens> => {\n const elevatedAccessToken = getElevatedAccessToken({ scope }, client);\n\n if (elevatedAccessToken) {\n return { elevatedAccessToken, mfaToken: undefined };\n }\n\n const mfaToken = await consumeMfaTokenIfRequiredForAction(\n { mfaAction },\n client\n );\n\n return { elevatedAccessToken: undefined, mfaToken };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\n\ntype GenerateNonceSignatureParams = {\n nonce: string;\n};\n\ntype GenerateNonceSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateNonceSignature = async (\n { nonce }: GenerateNonceSignatureParams,\n client: DynamicClient\n): Promise<GenerateNonceSignatureResult> => {\n const core = getCore(client);\n\n assertDefined(core.keychain, 'Keychain service not available');\n\n const signature = await core.keychain.sign('session', nonce);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\n\ntype GenerateSessionSignatureParams = {\n sessionId: string;\n};\n\ntype GenerateSessionSignatureResult = { signature: string };\n\n/** @notInstrumented */\nexport const generateSessionSignature = async (\n { sessionId }: GenerateSessionSignatureParams,\n client: DynamicClient\n): Promise<GenerateSessionSignatureResult> => {\n const core = getCore(client);\n\n const signature = await core.keychain.sign('session', sessionId);\n\n return { signature };\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getNonce } from '../../../utils/getNonce';\nimport { generateNonceSignature } from '../generateNonceSignature';\nimport { generateSessionSignature } from '../generateSessionSignature';\n\ntype GetSignedSessionIdResult = { signature: string };\n\n/** @notInstrumented */\nexport const getSignedSessionId = async (\n client: DynamicClient\n): Promise<GetSignedSessionIdResult> => {\n const core = getCore(client);\n\n const sessionId = core.state.get().user?.sessionId;\n assertDefined(sessionId, 'Session ID is required');\n\n const { signature: signedSessionId } = await generateSessionSignature(\n {\n sessionId,\n },\n client\n );\n\n assertDefined(signedSessionId, 'Signed session ID is required');\n\n const nonce = await getNonce(client);\n\n const { signature: nonceSignature } = await generateNonceSignature(\n {\n nonce,\n },\n client\n );\n\n assertDefined(nonceSignature, 'Nonce signature is required');\n\n const signature = `${signedSessionId}/${nonceSignature}/${nonce}`;\n\n return { signature };\n};\n"],"mappings":";;;;;AAWA,MAAa,qCAAqC,OAChD,EAAE,aACF,WACgC;AAMhC,KAAI,CALwB,MAAMA,sDAChC,EAAE,WAAW,EACb,OACD,CAGC;AAGF,QAAOC,yDAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;ACQhC,MAAa,+BAA+B,OAC1C,EAAE,WAAW,SACb,WACuC;CACvC,MAAM,sBAAsBC,gDAAuB,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,oBACF,QAAO;EAAE;EAAqB,UAAU;EAAW;AAQrD,QAAO;EAAE,qBAAqB;EAAW,UALxB,MAAM,mCACrB,EAAE,WAAW,EACb,OACD;EAEkD;;;;;;ACpCrD,MAAa,yBAAyB,OACpC,EAAE,SACF,WAC0C;CAC1C,MAAM,OAAOC,iCAAQ,OAAO;AAE5B,wCAAc,KAAK,UAAU,iCAAiC;AAI9D,QAAO,EAAE,WAFS,MAAM,KAAK,SAAS,KAAK,WAAW,MAAM,EAExC;;;;;;ACXtB,MAAa,2BAA2B,OACtC,EAAE,aACF,WAC4C;AAK5C,QAAO,EAAE,WAFS,MAFLC,iCAAQ,OAAO,CAEC,SAAS,KAAK,WAAW,UAAU,EAE5C;;;;;;ACRtB,MAAa,qBAAqB,OAChC,WACsC;CAGtC,MAAM,YAFOC,iCAAQ,OAAO,CAEL,MAAM,KAAK,CAAC,MAAM;AACzC,wCAAc,WAAW,yBAAyB;CAElD,MAAM,EAAE,WAAW,oBAAoB,MAAM,yBAC3C,EACE,WACD,EACD,OACD;AAED,wCAAc,iBAAiB,gCAAgC;CAE/D,MAAM,QAAQ,MAAMC,kCAAS,OAAO;CAEpC,MAAM,EAAE,WAAW,mBAAmB,MAAM,uBAC1C,EACE,OACD,EACD,OACD;AAED,wCAAc,gBAAgB,8BAA8B;AAI5D,QAAO,EAAE,WAFS,GAAG,gBAAgB,GAAG,eAAe,GAAG,SAEtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as getWalletProviders, c as NoWalletProviderFoundError } from "./logoutWithReason-DO0kP7nf.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts
|
|
4
4
|
/** @notInstrumented */
|
|
@@ -17,4 +17,4 @@ const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client) => {
|
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { getWalletProviderByKey as n, getVerifiedCredentialForWalletAccount as t };
|
|
20
|
-
//# sourceMappingURL=getVerifiedCredentialForWalletAccount-
|
|
20
|
+
//# sourceMappingURL=getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVerifiedCredentialForWalletAccount-
|
|
1
|
+
{"version":3,"file":"getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js","names":["walletProvider"],"sources":["../src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts","../src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.ts"],"sourcesContent":["import type { DynamicClient } from '../../../client/types';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { getWalletProviders } from '../getWalletProviders';\nimport type { WalletProvider } from '../walletProvider';\n\ntype GetWalletProviderByKeyParams = {\n walletProviderKey: string;\n};\n\n/** @notInstrumented */\nexport const getWalletProviderByKey = (\n { walletProviderKey }: GetWalletProviderByKeyParams,\n client: DynamicClient\n): WalletProvider => {\n const walletProviders = getWalletProviders(client);\n\n const walletProvider = walletProviders.find(\n (walletProvider) => walletProvider.key === walletProviderKey\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({ walletProviderKey });\n }\n\n return walletProvider;\n};\n","import type { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../walletAccount';\n\ntype GetVerifiedCredentialForWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getVerifiedCredentialForWalletAccount = (\n { walletAccount }: GetVerifiedCredentialForWalletAccountParams,\n client: DynamicClient\n): JwtVerifiedCredential | undefined => {\n return client.user?.verifiedCredentials.find(\n (vc) => vc.id === walletAccount.verifiedCredentialId\n );\n};\n"],"mappings":";;;;AAUA,MAAa,0BACX,EAAE,qBACF,WACmB;CAGnB,MAAM,iBAFkB,mBAAmB,OAAO,CAEX,MACpC,qBAAmBA,iBAAe,QAAQ,kBAC5C;AAED,KAAI,CAAC,eACH,OAAM,IAAI,2BAA2B,EAAE,mBAAmB,CAAC;AAG7D,QAAO;;;;;;ACdT,MAAa,yCACX,EAAE,iBACF,WACsC;AACtC,QAAO,OAAO,MAAM,oBAAoB,MACrC,OAAO,GAAG,OAAO,cAAc,qBACjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-BKwWBsCT.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts
|
|
4
4
|
/** @notInstrumented */
|
|
@@ -28,4 +28,4 @@ Object.defineProperty(exports, 'getWalletProviderByKey', {
|
|
|
28
28
|
return getWalletProviderByKey;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
//# sourceMappingURL=getVerifiedCredentialForWalletAccount-
|
|
31
|
+
//# sourceMappingURL=getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVerifiedCredentialForWalletAccount-
|
|
1
|
+
{"version":3,"file":"getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs","names":["getWalletProviders","walletProvider","NoWalletProviderFoundError"],"sources":["../src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts","../src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.ts"],"sourcesContent":["import type { DynamicClient } from '../../../client/types';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { getWalletProviders } from '../getWalletProviders';\nimport type { WalletProvider } from '../walletProvider';\n\ntype GetWalletProviderByKeyParams = {\n walletProviderKey: string;\n};\n\n/** @notInstrumented */\nexport const getWalletProviderByKey = (\n { walletProviderKey }: GetWalletProviderByKeyParams,\n client: DynamicClient\n): WalletProvider => {\n const walletProviders = getWalletProviders(client);\n\n const walletProvider = walletProviders.find(\n (walletProvider) => walletProvider.key === walletProviderKey\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({ walletProviderKey });\n }\n\n return walletProvider;\n};\n","import type { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../walletAccount';\n\ntype GetVerifiedCredentialForWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getVerifiedCredentialForWalletAccount = (\n { walletAccount }: GetVerifiedCredentialForWalletAccountParams,\n client: DynamicClient\n): JwtVerifiedCredential | undefined => {\n return client.user?.verifiedCredentials.find(\n (vc) => vc.id === walletAccount.verifiedCredentialId\n );\n};\n"],"mappings":";;;;AAUA,MAAa,0BACX,EAAE,qBACF,WACmB;CAGnB,MAAM,iBAFkBA,4CAAmB,OAAO,CAEX,MACpC,qBAAmBC,iBAAe,QAAQ,kBAC5C;AAED,KAAI,CAAC,eACH,OAAM,IAAIC,oDAA2B,EAAE,mBAAmB,CAAC;AAG7D,QAAO;;;;;;ACdT,MAAa,yCACX,EAAE,iBACF,WACsC;AACtC,QAAO,OAAO,MAAM,oBAAoB,MACrC,OAAO,GAAG,OAAO,cAAc,qBACjC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
2
|
-
const require_migrateFromFireblocks = require('./migrateFromFireblocks-
|
|
3
|
-
const require_waas = require('./waas-
|
|
4
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
5
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
6
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-
|
|
7
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-BKwWBsCT.cjs');
|
|
2
|
+
const require_migrateFromFireblocks = require('./migrateFromFireblocks-ycJIYcrm.cjs');
|
|
3
|
+
const require_waas = require('./waas-CioG-_yp.cjs');
|
|
4
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-Cez8TM-n.cjs');
|
|
5
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs');
|
|
6
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-FbjleMQm.cjs');
|
|
7
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Czx-uPFY.cjs');
|
|
8
8
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
9
9
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
10
10
|
let zod_mini = require("zod/mini");
|
|
@@ -166,57 +166,6 @@ const setupCrossTabEventSync = (client) => {
|
|
|
166
166
|
core.crossTabBroadcast.on("deviceRegistrationCompleted", handleCrossTabDeviceRegistrationCompleted);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/modules/wallets/unverifiedWalletAccounts/schema.ts
|
|
171
|
-
const unverifiedWalletAccountSchema = zod_mini.object({
|
|
172
|
-
address: zod_mini.string(),
|
|
173
|
-
addressesWithTypes: zod_mini.optional(zod_mini.array(zod_mini.object({
|
|
174
|
-
address: zod_mini.string(),
|
|
175
|
-
publicKey: zod_mini.optional(zod_mini.string()),
|
|
176
|
-
type: zod_mini.custom((val) => typeof val === "string")
|
|
177
|
-
}))),
|
|
178
|
-
chain: zod_mini.custom((val) => typeof val === "string"),
|
|
179
|
-
hardwareWalletVendor: zod_mini.optional(zod_mini.custom((val) => typeof val === "string")),
|
|
180
|
-
id: zod_mini.string(),
|
|
181
|
-
lastSelectedAt: zod_mini.nullable(zod_mini.date()),
|
|
182
|
-
walletProviderKey: zod_mini.string()
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/modules/wallets/walletProvider/walletProviderKeyMap/schema.ts
|
|
187
|
-
const walletProviderKeyMapSchema = zod_mini.record(zod_mini.string(), zod_mini.string());
|
|
188
|
-
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/modules/storageSync/schema.ts
|
|
191
|
-
const stateStorageKeySchema = require_logoutWithReason.createStorageKeySchema({
|
|
192
|
-
key: "state",
|
|
193
|
-
schema: zod_mini.object({
|
|
194
|
-
apiVersion: zod_mini.string(),
|
|
195
|
-
projectSettings: zod_mini.custom(),
|
|
196
|
-
unverifiedWalletAccounts: zod_mini.array(unverifiedWalletAccountSchema),
|
|
197
|
-
user: zod_mini.custom(),
|
|
198
|
-
walletProviderKeyMap: walletProviderKeyMapSchema
|
|
199
|
-
})
|
|
200
|
-
});
|
|
201
|
-
const sessionStorageKeySchema = require_logoutWithReason.createStorageKeySchema({
|
|
202
|
-
config: { storageTier: "secure" },
|
|
203
|
-
key: "session",
|
|
204
|
-
schema: zod_mini.object({
|
|
205
|
-
captchaToken: zod_mini.nullable(zod_mini.string()),
|
|
206
|
-
elevatedAccessTokens: zod_mini.array(zod_mini.object({
|
|
207
|
-
expiresAt: zod_mini.number(),
|
|
208
|
-
scopes: zod_mini.array(zod_mini.string()),
|
|
209
|
-
singleUse: zod_mini.nullable(zod_mini.boolean()),
|
|
210
|
-
token: zod_mini.string()
|
|
211
|
-
})),
|
|
212
|
-
legacyToken: zod_mini.nullable(zod_mini.string()),
|
|
213
|
-
mfaToken: zod_mini.nullable(zod_mini.string()),
|
|
214
|
-
sessionExpiration: zod_mini.number(),
|
|
215
|
-
sessionKeys: zod_mini.nullable(zod_mini.string()),
|
|
216
|
-
token: zod_mini.nullable(zod_mini.string())
|
|
217
|
-
})
|
|
218
|
-
});
|
|
219
|
-
|
|
220
169
|
//#endregion
|
|
221
170
|
//#region src/modules/keychainMigration/migrateSessionKeyToKeychain/KeyMigrationError.ts
|
|
222
171
|
var KeyMigrationError = class extends require_logoutWithReason.BaseError {
|
|
@@ -277,8 +226,8 @@ const migrateSessionKeyToKeychain = async ({ keychain, logger, state, storage })
|
|
|
277
226
|
if (importedPublicKey !== publicKey) throw new KeyMigrationError(publicKey, importedPublicKey);
|
|
278
227
|
logger.debug("[migrateSessionKeyToKeychain] Public key validated, updating state and storage");
|
|
279
228
|
state.set({ sessionKeys: importedPublicKey });
|
|
280
|
-
const currentSession = await storage.getItem(sessionStorageKeySchema);
|
|
281
|
-
if (currentSession) await storage.setItem(sessionStorageKeySchema, {
|
|
229
|
+
const currentSession = await storage.getItem(require_logoutWithReason.sessionStorageKeySchema);
|
|
230
|
+
if (currentSession) await storage.setItem(require_logoutWithReason.sessionStorageKeySchema, {
|
|
282
231
|
...currentSession,
|
|
283
232
|
sessionKeys: importedPublicKey
|
|
284
233
|
});
|
|
@@ -307,7 +256,7 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
307
256
|
const core = require_logoutWithReason.getCore(client);
|
|
308
257
|
const previousState = core.state.get();
|
|
309
258
|
const stateChanges = {};
|
|
310
|
-
const session = await core.storage.getItem(sessionStorageKeySchema);
|
|
259
|
+
const session = await core.storage.getItem(require_logoutWithReason.sessionStorageKeySchema);
|
|
311
260
|
const isSessionValid = session?.sessionExpiration && session.sessionExpiration > Date.now();
|
|
312
261
|
if (isSessionValid) {
|
|
313
262
|
stateChanges.token = session.token;
|
|
@@ -323,7 +272,7 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
323
272
|
stateChanges.captchaToken = session.captchaToken;
|
|
324
273
|
stateChanges.sessionKeys = session.sessionKeys;
|
|
325
274
|
}
|
|
326
|
-
const storedState = await core.storage.getItem(stateStorageKeySchema);
|
|
275
|
+
const storedState = await core.storage.getItem(require_logoutWithReason.stateStorageKeySchema);
|
|
327
276
|
if (storedState?.apiVersion === require_logoutWithReason.SDK_API_CORE_VERSION) {
|
|
328
277
|
stateChanges.unverifiedWalletAccounts = storedState.unverifiedWalletAccounts;
|
|
329
278
|
stateChanges.walletProviderKeyMap = storedState.walletProviderKeyMap;
|
|
@@ -340,8 +289,8 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
340
289
|
const syncStateWithStorage = (client) => {
|
|
341
290
|
const core = require_logoutWithReason.getCore(client);
|
|
342
291
|
core.state.subscribe((state) => {
|
|
343
|
-
if (state.sessionExpiresAt === null) core.storage.removeItem(sessionStorageKeySchema);
|
|
344
|
-
else core.storage.setItem(sessionStorageKeySchema, {
|
|
292
|
+
if (state.sessionExpiresAt === null) core.storage.removeItem(require_logoutWithReason.sessionStorageKeySchema);
|
|
293
|
+
else core.storage.setItem(require_logoutWithReason.sessionStorageKeySchema, {
|
|
345
294
|
captchaToken: state.captchaToken,
|
|
346
295
|
elevatedAccessTokens: (state.elevatedAccessTokens || []).map((token) => ({
|
|
347
296
|
expiresAt: token.expiresAt.getTime(),
|
|
@@ -355,7 +304,7 @@ const syncStateWithStorage = (client) => {
|
|
|
355
304
|
sessionKeys: state.sessionKeys,
|
|
356
305
|
token: state.token
|
|
357
306
|
});
|
|
358
|
-
core.storage.setItem(stateStorageKeySchema, {
|
|
307
|
+
core.storage.setItem(require_logoutWithReason.stateStorageKeySchema, {
|
|
359
308
|
apiVersion: require_logoutWithReason.SDK_API_CORE_VERSION,
|
|
360
309
|
projectSettings: state.projectSettings,
|
|
361
310
|
unverifiedWalletAccounts: state.unverifiedWalletAccounts,
|
|
@@ -508,7 +457,7 @@ const initializeClient = async (client = require_logoutWithReason.getDefaultClie
|
|
|
508
457
|
raiseStateEvents(client);
|
|
509
458
|
setupCrossTabEventSync(client);
|
|
510
459
|
const initializeStorageSyncPromise = initializeStorageSync(client);
|
|
511
|
-
const
|
|
460
|
+
const migrationPromise = initializeStorageSyncPromise.then(async () => {
|
|
512
461
|
await migrateSessionKeyToKeychain({
|
|
513
462
|
keychain: core.keychain,
|
|
514
463
|
logger: core.logger,
|
|
@@ -517,8 +466,13 @@ const initializeClient = async (client = require_logoutWithReason.getDefaultClie
|
|
|
517
466
|
}).catch(() => require_logoutWithReason.__logoutWithReason_wrapped({ reason: "keychain-migration-failed" }, client));
|
|
518
467
|
if (core.state.get().sessionKeys && !await core.keychain.hasKey("session")) await require_logoutWithReason.__logoutWithReason_wrapped({ reason: "keychain-key-missing" }, client);
|
|
519
468
|
await logoutIfSessionPublicKeyMismatched(client);
|
|
520
|
-
})
|
|
521
|
-
|
|
469
|
+
});
|
|
470
|
+
core.initTrack.track({
|
|
471
|
+
name: require_getNetworkProviderFromNetworkId.MIGRATE_SESSION_KEY_TRACKER_KEY,
|
|
472
|
+
promise: migrationPromise
|
|
473
|
+
});
|
|
474
|
+
const fetchProjectSettingsPromise = initializeStorageSyncPromise.then(async () => {
|
|
475
|
+
await require_logoutWithReason.fetchProjectSettings(client);
|
|
522
476
|
});
|
|
523
477
|
fetchProjectSettingsPromise.then(() => prefetchNoncesIfNeeded(client)).catch((error) => {
|
|
524
478
|
core.logger.error("Failed to prefetch nonces:", error);
|
|
@@ -2158,6 +2112,39 @@ const __signInWithExternalJwt_wrapped = require_logoutWithReason.instrumentFunct
|
|
|
2158
2112
|
getCore: require_logoutWithReason.resolveInstrumentationCore
|
|
2159
2113
|
});
|
|
2160
2114
|
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region src/modules/auth/isSignedIn/isSignedIn.ts
|
|
2117
|
+
/**
|
|
2118
|
+
* Checks if the user is currently signed in to the Dynamic client.
|
|
2119
|
+
*
|
|
2120
|
+
* The client is considered to be in a signed in state if a user has
|
|
2121
|
+
* authenticated or if the client has at least one wallet connected.
|
|
2122
|
+
*
|
|
2123
|
+
* @deprecated What counts as "signed in" is your app's business logic, not the
|
|
2124
|
+
* SDK's. This helper bakes in one opinion (a user OR any connected wallet),
|
|
2125
|
+
* which rarely matches every app and forces a dependency on us for every
|
|
2126
|
+
* variation. Compose your own check from the underlying primitives instead —
|
|
2127
|
+
* e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and
|
|
2128
|
+
* layer in whatever your app requires (device registration, completed
|
|
2129
|
+
* onboarding, satisfied MFA, a required embedded wallet, …). See the
|
|
2130
|
+
* "Check if signed in" guide:
|
|
2131
|
+
* https://www.dynamic.xyz/docs/javascript/user-session-management
|
|
2132
|
+
*
|
|
2133
|
+
* @example
|
|
2134
|
+
* ```ts
|
|
2135
|
+
* if (isSignedIn()) {
|
|
2136
|
+
* console.log('User is authenticated or has a wallet connected');
|
|
2137
|
+
* }
|
|
2138
|
+
* ```
|
|
2139
|
+
*
|
|
2140
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2141
|
+
* @returns True if the user is signed in, false otherwise.
|
|
2142
|
+
* @see logout
|
|
2143
|
+
* @see isAnyWalletAccountConnected
|
|
2144
|
+
* @notInstrumented
|
|
2145
|
+
*/
|
|
2146
|
+
const isSignedIn = (client = require_logoutWithReason.getDefaultClient()) => Boolean(client.user || require_logoutWithReason.getWalletAccounts(client).length > 0);
|
|
2147
|
+
|
|
2161
2148
|
//#endregion
|
|
2162
2149
|
//#region src/modules/auth/logout/logout.ts
|
|
2163
2150
|
/**
|
|
@@ -10812,7 +10799,7 @@ exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredFor
|
|
|
10812
10799
|
exports.isMobile = isMobile;
|
|
10813
10800
|
exports.isPendingRecoveryCodesAcknowledgment = require_isUserOnboardingComplete.isPendingRecoveryCodesAcknowledgment;
|
|
10814
10801
|
exports.isProgrammaticNetworkSwitchAvailable = isProgrammaticNetworkSwitchAvailable;
|
|
10815
|
-
exports.isSignedIn =
|
|
10802
|
+
exports.isSignedIn = isSignedIn;
|
|
10816
10803
|
exports.isUserMissingMfaAuth = require_logoutWithReason.isUserMissingMfaAuth;
|
|
10817
10804
|
exports.isUserOnboardingComplete = require_isUserOnboardingComplete.isUserOnboardingComplete;
|
|
10818
10805
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|