@dynamic-labs-sdk/client 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{constants-DL47U-Dx.cjs.js → InvalidParamError-D1yNl3r1.cjs.js} +25 -4
- package/dist/InvalidParamError-D1yNl3r1.cjs.js.map +1 -0
- package/dist/{constants-bfXJY5_7.esm.js → InvalidParamError-DMz6QY8e.esm.js} +19 -4
- package/dist/InvalidParamError-DMz6QY8e.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-DwwtYtDl.esm.js → NotWaasWalletAccountError-Cp3qfAxw.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DwwtYtDl.esm.js.map → NotWaasWalletAccountError-Cp3qfAxw.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-Dsl53Rdk.cjs.js → NotWaasWalletAccountError-s2J7fQHr.cjs.js} +7 -7
- package/dist/{NotWaasWalletAccountError-Dsl53Rdk.cjs.js.map → NotWaasWalletAccountError-s2J7fQHr.cjs.js.map} +1 -1
- package/dist/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/createCore/getInitialState.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +15 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts.map +1 -1
- package/dist/client/types/DynamicClientConfig.d.ts +46 -0
- package/dist/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/dist/core.cjs.js +43 -34
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +16 -9
- package/dist/core.esm.js.map +1 -1
- package/dist/errors/base/BaseError.d.ts.map +1 -1
- package/dist/exports/core.d.ts +6 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +4 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +6 -0
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CdU8ydLW.cjs.js → getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js} +129 -45
- package/dist/getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-B76p2y0m.esm.js → getNetworkProviderFromNetworkId-CmLsKY7E.esm.js} +88 -24
- package/dist/getNetworkProviderFromNetworkId-CmLsKY7E.esm.js.map +1 -0
- package/dist/{getSignedSessionId-DPA3pcv4.cjs.js → getSignedSessionId-BO9omMlI.cjs.js} +8 -8
- package/dist/{getSignedSessionId-DPA3pcv4.cjs.js.map → getSignedSessionId-BO9omMlI.cjs.js.map} +1 -1
- package/dist/{getSignedSessionId-CLTjlTqR.esm.js → getSignedSessionId-BvQ4i928.esm.js} +3 -3
- package/dist/{getSignedSessionId-CLTjlTqR.esm.js.map → getSignedSessionId-BvQ4i928.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-C2Qm59Tk.esm.js → getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js} +113 -3
- package/dist/getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-eZh6gV0A.cjs.js → getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js} +140 -30
- package/dist/getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js.map +1 -0
- package/dist/index.cjs.js +326 -267
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-DAKEY8s9.esm.js → isMfaRequiredForAction-DIvUT6_k.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DAKEY8s9.esm.js.map → isMfaRequiredForAction-DIvUT6_k.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-D2oHITVq.cjs.js → isMfaRequiredForAction-DmYvEIJH.cjs.js} +9 -9
- package/dist/{isMfaRequiredForAction-D2oHITVq.cjs.js.map → isMfaRequiredForAction-DmYvEIJH.cjs.js.map} +1 -1
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts +26 -0
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts.map +1 -0
- package/dist/modules/auth/decodeJwt/index.d.ts +2 -0
- package/dist/modules/auth/decodeJwt/index.d.ts.map +1 -0
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts +30 -0
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/getElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/getElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/state.d.ts +13 -0
- package/dist/modules/auth/state.d.ts.map +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/elevatedAccessTokens.types.d.ts +10 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/elevatedAccessTokens.types.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.d.ts +9 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.d.ts +17 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.d.ts +17 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/detectDeviceRegistrationRedirect/detectDeviceRegistrationRedirect.d.ts +1 -1
- package/dist/modules/deviceRegistration/{getDeviceTokenFromUrl/getDeviceTokenFromUrl.d.ts → getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.d.ts} +3 -3
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/index.d.ts.map +1 -0
- package/dist/modules/user/isUserOnboardingComplete/index.d.ts +2 -0
- package/dist/modules/user/isUserOnboardingComplete/index.d.ts.map +1 -0
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts +12 -0
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.d.ts +26 -3
- package/dist/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.d.ts.map +1 -1
- package/dist/modules/waas/getWalletRecoveryState/getWalletRecoveryState.d.ts +16 -0
- package/dist/modules/waas/getWalletRecoveryState/getWalletRecoveryState.d.ts.map +1 -0
- package/dist/modules/waas/getWalletRecoveryState/index.d.ts +2 -0
- package/dist/modules/waas/getWalletRecoveryState/index.d.ts.map +1 -0
- package/dist/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.d.ts +11 -0
- package/dist/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.d.ts.map +1 -0
- package/dist/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.d.ts +19 -0
- package/dist/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.d.ts.map +1 -0
- package/dist/modules/waas/unlockWallet/index.d.ts +2 -0
- package/dist/modules/waas/unlockWallet/index.d.ts.map +1 -0
- package/dist/modules/waas/unlockWallet/unlockWallet.d.ts +17 -0
- package/dist/modules/waas/unlockWallet/unlockWallet.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +23 -1
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getNetworksData/getNetworksData.d.ts +4 -0
- package/dist/modules/wallets/networks/getNetworksData/getNetworksData.d.ts.map +1 -1
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/createCrossTabBroadcast.d.ts +19 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/createCrossTabBroadcast.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/index.d.ts +2 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/index.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.schema.d.ts +8 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.schema.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.types.d.ts +35 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.types.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/index.d.ts +3 -0
- package/dist/services/crossTabBroadcast/index.d.ts.map +1 -0
- package/dist/services/deviceSigner/deviceSigner.types.d.ts +21 -0
- package/dist/services/deviceSigner/deviceSigner.types.d.ts.map +1 -0
- package/dist/services/deviceSigner/index.d.ts +2 -0
- package/dist/services/deviceSigner/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs.js +150 -47
- package/dist/waas.cjs.js.map +1 -1
- package/dist/waas.esm.js +123 -24
- package/dist/waas.esm.js.map +1 -1
- package/dist/waasCore.cjs.js +39 -20
- package/dist/waasCore.cjs.js.map +1 -1
- package/dist/waasCore.esm.js +28 -9
- package/dist/waasCore.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/InvalidParamError-BRozID7g.esm.js +0 -18
- package/dist/InvalidParamError-BRozID7g.esm.js.map +0 -1
- package/dist/InvalidParamError-BpTA89Mf.cjs.js +0 -23
- package/dist/InvalidParamError-BpTA89Mf.cjs.js.map +0 -1
- package/dist/constants-DL47U-Dx.cjs.js.map +0 -1
- package/dist/constants-bfXJY5_7.esm.js.map +0 -1
- package/dist/filterDuplicates-C1MD6p_l.esm.js +0 -10
- package/dist/filterDuplicates-C1MD6p_l.esm.js.map +0 -1
- package/dist/filterDuplicates-DPNky3ug.cjs.js +0 -16
- package/dist/filterDuplicates-DPNky3ug.cjs.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-B76p2y0m.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CdU8ydLW.cjs.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-C2Qm59Tk.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-eZh6gV0A.cjs.js.map +0 -1
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/getDeviceTokenFromUrl.d.ts.map +0 -1
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/index.d.ts +0 -2
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/index.d.ts.map +0 -1
package/dist/{isMfaRequiredForAction-DAKEY8s9.esm.js → isMfaRequiredForAction-DIvUT6_k.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as getCore, l as createApiClient, w as getDefaultClient, y as assertDefined } from "./InvalidParamError-DMz6QY8e.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/bufferToHex/bufferToHex.ts
|
|
4
4
|
/**
|
|
@@ -66,4 +66,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
|
|
|
66
66
|
|
|
67
67
|
//#endregion
|
|
68
68
|
export { bufferToHex as i, getMfaMethods as n, consumeMfaToken as r, isMfaRequiredForAction as t };
|
|
69
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
69
|
+
//# sourceMappingURL=isMfaRequiredForAction-DIvUT6_k.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMfaRequiredForAction-
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-DIvUT6_k.esm.js","names":[],"sources":["../src/utils/bufferToHex/bufferToHex.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["/**\n * Converts an ArrayBuffer to a hex-encoded string\n */\nexport const bufferToHex = (buffer: ArrayBufferLike) =>\n [...new Uint8Array(buffer)]\n .map((x) => x.toString(16).padStart(2, '0'))\n .join('');\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;;;;AAGA,MAAa,eAAe,WAC1B,CAAC,GAAG,IAAI,WAAW,OAAO,CAAC,CACxB,KAAK,MAAM,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAC3C,KAAK,GAAG;;;;;;;;;;;;;;ACQb,MAAa,mBAAmB,SAAS,kBAAkB,KAAK;CAC9D,MAAM,OAAO,QAAQ,OAAO;CAE5B,MAAM,WAAW,KAAK,MAAM,KAAK,CAAC;AAElC,eAAc,UAAU,qBAAqB;AAE7C,MAAK,MAAM,IAAI,EACb,UAAU,MACX,CAAC;AAEF,QAAO;;;;;;;;;;;;;;ACZT,MAAa,gBAAgB,OAAO,SAAS,kBAAkB,KAAK;CAClE,MAAM,OAAO,QAAQ,OAAO;AAQ5B,QALuB,MAFL,gBAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAAS,kBAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
|
package/dist/{isMfaRequiredForAction-D2oHITVq.cjs.js → isMfaRequiredForAction-DmYvEIJH.cjs.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-D1yNl3r1.cjs.js');
|
|
2
2
|
|
|
3
3
|
//#region src/utils/bufferToHex/bufferToHex.ts
|
|
4
4
|
/**
|
|
@@ -18,10 +18,10 @@ const bufferToHex = (buffer) => [...new Uint8Array(buffer)].map((x) => x.toStrin
|
|
|
18
18
|
* @returns The MFA token that was consumed.
|
|
19
19
|
* @throws Error if no MFA token is found.
|
|
20
20
|
*/
|
|
21
|
-
const consumeMfaToken = (client =
|
|
22
|
-
const core =
|
|
21
|
+
const consumeMfaToken = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
22
|
+
const core = require_InvalidParamError.getCore(client);
|
|
23
23
|
const mfaToken = core.state.get().mfaToken;
|
|
24
|
-
|
|
24
|
+
require_InvalidParamError.assertDefined(mfaToken, "No MFA token found");
|
|
25
25
|
core.state.set({ mfaToken: null });
|
|
26
26
|
return mfaToken;
|
|
27
27
|
};
|
|
@@ -37,9 +37,9 @@ const consumeMfaToken = (client = require_constants.getDefaultClient()) => {
|
|
|
37
37
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
38
38
|
* @returns A promise that resolves to the user's MFA methods configuration.
|
|
39
39
|
*/
|
|
40
|
-
const getMfaMethods = async (client =
|
|
41
|
-
const core =
|
|
42
|
-
return await
|
|
40
|
+
const getMfaMethods = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
41
|
+
const core = require_InvalidParamError.getCore(client);
|
|
42
|
+
return await require_InvalidParamError.createApiClient({}, client).getUserMfaMethods({
|
|
43
43
|
environmentId: core.environmentId,
|
|
44
44
|
verifiedOnly: true
|
|
45
45
|
});
|
|
@@ -57,7 +57,7 @@ const getMfaMethods = async (client = require_constants.getDefaultClient()) => {
|
|
|
57
57
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
58
58
|
* @returns A promise that resolves to true if MFA is required for the action, false otherwise.
|
|
59
59
|
*/
|
|
60
|
-
const isMfaRequiredForAction = async ({ mfaAction }, client =
|
|
60
|
+
const isMfaRequiredForAction = async ({ mfaAction }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
61
61
|
const projectSettings = client.projectSettings;
|
|
62
62
|
if (!projectSettings?.security?.mfa?.actions?.some((action) => action.action === mfaAction && action.required)) return false;
|
|
63
63
|
if (projectSettings?.security?.mfa?.required) return true;
|
|
@@ -89,4 +89,4 @@ Object.defineProperty(exports, 'isMfaRequiredForAction', {
|
|
|
89
89
|
return isMfaRequiredForAction;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
92
|
+
//# sourceMappingURL=isMfaRequiredForAction-DmYvEIJH.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMfaRequiredForAction-
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-DmYvEIJH.cjs.js","names":["getDefaultClient","getCore","getDefaultClient","getCore","createApiClient","getDefaultClient"],"sources":["../src/utils/bufferToHex/bufferToHex.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["/**\n * Converts an ArrayBuffer to a hex-encoded string\n */\nexport const bufferToHex = (buffer: ArrayBufferLike) =>\n [...new Uint8Array(buffer)]\n .map((x) => x.toString(16).padStart(2, '0'))\n .join('');\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;;;;AAGA,MAAa,eAAe,WAC1B,CAAC,GAAG,IAAI,WAAW,OAAO,CAAC,CACxB,KAAK,MAAM,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAC3C,KAAK,GAAG;;;;;;;;;;;;;;ACQb,MAAa,mBAAmB,SAASA,4CAAkB,KAAK;CAC9D,MAAM,OAAOC,kCAAQ,OAAO;CAE5B,MAAM,WAAW,KAAK,MAAM,KAAK,CAAC;AAElC,yCAAc,UAAU,qBAAqB;AAE7C,MAAK,MAAM,IAAI,EACb,UAAU,MACX,CAAC;AAEF,QAAO;;;;;;;;;;;;;;ACZT,MAAa,gBAAgB,OAAO,SAASC,4CAAkB,KAAK;CAClE,MAAM,OAAOC,kCAAQ,OAAO;AAQ5B,QALuB,MAFLC,0CAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAASC,4CAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type JwtPayload = {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
exp?: number;
|
|
4
|
+
iat?: number;
|
|
5
|
+
scopes?: string[];
|
|
6
|
+
singleUse?: boolean;
|
|
7
|
+
sub?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Decodes a JWT token and returns the full payload.
|
|
11
|
+
*
|
|
12
|
+
* This function extracts and returns the complete JWT payload including scopes,
|
|
13
|
+
* expiration time, and other claims.
|
|
14
|
+
*
|
|
15
|
+
* @param jwt - The JWT token string.
|
|
16
|
+
* @returns The decoded JWT payload object.
|
|
17
|
+
* @throws InvalidParamError if the token is invalid or cannot be decoded.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const payload = decodeJwt(jwt);
|
|
22
|
+
* // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const decodeJwt: (jwt: string) => JwtPayload;
|
|
26
|
+
//# sourceMappingURL=decodeJwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decodeJwt.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/decodeJwt/decodeJwt.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,UA4BvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/decodeJwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type GetElevatedAccessTokenParams = {
|
|
2
|
+
scope: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Gets an elevated access token by scope.
|
|
6
|
+
*
|
|
7
|
+
* This function retrieves an elevated access token that contains the specified scope.
|
|
8
|
+
* Expired tokens are automatically filtered out.
|
|
9
|
+
*
|
|
10
|
+
* If the token has `singleUse: true`, it will be automatically
|
|
11
|
+
* consumed (removed from state) after retrieval. Otherwise, it remains in state
|
|
12
|
+
* for future use.
|
|
13
|
+
*
|
|
14
|
+
* @param params - The parameters object.
|
|
15
|
+
* @param params.scope - The scope to match (e.g., 'wallet:export').
|
|
16
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
17
|
+
* @returns The elevated access token if found and not expired, or undefined if not found or expired.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const token = getElevatedAccessToken({ scope: 'wallet:export' });
|
|
22
|
+
* if (token) {
|
|
23
|
+
* // Use the token
|
|
24
|
+
* // Token is automatically consumed if singleUse: true
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const getElevatedAccessToken: ({ scope }: GetElevatedAccessTokenParams, client?: import("../../../exports").DynamicClient) => string | undefined;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=getElevatedAccessToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getElevatedAccessToken.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/getElevatedAccessToken/getElevatedAccessToken.ts"],"names":[],"mappings":"AAGA,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,sBAAsB,cACtB,4BAA4B,wDAEtC,MAAM,GAAG,SAiCX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/getElevatedAccessToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { User } from '../user/user.types';
|
|
2
2
|
declare global {
|
|
3
3
|
interface DynamicCoreState {
|
|
4
|
+
/**
|
|
5
|
+
* Array of elevated access tokens with their associated scopes and expiration.
|
|
6
|
+
*
|
|
7
|
+
* When the user authenticates with elevated scopes (e.g., wallet:export),
|
|
8
|
+
* tokens are added to this array. Each token can have multiple scopes.
|
|
9
|
+
* Tokens are removed when consumed or expired.
|
|
10
|
+
*/
|
|
11
|
+
elevatedAccessTokens: Array<{
|
|
12
|
+
expiresAt: Date | null;
|
|
13
|
+
scopes: string[];
|
|
14
|
+
singleUse: boolean;
|
|
15
|
+
token: string;
|
|
16
|
+
}>;
|
|
4
17
|
/**
|
|
5
18
|
* The legacy JWT of the current user.
|
|
6
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,gBAAgB;QACxB;;;;;;;;;WASG;QACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B;;WAEG;QACH,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;QAE9B;;;;;WAKG;QACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB;;WAEG;QACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;KACnB;CACF"}
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,gBAAgB;QACxB;;;;;;WAMG;QACH,oBAAoB,EAAE,KAAK,CAAC;YAC1B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;YACvB,MAAM,EAAE,MAAM,EAAE,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;YACnB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;QAEH;;;;;;;;;WASG;QACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B;;WAEG;QACH,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;QAE9B;;;;;WAKG;QACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB;;WAEG;QACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DynamicCoreState } from '../../../../client/core/types';
|
|
2
|
+
export type ElevatedAccessToken = DynamicCoreState['elevatedAccessTokens'][number];
|
|
3
|
+
export type ParsedElevatedAccessToken = {
|
|
4
|
+
expiresAt: Date;
|
|
5
|
+
normalizedScopes: string[];
|
|
6
|
+
scopes: string[];
|
|
7
|
+
singleUse: boolean;
|
|
8
|
+
token: string;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=elevatedAccessTokens.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevatedAccessTokens.types.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/elevatedAccessTokens.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAC7B,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,IAAI,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes scopes by deduplicating and sorting them.
|
|
3
|
+
* This creates a canonical representation for comparison.
|
|
4
|
+
*
|
|
5
|
+
* @param scopes - Array of scope strings (may contain duplicates)
|
|
6
|
+
* @returns Normalized, sorted array of unique scopes
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizeScopes: (scopes: string[]) => string[];
|
|
9
|
+
//# sourceMappingURL=normalizeScopes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeScopes.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,EAAE,KAAG,MAAM,EAExD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ParsedElevatedAccessToken } from '../elevatedAccessTokens.types';
|
|
2
|
+
/**
|
|
3
|
+
* Validates and parses an elevated access token from a JWT string.
|
|
4
|
+
* Extracts scopes, expiration, and validates the token structure.
|
|
5
|
+
*
|
|
6
|
+
* Policy decisions:
|
|
7
|
+
* - Tokens without scopes are rejected (returns null)
|
|
8
|
+
* - Tokens with empty scopes array are rejected (returns null)
|
|
9
|
+
* - Tokens without exp field are rejected (returns null)
|
|
10
|
+
* - Expired tokens are rejected (returns null)
|
|
11
|
+
*
|
|
12
|
+
* @param token - JWT string containing the elevated access token
|
|
13
|
+
* @param now - Current date for expiration validation (defaults to new Date())
|
|
14
|
+
* @returns Parsed token data or null if token is invalid/expired
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseElevatedAccessToken: (token: string, now?: Date) => ParsedElevatedAccessToken | null;
|
|
17
|
+
//# sourceMappingURL=parseElevatedAccessToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseElevatedAccessToken.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG/E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,UAC5B,MAAM,QACR,IAAI,KACR,yBAAyB,GAAG,IA8B9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ElevatedAccessToken, ParsedElevatedAccessToken } from '../elevatedAccessTokens.types';
|
|
2
|
+
/**
|
|
3
|
+
* Upserts an elevated access token into the current tokens array.
|
|
4
|
+
*
|
|
5
|
+
* Policy: Only one token per normalized scope-set is allowed.
|
|
6
|
+
* If a token with the same normalized scopes exists, it is replaced.
|
|
7
|
+
* This ensures we don't accumulate multiple tokens for the same scope combination.
|
|
8
|
+
*
|
|
9
|
+
* @param currentTokens - Current array of elevated access tokens
|
|
10
|
+
* @param newToken - New token to upsert
|
|
11
|
+
* @returns Updated array of tokens with the new token upserted
|
|
12
|
+
*/
|
|
13
|
+
export declare const upsertElevatedAccessToken: ({ currentTokens, newToken, }: {
|
|
14
|
+
currentTokens: ElevatedAccessToken[];
|
|
15
|
+
newToken: ParsedElevatedAccessToken;
|
|
16
|
+
}) => ElevatedAccessToken[];
|
|
17
|
+
//# sourceMappingURL=upsertElevatedAccessToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsertElevatedAccessToken.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAGvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,iCAGnC;IACD,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,EAAE,yBAAyB,CAAC;CACrC,KAAG,mBAAmB,EAmBtB,CAAC"}
|
package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateAuthFromVerifyResponse.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"updateAuthFromVerifyResponse.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,KAAK,kCAAkC,GAAG;IACxC,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,iBACzB,kCAAkC,UACxC,aAAa,SA4DtB,CAAC"}
|
|
@@ -4,7 +4,7 @@ type DetectDeviceRegistrationRedirectParams = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Detects if the current URL is a device registration redirect.
|
|
6
6
|
*
|
|
7
|
-
* This function uses
|
|
7
|
+
* This function uses getDeviceRegistrationTokenFromUrl to validate the URL and determine
|
|
8
8
|
* if it contains device registration redirect data from a device authentication flow.
|
|
9
9
|
*
|
|
10
10
|
* @returns True if the URL is a device registration redirect, false otherwise.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type GetDeviceRegistrationTokenFromUrlParams = {
|
|
2
2
|
url: string;
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
@@ -10,6 +10,6 @@ type GetDeviceTokenFromUrlParams = {
|
|
|
10
10
|
* @returns The device token as a string if valid.
|
|
11
11
|
* @throws InvalidDeviceRegistrationRedirectError If the URL is not a valid device registration redirect.
|
|
12
12
|
*/
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const getDeviceRegistrationTokenFromUrl: ({ url, }: GetDeviceRegistrationTokenFromUrlParams) => string;
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=getDeviceRegistrationTokenFromUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeviceRegistrationTokenFromUrl.d.ts","sourceRoot":"","sources":["../../../../src/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.ts"],"names":[],"mappings":"AAEA,KAAK,uCAAuC,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,aAE3C,uCAAuC,KAAG,MAkB5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/user/isUserOnboardingComplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the user has completed all onboarding requirements.
|
|
3
|
+
*
|
|
4
|
+
* This function verifies whether a user has fulfilled all necessary requirements
|
|
5
|
+
* including KYC fields (Know Your Customer information) and MFA setup
|
|
6
|
+
* (Multi-Factor Authentication including recovery codes acknowledgment).
|
|
7
|
+
*
|
|
8
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9
|
+
* @returns True if onboarding is complete (no pending requirements), false if there are pending requirements.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isUserOnboardingComplete: (client?: import("../../../exports").DynamicClient) => boolean;
|
|
12
|
+
//# sourceMappingURL=isUserOnboardingComplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUserOnboardingComplete.d.ts","sourceRoot":"","sources":["../../../../src/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,gEAYpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWaasProvider.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/createWaasProvider/createWaasProvider.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BAG5B,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"createWaasProvider.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/createWaasProvider/createWaasProvider.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BAG5B,wBAAwB,KAAG,YAsV7B,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';
|
|
2
2
|
import type { Chain } from '../../chain';
|
|
3
|
+
import type { WalletCreationRequirement } from '../waas.types';
|
|
3
4
|
type CreateWaasWalletAccountsParams = {
|
|
4
5
|
/**
|
|
5
6
|
* For which chains to create wallet accounts.
|
|
7
|
+
* Accepts either an array of chain strings (legacy format) or an array of
|
|
8
|
+
* WalletCreationRequirement objects for chain-specific configuration.
|
|
9
|
+
*
|
|
10
|
+
* For Bitcoin, you can specify the address type ('native_segwit' or 'taproot').
|
|
11
|
+
* If not specified, defaults to 'native_segwit'.
|
|
12
|
+
*
|
|
6
13
|
* If a chain is passed multiple times, just as many wallet accounts will be created
|
|
7
14
|
* for that chain.
|
|
8
15
|
*/
|
|
9
|
-
chains: Chain[];
|
|
16
|
+
chains: Chain[] | WalletCreationRequirement[];
|
|
10
17
|
/**
|
|
11
18
|
* The optional password to use for the wallet accounts.
|
|
12
19
|
* It's used to encrypt the user shares.
|
|
@@ -28,8 +35,24 @@ type CreateWaasWalletAccountsParams = {
|
|
|
28
35
|
*
|
|
29
36
|
* @example
|
|
30
37
|
* ```ts
|
|
31
|
-
* //
|
|
32
|
-
* await createWaasWalletAccounts({ chains: ['EVM', '
|
|
38
|
+
* // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit
|
|
39
|
+
* await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });
|
|
40
|
+
*
|
|
41
|
+
* // New format with chain-specific config
|
|
42
|
+
* await createWaasWalletAccounts({
|
|
43
|
+
* chains: [
|
|
44
|
+
* { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },
|
|
45
|
+
* { chain: 'EVM' },
|
|
46
|
+
* ]
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* // Create both BTC address types
|
|
50
|
+
* await createWaasWalletAccounts({
|
|
51
|
+
* chains: [
|
|
52
|
+
* { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },
|
|
53
|
+
* { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },
|
|
54
|
+
* ]
|
|
55
|
+
* });
|
|
33
56
|
* ```
|
|
34
57
|
*
|
|
35
58
|
* @param params.chains - The chains to create wallet accounts for.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWaasWalletAccounts.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"createWaasWalletAccounts.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAM3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,KAAK,8BAA8B,GAAG;IACpC;;;;;;;;;;OAUG;IACH,MAAM,EAAE,KAAK,EAAE,GAAG,yBAAyB,EAAE,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,wBAAwB,oDAKhC,8BAA8B,wDAEhC,OAAO,CAAC,IAAI,CAwEd,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';
|
|
2
|
+
import type { DynamicClient } from '../../../client/types/DynamicClient';
|
|
3
|
+
import type { WalletAccount } from '../../wallets/walletAccount';
|
|
4
|
+
type GetWalletRecoveryStateParams = {
|
|
5
|
+
walletAccount: WalletAccount;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the recovery state of a WaaS wallet account.
|
|
9
|
+
*
|
|
10
|
+
* @param params.walletAccount - The WaaS wallet account to get the recovery state for.
|
|
11
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
12
|
+
* @returns A promise that resolves with the wallet recovery state.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getWalletRecoveryState: ({ walletAccount }: GetWalletRecoveryStateParams, client?: DynamicClient) => Promise<WalletRecoveryState>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=getWalletRecoveryState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWalletRecoveryState.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,4BAA4B,GAAG;IAClC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,sBACd,4BAA4B,WACvC,aAAa,KACpB,OAAO,CAAC,mBAAmB,CAS7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/getWalletRecoveryState/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Chain } from '../../chain';
|
|
2
|
+
import type { WalletCreationRequirement } from '../waas.types';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if an item is a WalletCreationRequirement object.
|
|
5
|
+
* Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.
|
|
6
|
+
*
|
|
7
|
+
* @param item - The item to check, either a WalletCreationRequirement or Chain string
|
|
8
|
+
* @returns True if the item is a WalletCreationRequirement object
|
|
9
|
+
*/
|
|
10
|
+
export declare const isWalletCreationRequirement: (item: WalletCreationRequirement | Chain) => item is WalletCreationRequirement;
|
|
11
|
+
//# sourceMappingURL=isWalletCreationRequirement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isWalletCreationRequirement.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,SAChC,yBAAyB,GAAG,KAAK,KACtC,IAAI,IAAI,yBACmD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Chain } from '../../chain';
|
|
2
|
+
import type { WalletCreationBitcoinConfig, WalletCreationRequirement } from '../waas.types';
|
|
3
|
+
type NormalizeWalletRequirementsParams = {
|
|
4
|
+
defaultBitcoinConfig?: WalletCreationBitcoinConfig;
|
|
5
|
+
input: WalletCreationRequirement[] | Chain[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes wallet creation input from either legacy Chain[] format
|
|
9
|
+
* or new WalletCreationRequirement[] format to WalletCreationRequirement[].
|
|
10
|
+
*
|
|
11
|
+
* For BTC chains without explicit bitcoinConfig, defaults to native_segwit.
|
|
12
|
+
*
|
|
13
|
+
* @param params.input - Either an array of Chain strings or WalletCreationRequirement objects
|
|
14
|
+
* @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format
|
|
15
|
+
* @returns Array of WalletCreationRequirement objects
|
|
16
|
+
*/
|
|
17
|
+
export declare const normalizeWalletRequirements: ({ defaultBitcoinConfig, input, }: NormalizeWalletRequirementsParams) => WalletCreationRequirement[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=normalizeWalletRequirements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeWalletRequirements.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,eAAe,CAAC;AAIvB,KAAK,iCAAiC,GAAG;IACvC,oBAAoB,CAAC,EAAE,2BAA2B,CAAC;IACnD,KAAK,EAAE,yBAAyB,EAAE,GAAG,KAAK,EAAE,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,qCAGrC,iCAAiC,KAAG,yBAAyB,EA+B/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/unlockWallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GetWalletResponse } from '@dynamic-labs-wallet/browser-wallet-client';
|
|
2
|
+
import type { WalletAccount } from '../../wallets/walletAccount';
|
|
3
|
+
type UnlockWalletParams = {
|
|
4
|
+
password: string;
|
|
5
|
+
walletAccount: WalletAccount;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Unlocks a WaaS wallet account.
|
|
9
|
+
*
|
|
10
|
+
* @param params.walletAccount - The WaaS wallet account to unlock.
|
|
11
|
+
* @param params.password - The password to unlock the wallet.
|
|
12
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
13
|
+
* @returns A promise that resolves with the wallet information.
|
|
14
|
+
*/
|
|
15
|
+
export declare const unlockWallet: ({ password, walletAccount }: UnlockWalletParams, client?: import("../../../exports").DynamicClient) => Promise<GetWalletResponse>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=unlockWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unlockWallet.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/unlockWallet/unlockWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,gCACM,kBAAkB,wDAE9C,OAAO,CAAC,iBAAiB,CAU3B,CAAC"}
|