@dynamic-labs-sdk/client 1.30.2 → 1.31.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/{updateAuthFromVerifyResponse-CTvWpZLa.native.esm.js → apiClient-DpzKqY39.native.esm.js} +557 -465
- package/dist/apiClient-DpzKqY39.native.esm.js.map +1 -0
- package/dist/client/types/DynamicClient.d.ts +1 -1
- package/dist/client/types/DynamicClient.d.ts.map +1 -1
- package/dist/core.cjs +121 -61
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +64 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +64 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/WaasRbacStaleRetryUnsafeError.d.ts +36 -0
- package/dist/errors/WaasRbacStaleRetryUnsafeError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +6 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +16 -4
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +3 -2
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CamHn2s3.esm.js → getNetworkProviderFromNetworkId-BN2jUhHm.esm.js} +8 -3
- package/dist/getNetworkProviderFromNetworkId-BN2jUhHm.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-igDf2OPy.cjs → getNetworkProviderFromNetworkId-BoNAPSjx.cjs} +62 -51
- package/dist/getNetworkProviderFromNetworkId-BoNAPSjx.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId--X0cb1ad.native.esm.js → getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js} +9 -4
- package/dist/getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-DGa_pu-i.cjs → getSignedSessionId-9ADIJCl1.cjs} +11 -11
- package/dist/{getSignedSessionId-DGa_pu-i.cjs.map → getSignedSessionId-9ADIJCl1.cjs.map} +1 -1
- package/dist/{getSignedSessionId--XNTxNFo.native.esm.js → getSignedSessionId-Dr4Ic68X.native.esm.js} +3 -3
- package/dist/{getSignedSessionId--XNTxNFo.native.esm.js.map → getSignedSessionId-Dr4Ic68X.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DY-ietfO.esm.js → getSignedSessionId-DxpqG4pv.esm.js} +3 -3
- package/dist/{getSignedSessionId-DY-ietfO.esm.js.map → getSignedSessionId-DxpqG4pv.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-DzpmoNlv.cjs → getVerifiedCredentialForWalletAccount-C2o5idph.cjs} +10 -10
- package/dist/getVerifiedCredentialForWalletAccount-C2o5idph.cjs.map +1 -0
- package/dist/{getWalletProviderByKey-xqyD3ybv.esm.js → getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js} +10 -10
- package/dist/getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js.map +1 -0
- package/dist/index.cjs +677 -672
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +47 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +47 -23
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-CatS60F6.esm.js → isMfaRequiredForAction-BIBmJbV9.esm.js} +2 -2
- package/dist/isMfaRequiredForAction-BIBmJbV9.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-BcJvy7Gw.native.esm.js → isMfaRequiredForAction-DuSU67yq.native.esm.js} +2 -2
- package/dist/isMfaRequiredForAction-DuSU67yq.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-DKfoMhEk.cjs → isMfaRequiredForAction-yM84r7l7.cjs} +11 -11
- package/dist/isMfaRequiredForAction-yM84r7l7.cjs.map +1 -0
- package/dist/{isUserOnboardingComplete-BWVuE4Jg.native.esm.js → isUserOnboardingComplete-B2Ha2dkP.esm.js} +47 -4
- package/dist/isUserOnboardingComplete-B2Ha2dkP.esm.js.map +1 -0
- package/dist/{isUserOnboardingComplete-jv_idxWY.cjs → isUserOnboardingComplete-BRTOnK8V.cjs} +63 -14
- package/dist/isUserOnboardingComplete-BRTOnK8V.cjs.map +1 -0
- package/dist/{isUserOnboardingComplete-jkAQQVdP.esm.js → isUserOnboardingComplete-DCIlkCub.native.esm.js} +47 -4
- package/dist/isUserOnboardingComplete-DCIlkCub.native.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-BLgNMqwN.esm.js → logoutWithReason-DV89zJmJ.esm.js} +679 -587
- package/dist/logoutWithReason-DV89zJmJ.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-Dsw-eAro.cjs → logoutWithReason-DlA15deT.cjs} +691 -587
- package/dist/logoutWithReason-DlA15deT.cjs.map +1 -0
- package/dist/{getWalletProviderByKey-Cl6WDOoD.native.esm.js → logoutWithReason-HqGlUccb.native.esm.js} +19 -19
- package/dist/logoutWithReason-HqGlUccb.native.esm.js.map +1 -0
- package/dist/migrateFromFireblocks-CiOS4_Nq.esm.js +128 -0
- package/dist/migrateFromFireblocks-CiOS4_Nq.esm.js.map +1 -0
- package/dist/migrateFromFireblocks-CqIpxGRS.cjs +163 -0
- package/dist/migrateFromFireblocks-CqIpxGRS.cjs.map +1 -0
- package/dist/migrateFromFireblocks-DnQsGmIW.native.esm.js +128 -0
- package/dist/migrateFromFireblocks-DnQsGmIW.native.esm.js.map +1 -0
- package/dist/modules/apiClient/apiClient.types.d.ts +1 -1
- package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/apiClient/utils/rbacStaleMiddleware/createRbacStaleMiddleware.d.ts +10 -0
- package/dist/modules/apiClient/utils/rbacStaleMiddleware/createRbacStaleMiddleware.d.ts.map +1 -0
- package/dist/modules/auth/auth.types.d.ts +45 -0
- package/dist/modules/auth/auth.types.d.ts.map +1 -0
- package/dist/modules/auth/checkStepUpAuth/checkStepUpAuth.d.ts +2 -1
- package/dist/modules/auth/checkStepUpAuth/checkStepUpAuth.d.ts.map +1 -1
- package/dist/modules/auth/consts.d.ts +9 -0
- package/dist/modules/auth/consts.d.ts.map +1 -1
- package/dist/modules/auth/createVisit/createVisit.d.ts.map +1 -1
- package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts +1 -1
- package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts.map +1 -1
- package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts +1 -1
- package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts.map +1 -1
- package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts +2 -1
- package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts.map +1 -1
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts +4 -3
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/getPasskeys/getPasskeys.d.ts +1 -1
- package/dist/modules/auth/passkeys/getPasskeys/getPasskeys.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +2 -1
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts +3 -1
- package/dist/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts +2 -1
- package/dist/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +1 -1
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts +1 -1
- package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.types.d.ts +1 -1
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.types.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts +1 -1
- package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts +1 -1
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +1 -1
- package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
- package/dist/modules/balances/balances.types.d.ts +59 -0
- package/dist/modules/balances/balances.types.d.ts.map +1 -0
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts +1 -1
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts.map +1 -1
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts +1 -1
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts.map +1 -1
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts +1 -1
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/checkout.types.d.ts +10 -2
- package/dist/modules/checkout/checkout.types.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts +1 -1
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/deviceRegistration.types.d.ts +9 -0
- package/dist/modules/deviceRegistration/deviceRegistration.types.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts +1 -1
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/coinbase.types.d.ts +2 -40
- package/dist/modules/funding/coinbase/coinbase.types.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts +1 -1
- package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts.map +1 -1
- package/dist/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts +2 -2
- package/dist/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts.map +1 -1
- package/dist/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts +2 -2
- package/dist/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts.map +1 -1
- package/dist/modules/funding/funding.types.d.ts +26 -0
- package/dist/modules/funding/funding.types.d.ts.map +1 -0
- package/dist/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.d.ts +4 -4
- package/dist/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.d.ts.map +1 -1
- package/dist/modules/mfa/authenticateMfaRecoveryCode/authenticateMfaRecoveryCode.d.ts +3 -1
- package/dist/modules/mfa/authenticateMfaRecoveryCode/authenticateMfaRecoveryCode.d.ts.map +1 -1
- package/dist/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts +3 -1
- package/dist/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts.map +1 -1
- package/dist/modules/mfa/authenticateTotpMfaDevice/authenticateTotpMfaDevice.d.ts +3 -1
- package/dist/modules/mfa/authenticateTotpMfaDevice/authenticateTotpMfaDevice.d.ts.map +1 -1
- package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +1 -1
- package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
- package/dist/modules/mfa/getMfaDevices/getMfaDevices.d.ts +1 -1
- package/dist/modules/mfa/getMfaDevices/getMfaDevices.d.ts.map +1 -1
- package/dist/modules/mfa/getMfaMethods/getMfaMethods.d.ts +1 -1
- package/dist/modules/mfa/getMfaMethods/getMfaMethods.d.ts.map +1 -1
- package/dist/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts +1 -1
- package/dist/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts.map +1 -1
- package/dist/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.d.ts +1 -1
- package/dist/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.d.ts.map +1 -1
- package/dist/modules/mfa/mfa.consts.d.ts +10 -0
- package/dist/modules/mfa/mfa.consts.d.ts.map +1 -0
- package/dist/modules/mfa/mfa.types.d.ts +66 -1
- package/dist/modules/mfa/mfa.types.d.ts.map +1 -1
- package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts +1 -1
- package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +2 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts.map +1 -1
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +1 -1
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
- package/dist/modules/projectSettings/projectSettings.types.d.ts +15 -0
- package/dist/modules/projectSettings/projectSettings.types.d.ts.map +1 -0
- package/dist/modules/simulation/simulation.types.d.ts +27 -1
- package/dist/modules/simulation/simulation.types.d.ts.map +1 -1
- package/dist/modules/storageSync/schema.d.ts +2 -2
- package/dist/modules/storageSync/schema.d.ts.map +1 -1
- package/dist/modules/swap/swap.types.d.ts +15 -2
- package/dist/modules/swap/swap.types.d.ts.map +1 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts +2 -2
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/user/refreshUser/refreshUser.d.ts +3 -3
- package/dist/modules/user/refreshUser/refreshUser.d.ts.map +1 -1
- package/dist/modules/user/user.consts.d.ts +19 -0
- package/dist/modules/user/user.consts.d.ts.map +1 -0
- package/dist/modules/user/user.types.d.ts +22 -2
- package/dist/modules/user/user.types.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +4 -2
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +1 -1
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/getWalletAccountShareSets/getWalletAccountShareSets.d.ts +2 -2
- package/dist/modules/waas/getWalletAccountShareSets/getWalletAccountShareSets.d.ts.map +1 -1
- package/dist/modules/waas/injectWaasVerifiedCredentialFields/injectWaasVerifiedCredentialFields.d.ts +3 -1
- package/dist/modules/waas/injectWaasVerifiedCredentialFields/injectWaasVerifiedCredentialFields.d.ts.map +1 -1
- package/dist/modules/waas/policies/applyPolicyLayerBatch/applyPolicyLayerBatch.d.ts +2 -1
- package/dist/modules/waas/policies/applyPolicyLayerBatch/applyPolicyLayerBatch.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildAllowAddressesRule/buildAllowAddressesRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildAllowAddressesRule/buildAllowAddressesRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildAllowPolicyRule/buildAllowPolicyRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildAllowPolicyRule/buildAllowPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildBlockExportRule/buildBlockExportRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildBlockExportRule/buildBlockExportRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildDenyAddressesRule/buildDenyAddressesRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildDenyAddressesRule/buildDenyAddressesRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildDenyPolicyRule/buildDenyPolicyRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildDenyPolicyRule/buildDenyPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildMaxAmountPerTransactionRule/buildMaxAmountPerTransactionRule.d.ts +1 -2
- package/dist/modules/waas/policies/buildMaxAmountPerTransactionRule/buildMaxAmountPerTransactionRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildOperationForExistingRule/buildOperationForExistingRule.d.ts +3 -2
- package/dist/modules/waas/policies/buildOperationForExistingRule/buildOperationForExistingRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/buildOperationsForRule/buildOperationsForRule.d.ts +2 -2
- package/dist/modules/waas/policies/buildOperationsForRule/buildOperationsForRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/createPolicy/createPolicy.d.ts +2 -1
- package/dist/modules/waas/policies/createPolicy/createPolicy.d.ts.map +1 -1
- package/dist/modules/waas/policies/desugarPolicyRules/desugarPolicyRules.d.ts +1 -2
- package/dist/modules/waas/policies/desugarPolicyRules/desugarPolicyRules.d.ts.map +1 -1
- package/dist/modules/waas/policies/expandPolicyRules/expandPolicyRules.d.ts +2 -2
- package/dist/modules/waas/policies/expandPolicyRules/expandPolicyRules.d.ts.map +1 -1
- package/dist/modules/waas/policies/fillOmittedRuleValues/fillOmittedRuleValues.d.ts +1 -2
- package/dist/modules/waas/policies/fillOmittedRuleValues/fillOmittedRuleValues.d.ts.map +1 -1
- package/dist/modules/waas/policies/findMatchedRuleKind/findMatchedRuleKind.d.ts +1 -2
- package/dist/modules/waas/policies/findMatchedRuleKind/findMatchedRuleKind.d.ts.map +1 -1
- package/dist/modules/waas/policies/getAccountPolicyLayer/getAccountPolicyLayer.d.ts +1 -1
- package/dist/modules/waas/policies/getAccountPolicyLayer/getAccountPolicyLayer.d.ts.map +1 -1
- package/dist/modules/waas/policies/getPolicy/getPolicy.d.ts +2 -2
- package/dist/modules/waas/policies/getPolicy/getPolicy.d.ts.map +1 -1
- package/dist/modules/waas/policies/getResolvedPolicyLayer/getResolvedPolicyLayer.d.ts +1 -1
- package/dist/modules/waas/policies/getResolvedPolicyLayer/getResolvedPolicyLayer.d.ts.map +1 -1
- package/dist/modules/waas/policies/getSignerPolicyLayer/getSignerPolicyLayer.d.ts +1 -1
- package/dist/modules/waas/policies/getSignerPolicyLayer/getSignerPolicyLayer.d.ts.map +1 -1
- package/dist/modules/waas/policies/getWalletPolicyLayer/getWalletPolicyLayer.d.ts +1 -1
- package/dist/modules/waas/policies/getWalletPolicyLayer/getWalletPolicyLayer.d.ts.map +1 -1
- package/dist/modules/waas/policies/hasAddresses/hasAddresses.d.ts +1 -1
- package/dist/modules/waas/policies/hasAddresses/hasAddresses.d.ts.map +1 -1
- package/dist/modules/waas/policies/hasUnrecognizedFields/hasUnrecognizedFields.d.ts +1 -1
- package/dist/modules/waas/policies/hasUnrecognizedFields/hasUnrecognizedFields.d.ts.map +1 -1
- package/dist/modules/waas/policies/isPolicyRuleDeletionMarker/isPolicyRuleDeletionMarker.d.ts +1 -2
- package/dist/modules/waas/policies/isPolicyRuleDeletionMarker/isPolicyRuleDeletionMarker.d.ts.map +1 -1
- package/dist/modules/waas/policies/matchExistingRules/matchExistingRules.d.ts +1 -1
- package/dist/modules/waas/policies/matchExistingRules/matchExistingRules.d.ts.map +1 -1
- package/dist/modules/waas/policies/policies.types.d.ts +17 -1
- package/dist/modules/waas/policies/policies.types.d.ts.map +1 -1
- package/dist/modules/waas/policies/policyRuleKinds.d.ts +1 -2
- package/dist/modules/waas/policies/policyRuleKinds.d.ts.map +1 -1
- package/dist/modules/waas/policies/readAllowAddressesRule/readAllowAddressesRule.d.ts +1 -2
- package/dist/modules/waas/policies/readAllowAddressesRule/readAllowAddressesRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/readBlockExportRule/readBlockExportRule.d.ts +1 -2
- package/dist/modules/waas/policies/readBlockExportRule/readBlockExportRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/readCoveredRule/readCoveredRule.d.ts +1 -2
- package/dist/modules/waas/policies/readCoveredRule/readCoveredRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/readDenyAddressesRule/readDenyAddressesRule.d.ts +1 -2
- package/dist/modules/waas/policies/readDenyAddressesRule/readDenyAddressesRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/readMaxAmountPerTransactionRule/readMaxAmountPerTransactionRule.d.ts +1 -2
- package/dist/modules/waas/policies/readMaxAmountPerTransactionRule/readMaxAmountPerTransactionRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/removeAccountPolicyRule/removeAccountPolicyRule.d.ts +1 -1
- package/dist/modules/waas/policies/removeAccountPolicyRule/removeAccountPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/removePolicyRules/removePolicyRules.d.ts +2 -1
- package/dist/modules/waas/policies/removePolicyRules/removePolicyRules.d.ts.map +1 -1
- package/dist/modules/waas/policies/removeSignerPolicyRule/removeSignerPolicyRule.d.ts +1 -1
- package/dist/modules/waas/policies/removeSignerPolicyRule/removeSignerPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/removeWalletPolicyRule/removeWalletPolicyRule.d.ts +1 -1
- package/dist/modules/waas/policies/removeWalletPolicyRule/removeWalletPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/resolveRuleName/resolveRuleName.d.ts +1 -2
- package/dist/modules/waas/policies/resolveRuleName/resolveRuleName.d.ts.map +1 -1
- package/dist/modules/waas/policies/sortRulesByRuleId/sortRulesByRuleId.d.ts +1 -1
- package/dist/modules/waas/policies/sortRulesByRuleId/sortRulesByRuleId.d.ts.map +1 -1
- package/dist/modules/waas/policies/upsertAccountPolicyRule/upsertAccountPolicyRule.d.ts +2 -1
- package/dist/modules/waas/policies/upsertAccountPolicyRule/upsertAccountPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/upsertSignerPolicyRule/upsertSignerPolicyRule.d.ts +2 -1
- package/dist/modules/waas/policies/upsertSignerPolicyRule/upsertSignerPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/policies/upsertWalletPolicyRule/upsertWalletPolicyRule.d.ts +2 -1
- package/dist/modules/waas/policies/upsertWalletPolicyRule/upsertWalletPolicyRule.d.ts.map +1 -1
- package/dist/modules/waas/waas.consts.d.ts +23 -0
- package/dist/modules/waas/waas.consts.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +30 -1
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts +2 -2
- package/dist/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts +2 -2
- package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts.map +1 -1
- package/dist/modules/wallets/screenTransaction/screenTransaction.d.ts +1 -1
- package/dist/modules/wallets/screenTransaction/screenTransaction.d.ts.map +1 -1
- package/dist/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.d.ts +2 -2
- package/dist/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.d.ts.map +1 -1
- package/dist/modules/wallets/userHasExternalWallet/userHasExternalWallet.d.ts +2 -2
- package/dist/modules/wallets/userHasExternalWallet/userHasExternalWallet.d.ts.map +1 -1
- package/dist/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts +1 -1
- package/dist/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts.map +1 -1
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts +5 -3
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +1 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts +1 -1
- package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts.map +1 -1
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +4 -2
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/modules/wallets/wallets.types.d.ts +47 -0
- package/dist/modules/wallets/wallets.types.d.ts.map +1 -0
- package/dist/modules/yield/yield.types.d.ts +8 -0
- package/dist/modules/yield/yield.types.d.ts.map +1 -1
- package/dist/services/eventEmitter/createEventEmitter.d.ts +3 -2
- package/dist/services/eventEmitter/createEventEmitter.d.ts.map +1 -1
- package/dist/services/eventEmitter/index.d.ts +1 -1
- package/dist/services/eventEmitter/index.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts +52 -0
- package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts.map +1 -0
- package/dist/utils/createSequenceQueue/index.d.ts +3 -0
- package/dist/utils/createSequenceQueue/index.d.ts.map +1 -0
- package/dist/waas-BOKafCeH.cjs +2467 -0
- package/dist/waas-BOKafCeH.cjs.map +1 -0
- package/dist/waas-CUDgU2pl.esm.js +2150 -0
- package/dist/waas-CUDgU2pl.esm.js.map +1 -0
- package/dist/waas-CkQYVo6U.native.esm.js +2150 -0
- package/dist/waas-CkQYVo6U.native.esm.js.map +1 -0
- package/dist/waas.cjs +60 -2185
- package/dist/waas.esm.js +5 -2126
- package/dist/waas.native.esm.js +5 -2126
- package/dist/waasCore.cjs +76 -44
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +56 -24
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +56 -24
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +5 -5
- package/dist/getNetworkProviderFromNetworkId--X0cb1ad.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CamHn2s3.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-igDf2OPy.cjs.map +0 -1
- package/dist/getWalletProviderByKey-Cl6WDOoD.native.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-DzpmoNlv.cjs.map +0 -1
- package/dist/getWalletProviderByKey-xqyD3ybv.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-CMccs1-6.cjs +0 -136
- package/dist/isDynamicWaasEnabled-CMccs1-6.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-DSqgpEcX.native.esm.js +0 -113
- package/dist/isDynamicWaasEnabled-DSqgpEcX.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-DYORq7Jc.esm.js +0 -113
- package/dist/isDynamicWaasEnabled-DYORq7Jc.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-BcJvy7Gw.native.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-CatS60F6.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-DKfoMhEk.cjs.map +0 -1
- package/dist/isUserOnboardingComplete-BWVuE4Jg.native.esm.js.map +0 -1
- package/dist/isUserOnboardingComplete-jkAQQVdP.esm.js.map +0 -1
- package/dist/isUserOnboardingComplete-jv_idxWY.cjs.map +0 -1
- package/dist/migrateFromFireblocks-B-WUs34v.native.esm.js +0 -65
- package/dist/migrateFromFireblocks-B-WUs34v.native.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-D4E9bT2H.esm.js +0 -65
- package/dist/migrateFromFireblocks-D4E9bT2H.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-zp5Jbq2J.cjs +0 -82
- package/dist/migrateFromFireblocks-zp5Jbq2J.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-BLgNMqwN.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-CTvWpZLa.native.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-Dsw-eAro.cjs.map +0 -1
- package/dist/waas.cjs.map +0 -1
- package/dist/waas.esm.js.map +0 -1
- package/dist/waas.native.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthStorageEnum, Configuration, JwtVerifiedCredentialFormatEnum, SDKApi, WalletProviderEnum, isDeviceNonceSignatureRequiredForUrl } from "@dynamic-labs/sdk-api-core";
|
|
1
|
+
import { AuthStorageEnum, Configuration, JwtVerifiedCredentialFormatEnum, SDKApi, TokenScope, WalletProviderEnum, isDeviceNonceSignatureRequiredForUrl } from "@dynamic-labs/sdk-api-core";
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
3
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
4
|
import { getGenericPassword, resetGenericPassword, setGenericPassword } from "react-native-keychain";
|
|
@@ -6,14 +6,18 @@ import { Platform } from "react-native";
|
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
8
|
var name = "@dynamic-labs-sdk/client";
|
|
9
|
-
var version = "1.
|
|
9
|
+
var version = "1.31.0";
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region src/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
//#region src/modules/auth/consts.ts
|
|
13
|
+
const DYNAMIC_AUTH_COOKIE_NAME = "DYNAMIC_JWT_TOKEN";
|
|
14
|
+
/**
|
|
15
|
+
* Lists the scopes accepted by authentication and step-up APIs.
|
|
16
|
+
*
|
|
17
|
+
* @see authenticateTotpMfaDevice
|
|
18
|
+
* @see checkStepUpAuth
|
|
19
|
+
*/
|
|
20
|
+
const TokenScope$1 = TokenScope;
|
|
17
21
|
|
|
18
22
|
//#endregion
|
|
19
23
|
//#region src/errors/base/BaseError.ts
|
|
@@ -78,6 +82,13 @@ var BaseError = class BaseError extends Error {
|
|
|
78
82
|
}
|
|
79
83
|
};
|
|
80
84
|
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/client/core/getCore/getCore.ts
|
|
87
|
+
/** @notInstrumented */
|
|
88
|
+
const getCore = (client) => {
|
|
89
|
+
return client.__core;
|
|
90
|
+
};
|
|
91
|
+
|
|
81
92
|
//#endregion
|
|
82
93
|
//#region src/errors/ClientNotFoundError.ts
|
|
83
94
|
var ClientNotFoundError = class extends BaseError {
|
|
@@ -125,11 +136,6 @@ const setDefaultClient = (client) => {
|
|
|
125
136
|
numOfInitializedClients++;
|
|
126
137
|
};
|
|
127
138
|
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/utils/getNonce/constants.ts
|
|
130
|
-
const NONCE_POOL_EXPIRATION_TIME = 6e4 * 60 * 24;
|
|
131
|
-
const NONCE_POOL_SIZE = 5;
|
|
132
|
-
|
|
133
139
|
//#endregion
|
|
134
140
|
//#region src/utils/getPlatform/getPlatform.native.ts
|
|
135
141
|
/**
|
|
@@ -258,7 +264,7 @@ const getSessionKeys = (client) => {
|
|
|
258
264
|
|
|
259
265
|
//#endregion
|
|
260
266
|
//#region src/generated/dependencyCatalog.ts
|
|
261
|
-
const dependencyCatalog = { "@dynamic-labs/sdk-api-core": "0.
|
|
267
|
+
const dependencyCatalog = { "@dynamic-labs/sdk-api-core": "0.25.0" };
|
|
262
268
|
|
|
263
269
|
//#endregion
|
|
264
270
|
//#region src/constants.ts
|
|
@@ -537,6 +543,11 @@ const createBaseApiClient = ({ middleware = [], options = {} }, client) => {
|
|
|
537
543
|
}));
|
|
538
544
|
};
|
|
539
545
|
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/utils/getNonce/constants.ts
|
|
548
|
+
const NONCE_POOL_EXPIRATION_TIME = 6e4 * 60 * 24;
|
|
549
|
+
const NONCE_POOL_SIZE = 5;
|
|
550
|
+
|
|
540
551
|
//#endregion
|
|
541
552
|
//#region src/services/storage/createLocalStorageAdapter/createLocalStorageAdapter.native.ts
|
|
542
553
|
const NAMESPACE = "dynamic";
|
|
@@ -665,38 +676,6 @@ const fetchAndStoreNonces = async (client) => {
|
|
|
665
676
|
return fetchPromise;
|
|
666
677
|
};
|
|
667
678
|
|
|
668
|
-
//#endregion
|
|
669
|
-
//#region src/utils/getSecureCookieAttribute/getSecureCookieAttribute.ts
|
|
670
|
-
/**
|
|
671
|
-
* Returns the cookie `Secure` attribute suffix (`'; Secure'`) when the current
|
|
672
|
-
* document is running in a secure context, or an empty string otherwise.
|
|
673
|
-
*
|
|
674
|
-
* The `Secure` attribute prevents the browser from ever transmitting the cookie
|
|
675
|
-
* over an unencrypted `http://` connection, which mitigates cleartext token
|
|
676
|
-
* capture (CWE-614). It is intentionally omitted on insecure/localhost dev,
|
|
677
|
-
* because browsers reject `Secure` cookies set over `http://` and that would
|
|
678
|
-
* silently break local testing.
|
|
679
|
-
*
|
|
680
|
-
* Used when building the Dynamic auth JWT cookie string so the attribute is
|
|
681
|
-
* applied consistently on both the write (sign-in/refresh) and clear (logout)
|
|
682
|
-
* paths.
|
|
683
|
-
*
|
|
684
|
-
* @notInstrumented
|
|
685
|
-
*/
|
|
686
|
-
const getSecureCookieAttribute = () => {
|
|
687
|
-
return Boolean(globalThis.window?.isSecureContext) || globalThis.location?.protocol === "https:" ? "; Secure" : "";
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
//#endregion
|
|
691
|
-
//#region src/utils/setCookie/setCookie.ts
|
|
692
|
-
/**
|
|
693
|
-
* Sefelly sets the cookie in the browser.
|
|
694
|
-
* @notInstrumented
|
|
695
|
-
*/
|
|
696
|
-
const setCookie = (cookie) => {
|
|
697
|
-
document.cookie = cookie;
|
|
698
|
-
};
|
|
699
|
-
|
|
700
679
|
//#endregion
|
|
701
680
|
//#region src/utils/getNonce/getNonce.ts
|
|
702
681
|
/**
|
|
@@ -800,125 +779,54 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
|
|
|
800
779
|
};
|
|
801
780
|
|
|
802
781
|
//#endregion
|
|
803
|
-
//#region src/
|
|
804
|
-
/**
|
|
805
|
-
* Returns a new instance of the SDK API client.
|
|
806
|
-
*
|
|
807
|
-
* This is not meant for storing, as it is very light we can create it whenever needed.
|
|
808
|
-
* @notInstrumented
|
|
809
|
-
*/
|
|
810
|
-
const createApiClient = (options = {}, client) => {
|
|
811
|
-
return createBaseApiClient({
|
|
812
|
-
middleware: [createDeviceSignatureHeadersMiddleware(client)],
|
|
813
|
-
options
|
|
814
|
-
}, client);
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
//#endregion
|
|
818
|
-
//#region src/modules/clientEvents/clientEvents.ts
|
|
782
|
+
//#region src/utils/getSecureCookieAttribute/getSecureCookieAttribute.ts
|
|
819
783
|
/**
|
|
820
|
-
*
|
|
821
|
-
*
|
|
822
|
-
* This function allows you to listen for various events emitted by the Dynamic client,
|
|
823
|
-
* such as authentication state changes, wallet connections, and more.
|
|
784
|
+
* Returns the cookie `Secure` attribute suffix (`'; Secure'`) when the current
|
|
785
|
+
* document is running in a secure context, or an empty string otherwise.
|
|
824
786
|
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
* console.log('Wallet added:', walletAccount.address);
|
|
831
|
-
* },
|
|
832
|
-
* });
|
|
787
|
+
* The `Secure` attribute prevents the browser from ever transmitting the cookie
|
|
788
|
+
* over an unencrypted `http://` connection, which mitigates cleartext token
|
|
789
|
+
* capture (CWE-614). It is intentionally omitted on insecure/localhost dev,
|
|
790
|
+
* because browsers reject `Secure` cookies set over `http://` and that would
|
|
791
|
+
* silently break local testing.
|
|
833
792
|
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
793
|
+
* Used when building the Dynamic auth JWT cookie string so the attribute is
|
|
794
|
+
* applied consistently on both the write (sign-in/refresh) and clear (logout)
|
|
795
|
+
* paths.
|
|
837
796
|
*
|
|
838
|
-
* @param params.event - The event name to listen for.
|
|
839
|
-
* @param params.listener - The callback function to execute when the event is fired.
|
|
840
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
841
|
-
* @returns A function that can be called to remove the listener.
|
|
842
|
-
* @see offEvent
|
|
843
|
-
* @see onceEvent
|
|
844
797
|
* @notInstrumented
|
|
845
|
-
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
846
798
|
*/
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
eventEmitter.on(event, listener);
|
|
850
|
-
return () => {
|
|
851
|
-
eventEmitter.off(event, listener);
|
|
852
|
-
};
|
|
799
|
+
const getSecureCookieAttribute = () => {
|
|
800
|
+
return Boolean(globalThis.window?.isSecureContext) || globalThis.location?.protocol === "https:" ? "; Secure" : "";
|
|
853
801
|
};
|
|
802
|
+
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/utils/setCookie/setCookie.ts
|
|
854
805
|
/**
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* This function unsubscribes a previously registered event listener
|
|
858
|
-
* from the specified Dynamic client event.
|
|
859
|
-
*
|
|
860
|
-
* @example
|
|
861
|
-
* ```ts
|
|
862
|
-
* offEvent({ event: 'walletAdded', listener: myListener });
|
|
863
|
-
* ```
|
|
864
|
-
*
|
|
865
|
-
* @param params.event - The event name to remove the listener from.
|
|
866
|
-
* @param params.listener - The callback function to remove.
|
|
867
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
868
|
-
* @see onEvent
|
|
869
|
-
* @see onceEvent
|
|
806
|
+
* Sefelly sets the cookie in the browser.
|
|
870
807
|
* @notInstrumented
|
|
871
808
|
*/
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
eventEmitter.off(event, listener);
|
|
809
|
+
const setCookie = (cookie) => {
|
|
810
|
+
document.cookie = cookie;
|
|
875
811
|
};
|
|
812
|
+
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.ts
|
|
876
815
|
/**
|
|
877
|
-
*
|
|
878
|
-
*
|
|
879
|
-
* This function listens for an event that will automatically remove itself
|
|
880
|
-
* after being triggered once.
|
|
816
|
+
* Checks if the user requires additional MFA authentication.
|
|
881
817
|
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
* onceEvent({
|
|
885
|
-
* event: 'logout',
|
|
886
|
-
* listener: () => {
|
|
887
|
-
* console.log('User logged out');
|
|
888
|
-
* },
|
|
889
|
-
* });
|
|
890
|
-
* ```
|
|
818
|
+
* This function determines if the current user session requires
|
|
819
|
+
* additional multi-factor authentication to access certain features.
|
|
891
820
|
*
|
|
892
|
-
* @param params.event - The event name to listen for.
|
|
893
|
-
* @param params.listener - The callback function to execute when the event is fired.
|
|
894
821
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
895
|
-
* @returns
|
|
896
|
-
* @see onEvent
|
|
897
|
-
* @see offEvent
|
|
898
|
-
* @notInstrumented
|
|
899
|
-
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
900
|
-
*/
|
|
901
|
-
const onceEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
902
|
-
const { eventEmitter } = getCore(client);
|
|
903
|
-
eventEmitter.once(event, listener);
|
|
904
|
-
return () => {
|
|
905
|
-
eventEmitter.off(event, listener);
|
|
906
|
-
};
|
|
907
|
-
};
|
|
908
|
-
/**
|
|
909
|
-
* Emits a Dynamic client event.
|
|
910
|
-
*
|
|
911
|
-
* This function triggers an event that will be received by all registered
|
|
912
|
-
* listeners for the specified event type.
|
|
913
|
-
*
|
|
914
|
-
* @param params.event - The event name to emit.
|
|
915
|
-
* @param params.args - The arguments to pass to event listeners.
|
|
916
|
-
* @param client - The Dynamic client instance.
|
|
822
|
+
* @returns True if the user needs additional MFA authentication, false otherwise.
|
|
917
823
|
* @notInstrumented
|
|
824
|
+
* @hook Exposed as a hook so consumers reactively know when MFA is still required, updated when the user changes.
|
|
918
825
|
*/
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
|
|
826
|
+
const isUserMissingMfaAuth = (client = getDefaultClient()) => {
|
|
827
|
+
const user = client.user;
|
|
828
|
+
assertDefined(user, "User not logged in");
|
|
829
|
+
return Boolean(user.scope?.includes("requiresAdditionalAuth"));
|
|
922
830
|
};
|
|
923
831
|
|
|
924
832
|
//#endregion
|
|
@@ -1263,20 +1171,6 @@ const getWalletAccounts = (client = getDefaultClient()) => {
|
|
|
1263
1171
|
}, client);
|
|
1264
1172
|
};
|
|
1265
1173
|
|
|
1266
|
-
//#endregion
|
|
1267
|
-
//#region src/errors/NoWalletProviderFoundError.ts
|
|
1268
|
-
var NoWalletProviderFoundError = class extends BaseError {
|
|
1269
|
-
constructor({ walletProviderKey }) {
|
|
1270
|
-
super({
|
|
1271
|
-
cause: null,
|
|
1272
|
-
code: "no_wallet_provider_found_error",
|
|
1273
|
-
docsUrl: null,
|
|
1274
|
-
name: "NoWalletProviderFoundError",
|
|
1275
|
-
shortMessage: `No wallet provider found with key: ${walletProviderKey}`
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
};
|
|
1279
|
-
|
|
1280
1174
|
//#endregion
|
|
1281
1175
|
//#region src/services/runtimeServices/createRuntimeServiceAccessKey/createRuntimeServiceAccessKey.ts
|
|
1282
1176
|
/**
|
|
@@ -1299,46 +1193,153 @@ const createRuntimeServiceAccessKey = (key, builder) => (client) => {
|
|
|
1299
1193
|
};
|
|
1300
1194
|
|
|
1301
1195
|
//#endregion
|
|
1302
|
-
//#region src/modules/
|
|
1196
|
+
//#region src/modules/clientEvents/clientEvents.ts
|
|
1303
1197
|
/**
|
|
1304
|
-
*
|
|
1198
|
+
* Adds an event listener for Dynamic client events.
|
|
1305
1199
|
*
|
|
1306
|
-
*
|
|
1200
|
+
* This function allows you to listen for various events emitted by the Dynamic client,
|
|
1201
|
+
* such as authentication state changes, wallet connections, and more.
|
|
1307
1202
|
*
|
|
1308
1203
|
* @example
|
|
1309
|
-
* ```
|
|
1310
|
-
* const
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
1204
|
+
* ```ts
|
|
1205
|
+
* const unsubscribe = onEvent({
|
|
1206
|
+
* event: 'walletAdded',
|
|
1207
|
+
* listener: ({ walletAccount }) => {
|
|
1208
|
+
* console.log('Wallet added:', walletAccount.address);
|
|
1209
|
+
* },
|
|
1315
1210
|
* });
|
|
1316
1211
|
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1212
|
+
* // Later: clean up
|
|
1213
|
+
* unsubscribe();
|
|
1319
1214
|
* ```
|
|
1215
|
+
*
|
|
1216
|
+
* @param params.event - The event name to listen for.
|
|
1217
|
+
* @param params.listener - The callback function to execute when the event is fired.
|
|
1218
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1219
|
+
* @returns A function that can be called to remove the listener.
|
|
1220
|
+
* @see offEvent
|
|
1221
|
+
* @see onceEvent
|
|
1320
1222
|
* @notInstrumented
|
|
1223
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
1321
1224
|
*/
|
|
1322
|
-
const
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1225
|
+
const onEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
1226
|
+
const { eventEmitter } = getCore(client);
|
|
1227
|
+
eventEmitter.on(event, listener);
|
|
1228
|
+
return () => {
|
|
1229
|
+
eventEmitter.off(event, listener);
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Removes an event listener from Dynamic client events.
|
|
1234
|
+
*
|
|
1235
|
+
* This function unsubscribes a previously registered event listener
|
|
1236
|
+
* from the specified Dynamic client event.
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```ts
|
|
1240
|
+
* offEvent({ event: 'walletAdded', listener: myListener });
|
|
1241
|
+
* ```
|
|
1242
|
+
*
|
|
1243
|
+
* @param params.event - The event name to remove the listener from.
|
|
1244
|
+
* @param params.listener - The callback function to remove.
|
|
1245
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1246
|
+
* @see onEvent
|
|
1247
|
+
* @see onceEvent
|
|
1248
|
+
* @notInstrumented
|
|
1249
|
+
*/
|
|
1250
|
+
const offEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
1251
|
+
const { eventEmitter } = getCore(client);
|
|
1252
|
+
eventEmitter.off(event, listener);
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* Adds a one-time event listener for Dynamic client events.
|
|
1256
|
+
*
|
|
1257
|
+
* This function listens for an event that will automatically remove itself
|
|
1258
|
+
* after being triggered once.
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```ts
|
|
1262
|
+
* onceEvent({
|
|
1263
|
+
* event: 'logout',
|
|
1264
|
+
* listener: () => {
|
|
1265
|
+
* console.log('User logged out');
|
|
1266
|
+
* },
|
|
1267
|
+
* });
|
|
1268
|
+
* ```
|
|
1269
|
+
*
|
|
1270
|
+
* @param params.event - The event name to listen for.
|
|
1271
|
+
* @param params.listener - The callback function to execute when the event is fired.
|
|
1272
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1273
|
+
* @returns A function that can be called to remove the listener before it fires.
|
|
1274
|
+
* @see onEvent
|
|
1275
|
+
* @see offEvent
|
|
1276
|
+
* @notInstrumented
|
|
1277
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
1278
|
+
*/
|
|
1279
|
+
const onceEvent = ({ event, listener }, client = getDefaultClient()) => {
|
|
1280
|
+
const { eventEmitter } = getCore(client);
|
|
1281
|
+
eventEmitter.once(event, listener);
|
|
1282
|
+
return () => {
|
|
1283
|
+
eventEmitter.off(event, listener);
|
|
1284
|
+
};
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Emits a Dynamic client event.
|
|
1288
|
+
*
|
|
1289
|
+
* This function triggers an event that will be received by all registered
|
|
1290
|
+
* listeners for the specified event type.
|
|
1291
|
+
*
|
|
1292
|
+
* @param params.event - The event name to emit.
|
|
1293
|
+
* @param params.args - The arguments to pass to event listeners.
|
|
1294
|
+
* @param client - The Dynamic client instance.
|
|
1295
|
+
* @notInstrumented
|
|
1296
|
+
*/
|
|
1297
|
+
const emitEvent = ({ event, args }, client) => {
|
|
1298
|
+
const { eventEmitter } = getCore(client);
|
|
1299
|
+
eventEmitter.emit(event, args);
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
//#endregion
|
|
1303
|
+
//#region src/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.ts
|
|
1304
|
+
/**
|
|
1305
|
+
* Creates a new wallet provider registry that manages wallet providers with priority-based registration.
|
|
1306
|
+
*
|
|
1307
|
+
* @returns The wallet provider registry instance
|
|
1308
|
+
*
|
|
1309
|
+
* @example
|
|
1310
|
+
* ```typescript
|
|
1311
|
+
* const registry = createWalletProviderRegistry();
|
|
1312
|
+
*
|
|
1313
|
+
* registry.register({
|
|
1314
|
+
* priority: WalletProviderPriority.WALLET_SDK,
|
|
1315
|
+
* walletProvider: myWalletProvider
|
|
1316
|
+
* });
|
|
1317
|
+
*
|
|
1318
|
+
* const provider = registry.getByKey('my-wallet-key');
|
|
1319
|
+
* const providers = registry.listProviders();
|
|
1320
|
+
* ```
|
|
1321
|
+
* @notInstrumented
|
|
1322
|
+
*/
|
|
1323
|
+
const createWalletProviderRegistry = (client) => {
|
|
1324
|
+
const registry = /* @__PURE__ */ new Map();
|
|
1325
|
+
return {
|
|
1326
|
+
getByKey: (key) => registry.get(key)?.walletProvider,
|
|
1327
|
+
listProviderEntries: () => Array.from(registry.values()),
|
|
1328
|
+
listProviders: () => Array.from(registry.values()).map((v) => v.walletProvider),
|
|
1329
|
+
register: (args) => {
|
|
1330
|
+
const existingEntry = registry.get(args.walletProvider.key);
|
|
1331
|
+
if (existingEntry) {
|
|
1332
|
+
if (existingEntry.priority < args.priority) {
|
|
1333
|
+
registry.set(args.walletProvider.key, args);
|
|
1334
|
+
emitEvent({
|
|
1335
|
+
args: { walletProviderKey: args.walletProvider.key },
|
|
1336
|
+
event: "walletProviderChanged"
|
|
1337
|
+
}, client);
|
|
1338
|
+
}
|
|
1339
|
+
} else {
|
|
1340
|
+
registry.set(args.walletProvider.key, args);
|
|
1341
|
+
emitEvent({
|
|
1342
|
+
args: { walletProvider: args.walletProvider },
|
|
1342
1343
|
event: "walletProviderRegistered"
|
|
1343
1344
|
}, client);
|
|
1344
1345
|
emitEvent({
|
|
@@ -1404,17 +1405,93 @@ const WalletProviderPriority = {
|
|
|
1404
1405
|
};
|
|
1405
1406
|
|
|
1406
1407
|
//#endregion
|
|
1407
|
-
//#region src/modules/wallets/
|
|
1408
|
+
//#region src/modules/wallets/getWalletProviders/getWalletProviders.ts
|
|
1409
|
+
/**
|
|
1410
|
+
* Get all available wallet providers to interact with internally.
|
|
1411
|
+
* @notInstrumented
|
|
1412
|
+
*/
|
|
1413
|
+
const getWalletProviders = (client) => {
|
|
1414
|
+
return getWalletProviderRegistry(client).listProviders();
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region src/modules/waas/constants.ts
|
|
1419
|
+
const DEFAULT_WAAS_BASE_API_URL = "https://app.dynamicauth.com";
|
|
1420
|
+
const DEFAULT_WAAS_BASE_MPC_RELAY_API_URL = "https://relay.dynamicauth.com";
|
|
1421
|
+
const DYNAMIC_WAAS_METADATA = {
|
|
1422
|
+
displayName: "Dynamic WaaS",
|
|
1423
|
+
icon: `${DYNAMIC_ICONIC_SPRITE_URL}#dynamicwaas`,
|
|
1424
|
+
normalizedWalletName: "dynamicwaas"
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
//#endregion
|
|
1428
|
+
//#region src/modules/waas/isWaasWalletProvider/isWaasWalletProvider.ts
|
|
1408
1429
|
/** @notInstrumented */
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey: walletAccount.walletProviderKey });
|
|
1412
|
-
return walletProvider;
|
|
1430
|
+
const isWaasWalletProvider = (walletProvider) => {
|
|
1431
|
+
return walletProvider.key.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
1413
1432
|
};
|
|
1414
1433
|
|
|
1415
1434
|
//#endregion
|
|
1416
|
-
//#region src/modules/
|
|
1417
|
-
|
|
1435
|
+
//#region src/modules/waas/findWaasWalletProviderByChain/findWaasWalletProviderByChain.ts
|
|
1436
|
+
/** @notInstrumented */
|
|
1437
|
+
const findWaasWalletProviderByChain = ({ chain }, client) => {
|
|
1438
|
+
const providers = getWalletProviders(client);
|
|
1439
|
+
const waasProviderKey = formatWalletProviderKey({
|
|
1440
|
+
chain,
|
|
1441
|
+
displayName: DYNAMIC_WAAS_METADATA.displayName,
|
|
1442
|
+
walletProviderType: WalletProviderEnum.EmbeddedWallet
|
|
1443
|
+
});
|
|
1444
|
+
const waasProvider = providers.find((provider) => provider.key === waasProviderKey && provider.chain === chain);
|
|
1445
|
+
if (!waasProvider || !isWaasWalletProvider(waasProvider)) return null;
|
|
1446
|
+
return waasProvider;
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
//#endregion
|
|
1450
|
+
//#region src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.ts
|
|
1451
|
+
/**
|
|
1452
|
+
* This function determines whether the provided wallet account is a Dynamic
|
|
1453
|
+
* WaaS wallet account.
|
|
1454
|
+
*
|
|
1455
|
+
* @param params.walletAccount - The wallet account to check.
|
|
1456
|
+
* @returns True if the wallet account is a WaaS wallet account, false otherwise.
|
|
1457
|
+
* @notInstrumented
|
|
1458
|
+
*/
|
|
1459
|
+
const isWaasWalletAccount = ({ walletAccount }) => {
|
|
1460
|
+
return walletAccount.walletProviderKey.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
//#endregion
|
|
1464
|
+
//#region src/modules/waas/initializeWaasClientsForEagerRecovery/initializeWaasClientsForEagerRecovery.ts
|
|
1465
|
+
/**
|
|
1466
|
+
* On login, boots the WaaS client once per chain so the SDK eagerly recovers
|
|
1467
|
+
* key shares itself (the `eagerlyRecoverKeyShares` capability) instead of the
|
|
1468
|
+
* host looping per wallet. Booting calls `initialize()`, which sends the auth
|
|
1469
|
+
* token the iframe needs to self-recover.
|
|
1470
|
+
*
|
|
1471
|
+
* @notInstrumented
|
|
1472
|
+
*/
|
|
1473
|
+
const initializeWaasClientsForEagerRecovery = async (client) => {
|
|
1474
|
+
/**
|
|
1475
|
+
* Booting triggers recovery, which fails if the user is missing the MFA auth.
|
|
1476
|
+
* This early return avoids attempting a call we know will fail and just adds
|
|
1477
|
+
* noise to the logs.
|
|
1478
|
+
*/
|
|
1479
|
+
if (isUserMissingMfaAuth(client)) return;
|
|
1480
|
+
const waasChains = new Set(getWalletAccounts(client).filter((walletAccount) => isWaasWalletAccount({ walletAccount })).map((walletAccount) => walletAccount.chain));
|
|
1481
|
+
await Promise.all([...waasChains].map(async (chain) => {
|
|
1482
|
+
const provider = findWaasWalletProviderByChain({ chain }, client);
|
|
1483
|
+
/**
|
|
1484
|
+
* The environment might not have the embedded wallet extensions installed.
|
|
1485
|
+
* In that case there is no provider for the chain and nothing to boot.
|
|
1486
|
+
*/
|
|
1487
|
+
if (!provider) return;
|
|
1488
|
+
try {
|
|
1489
|
+
await provider.getWaasClient();
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
getCore(client).logger.warn("[initializeWaasClientsForEagerRecovery] failed to boot waas client", error);
|
|
1492
|
+
}
|
|
1493
|
+
}));
|
|
1494
|
+
};
|
|
1418
1495
|
|
|
1419
1496
|
//#endregion
|
|
1420
1497
|
//#region src/modules/wallets/emitWalletAccountsChangedEvent/emitWalletAccountsChangedEvent.ts
|
|
@@ -1439,47 +1516,201 @@ const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client) => {
|
|
|
1439
1516
|
const getWalletAccountsHash = (state, client) => getWalletAccountsFromState(state, client).map((walletAccount) => JSON.stringify(walletAccount)).sort().join("-");
|
|
1440
1517
|
|
|
1441
1518
|
//#endregion
|
|
1442
|
-
//#region src/
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
* @notInstrumented
|
|
1453
|
-
*/
|
|
1454
|
-
const extractSessionId = (token) => {
|
|
1455
|
-
try {
|
|
1456
|
-
const payload = token.split(".")[1];
|
|
1457
|
-
return JSON.parse(atob(payload)).sid ?? null;
|
|
1458
|
-
} catch {
|
|
1459
|
-
return null;
|
|
1519
|
+
//#region src/errors/InvalidParamError.ts
|
|
1520
|
+
var InvalidParamError = class extends BaseError {
|
|
1521
|
+
constructor(message) {
|
|
1522
|
+
super({
|
|
1523
|
+
cause: null,
|
|
1524
|
+
code: "invalid_param_error",
|
|
1525
|
+
docsUrl: null,
|
|
1526
|
+
name: "InvalidParamError",
|
|
1527
|
+
shortMessage: message
|
|
1528
|
+
});
|
|
1460
1529
|
}
|
|
1461
1530
|
};
|
|
1462
1531
|
|
|
1463
1532
|
//#endregion
|
|
1464
|
-
//#region src/
|
|
1533
|
+
//#region src/modules/auth/decodeJwt/decodeJwt.ts
|
|
1465
1534
|
/**
|
|
1466
|
-
*
|
|
1535
|
+
* Decodes a JWT token and returns the full payload.
|
|
1467
1536
|
*
|
|
1468
|
-
* This
|
|
1469
|
-
*
|
|
1470
|
-
* is used exclusively in RN environments.
|
|
1537
|
+
* This function extracts and returns the complete JWT payload including scopes,
|
|
1538
|
+
* expiration time, and other claims.
|
|
1471
1539
|
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1540
|
+
* @param jwt - The JWT token string.
|
|
1541
|
+
* @returns The decoded JWT payload object.
|
|
1542
|
+
* @throws InvalidParamError if the token is invalid or cannot be decoded.
|
|
1543
|
+
*
|
|
1544
|
+
* @example
|
|
1545
|
+
* ```typescript
|
|
1546
|
+
* const payload = decodeJwt(jwt);
|
|
1547
|
+
* // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }
|
|
1548
|
+
* ```
|
|
1549
|
+
* @notInstrumented
|
|
1550
|
+
*/
|
|
1551
|
+
const decodeJwt = (jwt) => {
|
|
1552
|
+
try {
|
|
1553
|
+
const parts = jwt.split(".");
|
|
1554
|
+
if (parts.length !== 3) throw new InvalidParamError("Invalid JWT format");
|
|
1555
|
+
const base64Payload = parts[1].replaceAll("-", "+").replaceAll("_", "/");
|
|
1556
|
+
const paddedPayload = base64Payload + "=".repeat((4 - base64Payload.length % 4) % 4);
|
|
1557
|
+
const decodedPayload = atob(paddedPayload);
|
|
1558
|
+
return JSON.parse(decodedPayload);
|
|
1559
|
+
} catch (error) {
|
|
1560
|
+
if (error instanceof InvalidParamError) throw error;
|
|
1561
|
+
throw new InvalidParamError(`Failed to decode JWT: ${error instanceof Error ? error.message : String(error)}`);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.ts
|
|
1567
|
+
/**
|
|
1568
|
+
* Normalizes scopes by deduplicating and sorting them.
|
|
1569
|
+
* This creates a canonical representation for comparison.
|
|
1570
|
+
*
|
|
1571
|
+
* @param scopes - Array of scope strings (may contain duplicates)
|
|
1572
|
+
* @returns Normalized, sorted array of unique scopes
|
|
1573
|
+
* @notInstrumented
|
|
1574
|
+
*/
|
|
1575
|
+
const normalizeScopes = (scopes) => {
|
|
1576
|
+
return [...new Set(scopes)].sort((a, b) => a.localeCompare(b));
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
//#endregion
|
|
1580
|
+
//#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.ts
|
|
1581
|
+
/**
|
|
1582
|
+
* Validates and parses an elevated access token from a JWT string.
|
|
1583
|
+
* Extracts scopes, expiration, and validates the token structure.
|
|
1584
|
+
*
|
|
1585
|
+
* Policy decisions:
|
|
1586
|
+
* - Tokens without scopes are rejected (returns null)
|
|
1587
|
+
* - Tokens with empty scopes array are rejected (returns null)
|
|
1588
|
+
* - Tokens without exp field are rejected (returns null)
|
|
1589
|
+
* - Expired tokens are rejected (returns null)
|
|
1590
|
+
*
|
|
1591
|
+
* @returns Parsed token data or null if token is invalid/expired
|
|
1592
|
+
* @notInstrumented
|
|
1593
|
+
*/
|
|
1594
|
+
const parseElevatedAccessToken = ({ token }) => {
|
|
1595
|
+
const payload = decodeJwt(token);
|
|
1596
|
+
const filteredScopes = ((payload?.scope)?.split(" ") ?? []).filter((s) => s.length > 0);
|
|
1597
|
+
const singleUse = payload.singleUse ?? false;
|
|
1598
|
+
if (!filteredScopes || filteredScopes.length === 0) return null;
|
|
1599
|
+
if (!payload.exp) return null;
|
|
1600
|
+
const expiresAt = /* @__PURE__ */ new Date(payload.exp * 1e3);
|
|
1601
|
+
if (expiresAt <= /* @__PURE__ */ new Date()) return null;
|
|
1602
|
+
return {
|
|
1603
|
+
expiresAt,
|
|
1604
|
+
normalizedScopes: normalizeScopes(filteredScopes),
|
|
1605
|
+
scopes: filteredScopes,
|
|
1606
|
+
singleUse,
|
|
1607
|
+
token
|
|
1608
|
+
};
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1611
|
+
//#endregion
|
|
1612
|
+
//#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.ts
|
|
1613
|
+
/**
|
|
1614
|
+
* Upserts an elevated access token into the current tokens array.
|
|
1615
|
+
*
|
|
1616
|
+
* Policy: Only one token per normalized scope-set is allowed.
|
|
1617
|
+
* If a token with the same normalized scopes exists, it is replaced.
|
|
1618
|
+
* This ensures we don't accumulate multiple tokens for the same scope combination.
|
|
1619
|
+
*
|
|
1620
|
+
* @param currentTokens - Current array of elevated access tokens
|
|
1621
|
+
* @param newToken - New token to upsert
|
|
1622
|
+
* @returns Updated array of tokens with the new token upserted
|
|
1623
|
+
* @notInstrumented
|
|
1624
|
+
*/
|
|
1625
|
+
const upsertElevatedAccessToken = ({ currentTokens, newToken }) => {
|
|
1626
|
+
const newScopeKey = normalizeScopes(newToken.scopes).join(" ");
|
|
1627
|
+
return [...currentTokens.filter((existingToken) => {
|
|
1628
|
+
return normalizeScopes(existingToken.scopes).join(" ") !== newScopeKey;
|
|
1629
|
+
}), {
|
|
1630
|
+
expiresAt: newToken.expiresAt,
|
|
1631
|
+
scopes: newToken.scopes,
|
|
1632
|
+
singleUse: newToken.singleUse,
|
|
1633
|
+
token: newToken.token
|
|
1634
|
+
}];
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
//#endregion
|
|
1638
|
+
//#region src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts
|
|
1639
|
+
/** @notInstrumented */
|
|
1640
|
+
const updateAuthFromVerifyResponse = ({ response }, client) => {
|
|
1641
|
+
const core = getCore(client);
|
|
1642
|
+
const previousState = { ...core.state.get() };
|
|
1643
|
+
const { user, minifiedJwt, jwt, expiresAt, mfaToken, elevatedAccessToken } = response;
|
|
1644
|
+
const sessionExpiresAt = /* @__PURE__ */ new Date(expiresAt * 1e3);
|
|
1645
|
+
const newState = {
|
|
1646
|
+
legacyToken: jwt ?? null,
|
|
1647
|
+
sessionExpiresAt,
|
|
1648
|
+
token: minifiedJwt ?? null,
|
|
1649
|
+
user
|
|
1650
|
+
};
|
|
1651
|
+
if (mfaToken) newState.mfaToken = mfaToken;
|
|
1652
|
+
const currentTokens = core.state.get().elevatedAccessTokens || [];
|
|
1653
|
+
newState.elevatedAccessTokens = currentTokens;
|
|
1654
|
+
if (elevatedAccessToken) {
|
|
1655
|
+
const parsedToken = parseElevatedAccessToken({ token: elevatedAccessToken });
|
|
1656
|
+
if (parsedToken) newState.elevatedAccessTokens = upsertElevatedAccessToken({
|
|
1657
|
+
currentTokens,
|
|
1658
|
+
newToken: parsedToken
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
core.state.set(newState);
|
|
1662
|
+
/**
|
|
1663
|
+
* For customers using a sandbox environment with cookies enabled, we need to set the cookie
|
|
1664
|
+
* programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically
|
|
1665
|
+
* so customers can access the cookie from document.cookie consistently between sandbox and live environments.
|
|
1666
|
+
*/
|
|
1667
|
+
if (minifiedJwt && isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${sessionExpiresAt.toUTCString()}; path=/; SameSite=Lax${getSecureCookieAttribute()}`);
|
|
1668
|
+
checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);
|
|
1669
|
+
if (!previousState.user && Boolean(newState.user)) initializeWaasClientsForEagerRecovery(client);
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
//#endregion
|
|
1673
|
+
//#region src/modules/auth/extractSessionId/extractSessionId.ts
|
|
1674
|
+
/**
|
|
1675
|
+
* Extracts the session ID (`sid` claim) from a JWT token string.
|
|
1676
|
+
*
|
|
1677
|
+
* Decodes the base64url-encoded payload segment of the token and reads the
|
|
1678
|
+
* `sid` field. This is used to correlate instrumentation events with the
|
|
1679
|
+
* authenticated session, without ever forwarding the full token.
|
|
1680
|
+
*
|
|
1681
|
+
* Returns `null` when no token is present, when the token is malformed, or
|
|
1682
|
+
* when the payload does not contain a `sid` claim.
|
|
1683
|
+
* @notInstrumented
|
|
1684
|
+
*/
|
|
1685
|
+
const extractSessionId = (token) => {
|
|
1686
|
+
try {
|
|
1687
|
+
const payload = token.split(".")[1];
|
|
1688
|
+
return JSON.parse(atob(payload)).sid ?? null;
|
|
1689
|
+
} catch {
|
|
1690
|
+
return null;
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
//#endregion
|
|
1695
|
+
//#region src/utils/getOperatingSystem/getOperatingSystem.native.ts
|
|
1696
|
+
/**
|
|
1697
|
+
* Returns the operating system for React Native environments via `Platform.OS`.
|
|
1698
|
+
*
|
|
1699
|
+
* This file is the React Native variant — the bundler (Metro) resolves
|
|
1700
|
+
* `.native.ts` files over the plain `.ts` counterpart, so this implementation
|
|
1701
|
+
* is used exclusively in RN environments.
|
|
1702
|
+
*
|
|
1703
|
+
* `Platform.OS` can return `'web'` or `'native'` in edge cases (e.g. Expo Go
|
|
1704
|
+
* web preview); these are normalised to `'unknown'` since they indicate an
|
|
1705
|
+
* unexpected runtime rather than a real OS.
|
|
1706
|
+
* @notInstrumented
|
|
1707
|
+
*/
|
|
1708
|
+
const getOperatingSystem = () => {
|
|
1709
|
+
const os = Platform.OS;
|
|
1710
|
+
if (os === "ios" || os === "android" || os === "windows" || os === "macos") return os;
|
|
1711
|
+
return "unknown";
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1483
1714
|
//#endregion
|
|
1484
1715
|
//#region src/utils/getUserAgent/getUserAgent.ts
|
|
1485
1716
|
/**
|
|
@@ -1841,267 +2072,128 @@ const instrumentFunction = ({ fn, functionName, getCore: getCore$1, selectors })
|
|
|
1841
2072
|
};
|
|
1842
2073
|
|
|
1843
2074
|
//#endregion
|
|
1844
|
-
//#region src/modules/
|
|
2075
|
+
//#region src/modules/user/refreshAuth/refreshAuth.ts
|
|
1845
2076
|
/**
|
|
1846
|
-
*
|
|
2077
|
+
* Refreshes the current session's authentication from the server.
|
|
1847
2078
|
*
|
|
1848
|
-
* This
|
|
1849
|
-
*
|
|
2079
|
+
* This rotates the auth token via a full verify call and updates both the
|
|
2080
|
+
* token and the user state from the response, returning the raw
|
|
2081
|
+
* `VerifyResponse` (which includes the new token). Reach for this when you
|
|
2082
|
+
* need a fresh JWT — e.g. before a call that requires a non-expired token.
|
|
1850
2083
|
*
|
|
1851
|
-
*
|
|
1852
|
-
*
|
|
1853
|
-
*
|
|
1854
|
-
* @hook Exposed as a hook so consumers reactively know when MFA is still required, updated when the user changes.
|
|
1855
|
-
*/
|
|
1856
|
-
const isUserMissingMfaAuth = (client = getDefaultClient()) => {
|
|
1857
|
-
const user = client.user;
|
|
1858
|
-
assertDefined(user, "User not logged in");
|
|
1859
|
-
return Boolean(user.scope?.includes("requiresAdditionalAuth"));
|
|
1860
|
-
};
|
|
1861
|
-
|
|
1862
|
-
//#endregion
|
|
1863
|
-
//#region src/modules/wallets/getWalletProviders/getWalletProviders.ts
|
|
1864
|
-
/**
|
|
1865
|
-
* Get all available wallet providers to interact with internally.
|
|
1866
|
-
* @notInstrumented
|
|
1867
|
-
*/
|
|
1868
|
-
const getWalletProviders = (client) => {
|
|
1869
|
-
return getWalletProviderRegistry(client).listProviders();
|
|
1870
|
-
};
|
|
1871
|
-
|
|
1872
|
-
//#endregion
|
|
1873
|
-
//#region src/modules/waas/constants.ts
|
|
1874
|
-
const DEFAULT_WAAS_BASE_API_URL = "https://app.dynamicauth.com";
|
|
1875
|
-
const DEFAULT_WAAS_BASE_MPC_RELAY_API_URL = "https://relay.dynamicauth.com";
|
|
1876
|
-
const DYNAMIC_WAAS_METADATA = {
|
|
1877
|
-
displayName: "Dynamic WaaS",
|
|
1878
|
-
icon: `${DYNAMIC_ICONIC_SPRITE_URL}#dynamicwaas`,
|
|
1879
|
-
normalizedWalletName: "dynamicwaas"
|
|
1880
|
-
};
|
|
1881
|
-
|
|
1882
|
-
//#endregion
|
|
1883
|
-
//#region src/modules/waas/isWaasWalletProvider/isWaasWalletProvider.ts
|
|
1884
|
-
/** @notInstrumented */
|
|
1885
|
-
const isWaasWalletProvider = (walletProvider) => {
|
|
1886
|
-
return walletProvider.key.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
1887
|
-
};
|
|
1888
|
-
|
|
1889
|
-
//#endregion
|
|
1890
|
-
//#region src/modules/waas/findWaasWalletProviderByChain/findWaasWalletProviderByChain.ts
|
|
1891
|
-
/** @notInstrumented */
|
|
1892
|
-
const findWaasWalletProviderByChain = ({ chain }, client) => {
|
|
1893
|
-
const providers = getWalletProviders(client);
|
|
1894
|
-
const waasProviderKey = formatWalletProviderKey({
|
|
1895
|
-
chain,
|
|
1896
|
-
displayName: DYNAMIC_WAAS_METADATA.displayName,
|
|
1897
|
-
walletProviderType: WalletProviderEnum.EmbeddedWallet
|
|
1898
|
-
});
|
|
1899
|
-
const waasProvider = providers.find((provider) => provider.key === waasProviderKey && provider.chain === chain);
|
|
1900
|
-
if (!waasProvider || !isWaasWalletProvider(waasProvider)) return null;
|
|
1901
|
-
return waasProvider;
|
|
1902
|
-
};
|
|
1903
|
-
|
|
1904
|
-
//#endregion
|
|
1905
|
-
//#region src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.ts
|
|
1906
|
-
/**
|
|
1907
|
-
* This function determines whether the provided wallet account is a Dynamic
|
|
1908
|
-
* WaaS wallet account.
|
|
2084
|
+
* Prefer `refreshUser` when you only need the latest user profile and do not
|
|
2085
|
+
* care about rotating the token: it hits the authenticated-user endpoint,
|
|
2086
|
+
* touches only the user state, and returns the `User` directly.
|
|
1909
2087
|
*
|
|
1910
|
-
* @
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
return walletAccount.walletProviderKey.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
1916
|
-
};
|
|
1917
|
-
|
|
1918
|
-
//#endregion
|
|
1919
|
-
//#region src/modules/waas/initializeWaasClientsForEagerRecovery/initializeWaasClientsForEagerRecovery.ts
|
|
1920
|
-
/**
|
|
1921
|
-
* On login, boots the WaaS client once per chain so the SDK eagerly recovers
|
|
1922
|
-
* key shares itself (the `eagerlyRecoverKeyShares` capability) instead of the
|
|
1923
|
-
* host looping per wallet. Booting calls `initialize()`, which sends the auth
|
|
1924
|
-
* token the iframe needs to self-recover.
|
|
2088
|
+
* @example
|
|
2089
|
+
* ```ts
|
|
2090
|
+
* const response = await refreshAuth();
|
|
2091
|
+
* console.log('Token refreshed:', response.token);
|
|
2092
|
+
* ```
|
|
1925
2093
|
*
|
|
1926
|
-
* @
|
|
2094
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2095
|
+
* @returns A promise that resolves to the verify response.
|
|
2096
|
+
* @see logout
|
|
2097
|
+
* @see refreshUser
|
|
2098
|
+
* @instrumented
|
|
1927
2099
|
*/
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
* The environment might not have the embedded wallet extensions installed.
|
|
1940
|
-
* In that case there is no provider for the chain and nothing to boot.
|
|
1941
|
-
*/
|
|
1942
|
-
if (!provider) return;
|
|
2100
|
+
const refreshAuth = async (client = getDefaultClient()) => {
|
|
2101
|
+
const core = getCore(client);
|
|
2102
|
+
const response = await createBaseApiClient({ middleware: [createDeviceSignatureHeadersMiddleware(client)] }, client).refreshAuth({ environmentId: core.environmentId });
|
|
2103
|
+
updateAuthFromVerifyResponse({ response }, client);
|
|
2104
|
+
return response;
|
|
2105
|
+
};
|
|
2106
|
+
const __refreshAuth_impl = refreshAuth;
|
|
2107
|
+
const __refreshAuth_wrapped = instrumentFunction({
|
|
2108
|
+
fn: __refreshAuth_impl,
|
|
2109
|
+
functionName: "refreshAuth",
|
|
2110
|
+
getCore: () => {
|
|
1943
2111
|
try {
|
|
1944
|
-
|
|
1945
|
-
} catch
|
|
1946
|
-
|
|
2112
|
+
return getCore(getDefaultClient());
|
|
2113
|
+
} catch {
|
|
2114
|
+
return;
|
|
1947
2115
|
}
|
|
1948
|
-
}));
|
|
1949
|
-
};
|
|
1950
|
-
|
|
1951
|
-
//#endregion
|
|
1952
|
-
//#region src/errors/InvalidParamError.ts
|
|
1953
|
-
var InvalidParamError = class extends BaseError {
|
|
1954
|
-
constructor(message) {
|
|
1955
|
-
super({
|
|
1956
|
-
cause: null,
|
|
1957
|
-
code: "invalid_param_error",
|
|
1958
|
-
docsUrl: null,
|
|
1959
|
-
name: "InvalidParamError",
|
|
1960
|
-
shortMessage: message
|
|
1961
|
-
});
|
|
1962
2116
|
}
|
|
1963
|
-
};
|
|
2117
|
+
});
|
|
1964
2118
|
|
|
1965
2119
|
//#endregion
|
|
1966
|
-
//#region src/modules/
|
|
2120
|
+
//#region src/modules/apiClient/utils/rbacStaleMiddleware/createRbacStaleMiddleware.ts
|
|
2121
|
+
const RBAC_STALE_CODE = "rbac_stale";
|
|
2122
|
+
const RBAC_STALE_RETRY_HEADER = "x-dyn-rbac-retry";
|
|
1967
2123
|
/**
|
|
1968
|
-
*
|
|
1969
|
-
*
|
|
1970
|
-
*
|
|
1971
|
-
* expiration time, and other claims.
|
|
1972
|
-
*
|
|
1973
|
-
* @param jwt - The JWT token string.
|
|
1974
|
-
* @returns The decoded JWT payload object.
|
|
1975
|
-
* @throws InvalidParamError if the token is invalid or cannot be decoded.
|
|
1976
|
-
*
|
|
1977
|
-
* @example
|
|
1978
|
-
* ```typescript
|
|
1979
|
-
* const payload = decodeJwt(jwt);
|
|
1980
|
-
* // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }
|
|
1981
|
-
* ```
|
|
2124
|
+
* Detects 403 { code: 'rbac_stale' } responses, refreshes the auth token, and
|
|
2125
|
+
* retries the request once with the new token. This lets business account role
|
|
2126
|
+
* changes take effect without revoking the user's session.
|
|
1982
2127
|
* @notInstrumented
|
|
1983
2128
|
*/
|
|
1984
|
-
const
|
|
2129
|
+
const createRbacStaleMiddleware = (client) => ({ post: async (context) => {
|
|
2130
|
+
if (context.response.status !== 403) return context.response;
|
|
2131
|
+
if (context.init.headers && typeof context.init.headers === "object" && RBAC_STALE_RETRY_HEADER in context.init.headers) return context.response;
|
|
2132
|
+
let errorBody;
|
|
1985
2133
|
try {
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
const paddedPayload = base64Payload + "=".repeat((4 - base64Payload.length % 4) % 4);
|
|
1990
|
-
const decodedPayload = atob(paddedPayload);
|
|
1991
|
-
return JSON.parse(decodedPayload);
|
|
1992
|
-
} catch (error) {
|
|
1993
|
-
if (error instanceof InvalidParamError) throw error;
|
|
1994
|
-
throw new InvalidParamError(`Failed to decode JWT: ${error instanceof Error ? error.message : String(error)}`);
|
|
2134
|
+
errorBody = await context.response.clone().json();
|
|
2135
|
+
} catch {
|
|
2136
|
+
return context.response;
|
|
1995
2137
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2138
|
+
if (!(typeof errorBody === "object" && errorBody !== null && "code" in errorBody && errorBody.code === RBAC_STALE_CODE)) return context.response;
|
|
2139
|
+
try {
|
|
2140
|
+
await __refreshAuth_wrapped(client);
|
|
2141
|
+
} catch {
|
|
2142
|
+
return context.response;
|
|
2143
|
+
}
|
|
2144
|
+
if (!client.token) return context.response;
|
|
2145
|
+
const headers = { ...context.init.headers };
|
|
2146
|
+
delete headers[RBAC_STALE_RETRY_HEADER];
|
|
2147
|
+
delete headers[MFA_TOKEN_HEADER];
|
|
2148
|
+
delete headers[ELEVATED_ACCESS_TOKEN_HEADER];
|
|
2149
|
+
headers.Authorization = `Bearer ${client.token}`;
|
|
2150
|
+
return context.fetch(context.url, {
|
|
2151
|
+
...context.init,
|
|
2152
|
+
headers: {
|
|
2153
|
+
...headers,
|
|
2154
|
+
[RBAC_STALE_RETRY_HEADER]: "1"
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
} });
|
|
2011
2158
|
|
|
2012
2159
|
//#endregion
|
|
2013
|
-
//#region src/modules/
|
|
2160
|
+
//#region src/modules/apiClient/createApiClient.ts
|
|
2014
2161
|
/**
|
|
2015
|
-
*
|
|
2016
|
-
* Extracts scopes, expiration, and validates the token structure.
|
|
2017
|
-
*
|
|
2018
|
-
* Policy decisions:
|
|
2019
|
-
* - Tokens without scopes are rejected (returns null)
|
|
2020
|
-
* - Tokens with empty scopes array are rejected (returns null)
|
|
2021
|
-
* - Tokens without exp field are rejected (returns null)
|
|
2022
|
-
* - Expired tokens are rejected (returns null)
|
|
2162
|
+
* Returns a new instance of the SDK API client.
|
|
2023
2163
|
*
|
|
2024
|
-
*
|
|
2164
|
+
* This is not meant for storing, as it is very light we can create it whenever needed.
|
|
2025
2165
|
* @notInstrumented
|
|
2026
2166
|
*/
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
if (!payload.exp) return null;
|
|
2033
|
-
const expiresAt = /* @__PURE__ */ new Date(payload.exp * 1e3);
|
|
2034
|
-
if (expiresAt <= /* @__PURE__ */ new Date()) return null;
|
|
2035
|
-
return {
|
|
2036
|
-
expiresAt,
|
|
2037
|
-
normalizedScopes: normalizeScopes(filteredScopes),
|
|
2038
|
-
scopes: filteredScopes,
|
|
2039
|
-
singleUse,
|
|
2040
|
-
token
|
|
2041
|
-
};
|
|
2167
|
+
const createApiClient = (options = {}, client) => {
|
|
2168
|
+
return createBaseApiClient({
|
|
2169
|
+
middleware: [createDeviceSignatureHeadersMiddleware(client), createRbacStaleMiddleware(client)],
|
|
2170
|
+
options
|
|
2171
|
+
}, client);
|
|
2042
2172
|
};
|
|
2043
2173
|
|
|
2044
2174
|
//#endregion
|
|
2045
|
-
//#region src/
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
* @notInstrumented
|
|
2057
|
-
*/
|
|
2058
|
-
const upsertElevatedAccessToken = ({ currentTokens, newToken }) => {
|
|
2059
|
-
const newScopeKey = normalizeScopes(newToken.scopes).join(" ");
|
|
2060
|
-
return [...currentTokens.filter((existingToken) => {
|
|
2061
|
-
return normalizeScopes(existingToken.scopes).join(" ") !== newScopeKey;
|
|
2062
|
-
}), {
|
|
2063
|
-
expiresAt: newToken.expiresAt,
|
|
2064
|
-
scopes: newToken.scopes,
|
|
2065
|
-
singleUse: newToken.singleUse,
|
|
2066
|
-
token: newToken.token
|
|
2067
|
-
}];
|
|
2175
|
+
//#region src/errors/NoWalletProviderFoundError.ts
|
|
2176
|
+
var NoWalletProviderFoundError = class extends BaseError {
|
|
2177
|
+
constructor({ walletProviderKey }) {
|
|
2178
|
+
super({
|
|
2179
|
+
cause: null,
|
|
2180
|
+
code: "no_wallet_provider_found_error",
|
|
2181
|
+
docsUrl: null,
|
|
2182
|
+
name: "NoWalletProviderFoundError",
|
|
2183
|
+
shortMessage: `No wallet provider found with key: ${walletProviderKey}`
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2068
2186
|
};
|
|
2069
2187
|
|
|
2070
2188
|
//#endregion
|
|
2071
|
-
//#region src/modules/
|
|
2189
|
+
//#region src/modules/wallets/utils/getWalletProviderFromWalletAccount/getWalletProviderFromWalletAccount.ts
|
|
2072
2190
|
/** @notInstrumented */
|
|
2073
|
-
const
|
|
2074
|
-
const
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
const sessionExpiresAt = /* @__PURE__ */ new Date(expiresAt * 1e3);
|
|
2078
|
-
const newState = {
|
|
2079
|
-
legacyToken: jwt ?? null,
|
|
2080
|
-
sessionExpiresAt,
|
|
2081
|
-
token: minifiedJwt ?? null,
|
|
2082
|
-
user
|
|
2083
|
-
};
|
|
2084
|
-
if (mfaToken) newState.mfaToken = mfaToken;
|
|
2085
|
-
const currentTokens = core.state.get().elevatedAccessTokens || [];
|
|
2086
|
-
newState.elevatedAccessTokens = currentTokens;
|
|
2087
|
-
if (elevatedAccessToken) {
|
|
2088
|
-
const parsedToken = parseElevatedAccessToken({ token: elevatedAccessToken });
|
|
2089
|
-
if (parsedToken) newState.elevatedAccessTokens = upsertElevatedAccessToken({
|
|
2090
|
-
currentTokens,
|
|
2091
|
-
newToken: parsedToken
|
|
2092
|
-
});
|
|
2093
|
-
}
|
|
2094
|
-
core.state.set(newState);
|
|
2095
|
-
/**
|
|
2096
|
-
* For customers using a sandbox environment with cookies enabled, we need to set the cookie
|
|
2097
|
-
* programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically
|
|
2098
|
-
* so customers can access the cookie from document.cookie consistently between sandbox and live environments.
|
|
2099
|
-
*/
|
|
2100
|
-
if (minifiedJwt && isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${sessionExpiresAt.toUTCString()}; path=/; SameSite=Lax${getSecureCookieAttribute()}`);
|
|
2101
|
-
checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);
|
|
2102
|
-
if (!previousState.user && Boolean(newState.user)) initializeWaasClientsForEagerRecovery(client);
|
|
2191
|
+
const getWalletProviderFromWalletAccount = ({ walletAccount }, client) => {
|
|
2192
|
+
const walletProvider = getWalletProviderRegistry(client).getByKey(walletAccount.walletProviderKey);
|
|
2193
|
+
if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey: walletAccount.walletProviderKey });
|
|
2194
|
+
return walletProvider;
|
|
2103
2195
|
};
|
|
2104
2196
|
|
|
2105
2197
|
//#endregion
|
|
2106
|
-
export {
|
|
2107
|
-
//# sourceMappingURL=
|
|
2198
|
+
export { NONCE_POOL_SIZE as $, onEvent as A, splitWalletProviderKey as B, DEFAULT_WAAS_BASE_MPC_RELAY_API_URL as C, DYNAMIC_AUTH_COOKIE_NAME as Ct, getWalletProviderRegistry as D, WalletProviderPriority as E, version as Et, normalizeWalletNameWithChain as F, createDeviceSignatureHeadersMiddleware as G, isUserMissingMfaAuth as H, getChainFromVerifiedCredentialChain as I, getNonce as J, getHeadersForNonceSignedByDeviceSigners as K, CHAINS_INFO_MAP as L, createRuntimeServiceAccessKey as M, getWalletAccounts as N, emitEvent as O, formatWalletProviderKey as P, createLocalStorageAdapter as Q, formatWalletAccountId as R, DEFAULT_WAAS_BASE_API_URL as S, BaseError as St, getWalletProviders as T, name as Tt, setCookie as U, InvalidWalletProviderKeyError as V, getSecureCookieAttribute as W, updateNoncePoolStorage as X, fetchAndStoreNonces as Y, createStorageKeySchema as Z, emitWalletAccountsChangedEvent as _, getPlatform as _t, instrumentFunction as a, InvalidExternalAuthError as at, findWaasWalletProviderByChain as b, ClientNotFoundError as bt, getUserAgent as c, DYNAMIC_LOGOUT_REASON_HEADER as ct, updateAuthFromVerifyResponse as d, getSessionKeys as dt, UnauthorizedError as et, upsertElevatedAccessToken as f, isCookieEnabled as ft, checkAndRaiseWalletAccountsChangedEvent as g, randomString as gt, InvalidParamError as h, getElevatedAccessToken as ht, __refreshAuth_wrapped as i, LinkCredentialError as it, onceEvent as j, offEvent as k, getOperatingSystem as l, DYNAMIC_ICONIC_SPRITE_URL as lt, decodeJwt as m, ValueMustBeDefinedError as mt, NoWalletProviderFoundError as n, MfaRateLimitedError as nt, scrubParameters as o, APIError as ot, parseElevatedAccessToken as p, assertDefined as pt, getDeviceSigner as q, createApiClient as r, MfaInvalidOtpError as rt, DEFAULT_PII_FIELDS as s, CLIENT_SDK_NAME as st, getWalletProviderFromWalletAccount as t, SandboxMaximumThresholdReachedError as tt, extractSessionId as u, SDK_API_CORE_VERSION as ut, initializeWaasClientsForEagerRecovery as v, getDefaultClient as vt, DYNAMIC_WAAS_METADATA as w, TokenScope$1 as wt, isWaasWalletProvider as x, getCore as xt, isWaasWalletAccount as y, setDefaultClient as yt, normalizeAddress as z };
|
|
2199
|
+
//# sourceMappingURL=apiClient-DpzKqY39.native.esm.js.map
|