@dynamic-labs-sdk/client 1.3.0 → 1.5.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.
Files changed (225) hide show
  1. package/dist/{InvalidParamError-DQvZQdQ9.cjs → InvalidParamError-DKJhDrK8.cjs} +1056 -110
  2. package/dist/InvalidParamError-DKJhDrK8.cjs.map +1 -0
  3. package/dist/{InvalidParamError-Za4cvW7K.esm.js → InvalidParamError-DWjMfOZ5.esm.js} +852 -95
  4. package/dist/InvalidParamError-DWjMfOZ5.esm.js.map +1 -0
  5. package/dist/{InvalidParamError-9kQBK3sP.native.esm.js → InvalidParamError-DkAMYJOW.native.esm.js} +885 -95
  6. package/dist/InvalidParamError-DkAMYJOW.native.esm.js.map +1 -0
  7. package/dist/{NotWaasWalletAccountError-By3Y4taq.esm.js → NotWaasWalletAccountError-BVrvQzLz.native.esm.js} +7 -5
  8. package/dist/NotWaasWalletAccountError-BVrvQzLz.native.esm.js.map +1 -0
  9. package/dist/{NotWaasWalletAccountError-BTMvHTA8.native.esm.js → NotWaasWalletAccountError-C7NUlvvM.esm.js} +7 -5
  10. package/dist/NotWaasWalletAccountError-C7NUlvvM.esm.js.map +1 -0
  11. package/dist/{NotWaasWalletAccountError-Ciq7b-Y6.cjs → NotWaasWalletAccountError-CHzpa9kk.cjs} +7 -5
  12. package/dist/NotWaasWalletAccountError-CHzpa9kk.cjs.map +1 -0
  13. package/dist/core.cjs +46 -23
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.esm.js +29 -8
  16. package/dist/core.esm.js.map +1 -1
  17. package/dist/core.native.esm.js +27 -6
  18. package/dist/core.native.esm.js.map +1 -1
  19. package/dist/exports/core.d.ts +6 -0
  20. package/dist/exports/core.d.ts.map +1 -1
  21. package/dist/exports/index.d.ts +14 -1
  22. package/dist/exports/index.d.ts.map +1 -1
  23. package/dist/{getNetworkProviderFromNetworkId-BA0CHZzu.cjs → getNetworkProviderFromNetworkId-BJ27N-7S.cjs} +113 -348
  24. package/dist/getNetworkProviderFromNetworkId-BJ27N-7S.cjs.map +1 -0
  25. package/dist/{getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js → getNetworkProviderFromNetworkId-Bs1kQdWk.native.esm.js} +106 -311
  26. package/dist/getNetworkProviderFromNetworkId-Bs1kQdWk.native.esm.js.map +1 -0
  27. package/dist/{getNetworkProviderFromNetworkId-RWcIZDgC.esm.js → getNetworkProviderFromNetworkId-Cqp9eRSs.esm.js} +110 -282
  28. package/dist/getNetworkProviderFromNetworkId-Cqp9eRSs.esm.js.map +1 -0
  29. package/dist/{getSignedSessionId-la6RXITX.esm.js → getSignedSessionId-CDdKrnw6.esm.js} +3 -3
  30. package/dist/{getSignedSessionId-la6RXITX.esm.js.map → getSignedSessionId-CDdKrnw6.esm.js.map} +1 -1
  31. package/dist/{getSignedSessionId-BCU987hO.cjs → getSignedSessionId-CHDHr-hY.cjs} +3 -3
  32. package/dist/{getSignedSessionId-BCU987hO.cjs.map → getSignedSessionId-CHDHr-hY.cjs.map} +1 -1
  33. package/dist/{getSignedSessionId-DzNCj6g_.native.esm.js → getSignedSessionId-D3KQrN8W.native.esm.js} +3 -3
  34. package/dist/{getSignedSessionId-DzNCj6g_.native.esm.js.map → getSignedSessionId-D3KQrN8W.native.esm.js.map} +1 -1
  35. package/dist/getVerifiedCredentialForWalletAccount-BuUCX040.esm.js +269 -0
  36. package/dist/getVerifiedCredentialForWalletAccount-BuUCX040.esm.js.map +1 -0
  37. package/dist/getVerifiedCredentialForWalletAccount-Ciac5d5L.native.esm.js +269 -0
  38. package/dist/getVerifiedCredentialForWalletAccount-Ciac5d5L.native.esm.js.map +1 -0
  39. package/dist/getVerifiedCredentialForWalletAccount-gCx0smU8.cjs +346 -0
  40. package/dist/getVerifiedCredentialForWalletAccount-gCx0smU8.cjs.map +1 -0
  41. package/dist/index.cjs +754 -319
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.esm.js +687 -260
  44. package/dist/index.esm.js.map +1 -1
  45. package/dist/index.native.esm.js +684 -257
  46. package/dist/index.native.esm.js.map +1 -1
  47. package/dist/{isMfaRequiredForAction-C1u4Z__n.esm.js → isMfaRequiredForAction-B0xNvBpU.native.esm.js} +5 -3
  48. package/dist/isMfaRequiredForAction-B0xNvBpU.native.esm.js.map +1 -0
  49. package/dist/{isMfaRequiredForAction-CMClgbT0.cjs → isMfaRequiredForAction-CLMvTTwl.cjs} +5 -3
  50. package/dist/isMfaRequiredForAction-CLMvTTwl.cjs.map +1 -0
  51. package/dist/{isMfaRequiredForAction-DSX-TV2z.native.esm.js → isMfaRequiredForAction-C_QPI1LH.esm.js} +5 -3
  52. package/dist/isMfaRequiredForAction-C_QPI1LH.esm.js.map +1 -0
  53. package/dist/modules/apiClient/apiClient.types.d.ts +12 -0
  54. package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
  55. package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
  56. package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts +27 -0
  57. package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts.map +1 -0
  58. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts +1 -0
  59. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts.map +1 -1
  60. package/dist/modules/auth/isSignedIn/isSignedIn.d.ts +11 -1
  61. package/dist/modules/auth/isSignedIn/isSignedIn.d.ts.map +1 -1
  62. package/dist/modules/auth/logoutReason.d.ts +1 -1
  63. package/dist/modules/auth/logoutReason.d.ts.map +1 -1
  64. package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
  65. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +2 -1
  66. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
  67. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +1 -0
  68. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
  69. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +2 -1
  70. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
  71. package/dist/modules/balances/getBalances/getBalances.d.ts +9 -45
  72. package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
  73. package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +13 -20
  74. package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
  75. package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts +26 -0
  76. package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts.map +1 -0
  77. package/dist/modules/balances/getMultichainTokenBalances/index.d.ts +2 -0
  78. package/dist/modules/balances/getMultichainTokenBalances/index.d.ts.map +1 -0
  79. package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts +56 -0
  80. package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts.map +1 -0
  81. package/dist/modules/balances/getTokenBalances/index.d.ts +3 -0
  82. package/dist/modules/balances/getTokenBalances/index.d.ts.map +1 -0
  83. package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts +2 -1
  84. package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts.map +1 -1
  85. package/dist/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.d.ts.map +1 -1
  86. package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts +1 -1
  87. package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts.map +1 -1
  88. package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts +1 -1
  89. package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts.map +1 -1
  90. package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
  91. package/dist/modules/checkout/prepareCheckoutTransaction/prepareCheckoutTransaction.d.ts.map +1 -1
  92. package/dist/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.d.ts +22 -0
  93. package/dist/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.d.ts.map +1 -0
  94. package/dist/modules/checkout/utils/clearCheckoutSessionToken/index.d.ts +3 -0
  95. package/dist/modules/checkout/utils/clearCheckoutSessionToken/index.d.ts.map +1 -0
  96. package/dist/modules/checkout/utils/subscribeToCheckoutTransaction/subscribeToCheckoutTransaction.d.ts.map +1 -1
  97. package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/index.d.ts +3 -0
  98. package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/index.d.ts.map +1 -0
  99. package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.d.ts +16 -0
  100. package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.d.ts.map +1 -0
  101. package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
  102. package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts +5 -0
  103. package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts.map +1 -0
  104. package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts +5 -0
  105. package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts.map +1 -0
  106. package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts +5 -0
  107. package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts.map +1 -0
  108. package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts +14 -0
  109. package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts.map +1 -0
  110. package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts +2 -0
  111. package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts.map +1 -0
  112. package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts +15 -0
  113. package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts.map +1 -0
  114. package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts +2 -0
  115. package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts.map +1 -0
  116. package/dist/modules/funding/moonpay/moonpay.types.d.ts +26 -0
  117. package/dist/modules/funding/moonpay/moonpay.types.d.ts.map +1 -0
  118. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts +12 -0
  119. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts.map +1 -1
  120. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts +26 -0
  121. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts.map +1 -0
  122. package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts +18 -0
  123. package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts.map +1 -0
  124. package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts +2 -2
  125. package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts.map +1 -1
  126. package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts +2 -1
  127. package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts.map +1 -1
  128. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +2 -1
  129. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
  130. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +2 -1
  131. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
  132. package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts +13 -1
  133. package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts.map +1 -1
  134. package/dist/modules/user/refreshAuth/refreshAuth.d.ts +2 -1
  135. package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
  136. package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts +27 -0
  137. package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts.map +1 -0
  138. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +8 -5
  139. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -1
  140. package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +11 -4
  141. package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -1
  142. package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -1
  143. package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts.map +1 -1
  144. package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts +35 -0
  145. package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts.map +1 -0
  146. package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts +2 -0
  147. package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts.map +1 -0
  148. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +9 -14
  149. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
  150. package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts +1 -1
  151. package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts +1 -1
  152. package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +1 -1
  153. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +34 -35
  154. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
  155. package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +1 -1
  156. package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
  157. package/dist/modules/wallets/constants.d.ts +7 -0
  158. package/dist/modules/wallets/constants.d.ts.map +1 -1
  159. package/dist/modules/wallets/getAvailableWalletProvidersData/getAvailableWalletProvidersData.d.ts.map +1 -1
  160. package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts +26 -0
  161. package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts.map +1 -0
  162. package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts +2 -0
  163. package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts.map +1 -0
  164. package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts +2 -0
  165. package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts.map +1 -0
  166. package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts +14 -0
  167. package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts.map +1 -0
  168. package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +6 -17
  169. package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
  170. package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts +24 -0
  171. package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts.map +1 -0
  172. package/dist/modules/wallets/networks/getNativeBalance/index.d.ts +2 -0
  173. package/dist/modules/wallets/networks/getNativeBalance/index.d.ts.map +1 -0
  174. package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/index.d.ts +2 -0
  175. package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/index.d.ts.map +1 -0
  176. package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/reconcileWalletAccountsAgainstClient.d.ts +25 -0
  177. package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/reconcileWalletAccountsAgainstClient.d.ts.map +1 -0
  178. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +10 -0
  179. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
  180. package/dist/services/instrumentation/connectLoggerToInstrumentation/connectLoggerToInstrumentation.d.ts.map +1 -1
  181. package/dist/services/instrumentation/constants.d.ts +22 -0
  182. package/dist/services/instrumentation/constants.d.ts.map +1 -1
  183. package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts.map +1 -1
  184. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  185. package/dist/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.d.ts +29 -0
  186. package/dist/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.d.ts.map +1 -0
  187. package/dist/utils/appendConnectionUriToDeeplink/index.d.ts +2 -0
  188. package/dist/utils/appendConnectionUriToDeeplink/index.d.ts.map +1 -0
  189. package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts +22 -0
  190. package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts.map +1 -0
  191. package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts +2 -0
  192. package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts.map +1 -0
  193. package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts +18 -0
  194. package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts.map +1 -0
  195. package/dist/utils/getNativeLinkScheme/index.d.ts +3 -0
  196. package/dist/utils/getNativeLinkScheme/index.d.ts.map +1 -0
  197. package/dist/utils/isMobile/isMobile.d.ts +8 -0
  198. package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
  199. package/dist/waas.cjs +8 -9
  200. package/dist/waas.cjs.map +1 -1
  201. package/dist/waas.esm.js +3 -3
  202. package/dist/waas.native.esm.js +3 -3
  203. package/dist/waasCore.cjs +3 -4
  204. package/dist/waasCore.cjs.map +1 -1
  205. package/dist/waasCore.esm.js +3 -3
  206. package/dist/waasCore.native.esm.js +3 -3
  207. package/package.json +4 -4
  208. package/dist/InvalidParamError-9kQBK3sP.native.esm.js.map +0 -1
  209. package/dist/InvalidParamError-DQvZQdQ9.cjs.map +0 -1
  210. package/dist/InvalidParamError-Za4cvW7K.esm.js.map +0 -1
  211. package/dist/NotWaasWalletAccountError-BTMvHTA8.native.esm.js.map +0 -1
  212. package/dist/NotWaasWalletAccountError-By3Y4taq.esm.js.map +0 -1
  213. package/dist/NotWaasWalletAccountError-Ciq7b-Y6.cjs.map +0 -1
  214. package/dist/getNetworkProviderFromNetworkId-BA0CHZzu.cjs.map +0 -1
  215. package/dist/getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js.map +0 -1
  216. package/dist/getNetworkProviderFromNetworkId-RWcIZDgC.esm.js.map +0 -1
  217. package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js +0 -701
  218. package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js.map +0 -1
  219. package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs +0 -887
  220. package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs.map +0 -1
  221. package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js +0 -701
  222. package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js.map +0 -1
  223. package/dist/isMfaRequiredForAction-C1u4Z__n.esm.js.map +0 -1
  224. package/dist/isMfaRequiredForAction-CMClgbT0.cjs.map +0 -1
  225. package/dist/isMfaRequiredForAction-DSX-TV2z.native.esm.js.map +0 -1
@@ -1,701 +0,0 @@
1
- import { C as isCookieEnabled, F as getDefaultClient, R as BaseError, i as DYNAMIC_WAAS_METADATA, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, w as assertDefined, z as getCore } from "./InvalidParamError-Za4cvW7K.esm.js";
2
- import { JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
3
-
4
- //#region src/utils/setCookie/setCookie.ts
5
- /**
6
- * Sefelly sets the cookie in the browser.
7
- * @not-instrumented
8
- */
9
- const setCookie = (cookie) => {
10
- document.cookie = cookie;
11
- };
12
-
13
- //#endregion
14
- //#region src/modules/clientEvents/clientEvents.ts
15
- /**
16
- * Adds an event listener for Dynamic client events.
17
- *
18
- * This function allows you to listen for various events emitted by the Dynamic client,
19
- * such as authentication state changes, wallet connections, and more.
20
- *
21
- * @param params.event - The event name to listen for.
22
- * @param params.listener - The callback function to execute when the event is fired.
23
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
24
- * @returns A function that can be called to remove the listener.
25
- * @not-instrumented
26
- */
27
- const onEvent = ({ event, listener }, client = getDefaultClient()) => {
28
- const { eventEmitter } = getCore(client);
29
- eventEmitter.on(event, listener);
30
- return () => {
31
- eventEmitter.off(event, listener);
32
- };
33
- };
34
- /**
35
- * Removes an event listener from Dynamic client events.
36
- *
37
- * This function unsubscribes a previously registered event listener
38
- * from the specified Dynamic client event.
39
- *
40
- * @param params.event - The event name to remove the listener from.
41
- * @param params.listener - The callback function to remove.
42
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
43
- * @not-instrumented
44
- */
45
- const offEvent = ({ event, listener }, client = getDefaultClient()) => {
46
- const { eventEmitter } = getCore(client);
47
- eventEmitter.off(event, listener);
48
- };
49
- /**
50
- * Adds a one-time event listener for Dynamic client events.
51
- *
52
- * This function listens for an event that will automatically remove itself
53
- * after being triggered once.
54
- *
55
- * @param params.event - The event name to listen for.
56
- * @param params.listener - The callback function to execute when the event is fired.
57
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
58
- * @returns A function that can be called to remove the listener before it fires.
59
- * @not-instrumented
60
- */
61
- const onceEvent = ({ event, listener }, client = getDefaultClient()) => {
62
- const { eventEmitter } = getCore(client);
63
- eventEmitter.once(event, listener);
64
- return () => {
65
- eventEmitter.off(event, listener);
66
- };
67
- };
68
- /**
69
- * Emits a Dynamic client event.
70
- *
71
- * This function triggers an event that will be received by all registered
72
- * listeners for the specified event type.
73
- *
74
- * @param params.event - The event name to emit.
75
- * @param params.args - The arguments to pass to event listeners.
76
- * @param client - The Dynamic client instance.
77
- * @not-instrumented
78
- */
79
- const emitEvent = ({ event, args }, client) => {
80
- const { eventEmitter } = getCore(client);
81
- eventEmitter.emit(event, args);
82
- };
83
-
84
- //#endregion
85
- //#region src/errors/InvalidWalletProviderKeyError.ts
86
- var InvalidWalletProviderKeyError = class extends BaseError {
87
- constructor(value) {
88
- super({
89
- cause: null,
90
- code: "invalid_wallet_provider_key",
91
- docsUrl: null,
92
- name: "InvalidWalletProviderKeyError",
93
- shortMessage: `Invalid wallet provider key: ${value}. Key must be in the format of <normalizedWalletNameWithChain>:<walletProviderType>[:<suffix>]`
94
- });
95
- }
96
- };
97
-
98
- //#endregion
99
- //#region src/modules/wallets/walletProvider/splitWalletProviderKey/splitWalletProviderKey.ts
100
- /** @not-instrumented */
101
- const splitWalletProviderKey = (walletProviderKey) => {
102
- const [normalizedWalletNameWithChain, walletProviderType, suffix, ...rest] = walletProviderKey.split(":");
103
- if (!normalizedWalletNameWithChain || !Object.values(WalletProviderEnum).includes(walletProviderType) || rest.length > 0) throw new InvalidWalletProviderKeyError(walletProviderKey);
104
- return {
105
- normalizedWalletNameWithChain,
106
- suffix,
107
- walletProviderType
108
- };
109
- };
110
-
111
- //#endregion
112
- //#region src/modules/wallets/utils/normalizeAddress/normalizeAddress.ts
113
- /** @not-instrumented */
114
- const normalizeAddress = ({ address, chain }) => {
115
- let normalizedAddress = address;
116
- if (normalizedAddress?.startsWith("0x")) normalizedAddress = normalizedAddress.slice(2);
117
- normalizedAddress = ["EVM", "FLOW"].includes(chain) ? normalizedAddress?.toLowerCase() : normalizedAddress;
118
- return normalizedAddress;
119
- };
120
-
121
- //#endregion
122
- //#region src/modules/wallets/utils/formatWalletAccountId/formatWalletAccountId.ts
123
- /** @not-instrumented */
124
- const formatWalletAccountId = ({ address, chain, walletProviderKey }) => {
125
- const { normalizedWalletNameWithChain } = splitWalletProviderKey(walletProviderKey);
126
- return `${normalizedWalletNameWithChain}:${normalizeAddress({
127
- address,
128
- chain
129
- })}`;
130
- };
131
-
132
- //#endregion
133
- //#region src/modules/wallets/utils/convertUnverifiedWalletAccountToWalletAccount/convertUnverifiedWalletAccountToWalletAccount.ts
134
- /** @not-instrumented */
135
- const convertUnverifiedWalletAccountToWalletAccount = ({ unverifiedWalletAccount }) => ({
136
- address: unverifiedWalletAccount.address,
137
- addressesWithTypes: unverifiedWalletAccount.addressesWithTypes,
138
- chain: unverifiedWalletAccount.chain,
139
- id: formatWalletAccountId({
140
- address: unverifiedWalletAccount.address,
141
- chain: unverifiedWalletAccount.chain,
142
- walletProviderKey: unverifiedWalletAccount.walletProviderKey
143
- }),
144
- lastSelectedAt: unverifiedWalletAccount.lastSelectedAt,
145
- verifiedCredentialId: null,
146
- walletProviderKey: unverifiedWalletAccount.walletProviderKey
147
- });
148
-
149
- //#endregion
150
- //#region src/modules/wallets/utils/normalizeWalletNameWithChain/normalizeWalletNameWithChain.ts
151
- /**
152
- * Format the raw wallet name and chain to get the value we can use for
153
- * verified credentials' `walletName` field.
154
- * @not-instrumented
155
- */
156
- const normalizeWalletNameWithChain = ({ displayName, chain }) => {
157
- const sanitizedWalletName = displayName.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
158
- const chainLowered = chain.toLocaleLowerCase();
159
- if (sanitizedWalletName.endsWith(chainLowered)) return sanitizedWalletName;
160
- return `${sanitizedWalletName}${chainLowered}`;
161
- };
162
-
163
- //#endregion
164
- //#region src/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.ts
165
- /**
166
- * Assembles the wallet provider key from the wallet name, chain, and wallet provider type.
167
- *
168
- * The suffix is optional and can be used to add a uniquely identifying string to the key, which
169
- * might be necessary for some wallet providers (like Wallet Connect).
170
- *
171
- * IMPORTANT: Do NOT add a suffix unless absolutely necessary, as it will cause the wallet account
172
- * to not be able to find its wallet provider when connecting to a new device (it won't be possible
173
- * to determine the full key just from the Verified Credential data).
174
- * @not-instrumented
175
- */
176
- const formatWalletProviderKey = ({ suffix, chain, displayName, walletProviderType }) => {
177
- return `${normalizeWalletNameWithChain({
178
- chain,
179
- displayName
180
- })}:${walletProviderType}${suffix ? `:${suffix}` : ""}`;
181
- };
182
-
183
- //#endregion
184
- //#region src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/getWalletProviderKeyFromVerifiedCredential.ts
185
- /** @not-instrumented */
186
- const getWalletProviderKeyFromVerifiedCredential = ({ verifiedCredential }, client) => {
187
- const { walletProviderKeyMap } = getCore(client).state.get();
188
- const storedWalletProviderKey = walletProviderKeyMap[verifiedCredential.id];
189
- if (storedWalletProviderKey) return { walletProviderKey: storedWalletProviderKey };
190
- /**
191
- * We fallback to comprising the wallet provider key from walletName and walletProvider.
192
- *
193
- * Some wallet provider types (like Wallet Connect) also use a special suffix for their wallet provider
194
- * keys, so this won't be enough for them.
195
- * Therefore, for those specific wallet providers, the wallet account will remain without a wallet provider
196
- * and will require reconnection.
197
- * Read walletProvider.types.ts for more info.
198
- */
199
- assertDefined(verifiedCredential.walletName, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing walletName`);
200
- assertDefined(verifiedCredential.walletProvider, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing walletProvider`);
201
- assertDefined(verifiedCredential.chain, `Failed to get wallet provider for verified credential with ID ${verifiedCredential.id}: missing chain`);
202
- return { walletProviderKey: formatWalletProviderKey({
203
- chain: getChainFromVerifiedCredentialChain(verifiedCredential.chain),
204
- displayName: verifiedCredential.walletName,
205
- walletProviderType: verifiedCredential.walletProvider
206
- }) };
207
- };
208
-
209
- //#endregion
210
- //#region src/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.ts
211
- /** @not-instrumented */
212
- const convertVerifiedCredentialToWalletAccount = ({ verifiedCredential }, client) => {
213
- assertDefined(verifiedCredential.address, "Missing address in verified credential");
214
- assertDefined(verifiedCredential.chain, "Missing chain in verified credential");
215
- const chain = getChainFromVerifiedCredentialChain(verifiedCredential.chain);
216
- const { walletProviderKey } = getWalletProviderKeyFromVerifiedCredential({ verifiedCredential }, client);
217
- const walletAccountId = formatWalletAccountId({
218
- address: verifiedCredential.address,
219
- chain,
220
- walletProviderKey
221
- });
222
- return {
223
- address: verifiedCredential.address,
224
- addressesWithTypes: verifiedCredential.walletAdditionalAddresses,
225
- chain,
226
- hardwareWalletVendor: verifiedCredential.walletProperties?.hardwareWallet,
227
- id: walletAccountId,
228
- lastSelectedAt: verifiedCredential.lastSelectedAt ?? null,
229
- verifiedCredentialId: verifiedCredential.id,
230
- walletProviderKey
231
- };
232
- };
233
-
234
- //#endregion
235
- //#region src/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.ts
236
- /** @not-instrumented */
237
- const getWalletAccountsFromState = ({ unverifiedWalletAccounts, user }, client) => {
238
- const walletAccountsMap = /* @__PURE__ */ new Map();
239
- /**
240
- * Handle the unverified wallet accounts before the user verified credentials
241
- * so the later verified wallet accounts can override the unverified wallet accounts
242
- */
243
- unverifiedWalletAccounts.forEach((unverifiedWalletAccount) => {
244
- const walletAccount = convertUnverifiedWalletAccountToWalletAccount({ unverifiedWalletAccount });
245
- walletAccountsMap.set(walletAccount.id, walletAccount);
246
- });
247
- (user?.verifiedCredentials ?? []).filter((verified) => verified.format === JwtVerifiedCredentialFormatEnum.Blockchain).forEach((verifiedWalletAccount) => {
248
- const walletAccount = convertVerifiedCredentialToWalletAccount({ verifiedCredential: verifiedWalletAccount }, client);
249
- walletAccountsMap.set(walletAccount.id, walletAccount);
250
- });
251
- return Array.from(walletAccountsMap.values());
252
- };
253
-
254
- //#endregion
255
- //#region src/modules/wallets/getWalletAccounts/getWalletAccounts.ts
256
- /**
257
- * Retrieves all wallet accounts associated with the current session.
258
- *
259
- * This function returns both verified and unverified wallet accounts,
260
- * combining data from user credentials and local unverified accounts.
261
- * You can differentiate between verified and unverified wallet accounts by
262
- * checking the `verifiedCredentialId` property.
263
- *
264
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
265
- * @returns An array of wallet accounts associated with the session.
266
- * @not-instrumented
267
- */
268
- const getWalletAccounts = (client = getDefaultClient()) => {
269
- const { unverifiedWalletAccounts, user } = getCore(client).state.get();
270
- return getWalletAccountsFromState({
271
- unverifiedWalletAccounts,
272
- user
273
- }, client);
274
- };
275
-
276
- //#endregion
277
- //#region src/errors/NoWalletProviderFoundError.ts
278
- var NoWalletProviderFoundError = class extends BaseError {
279
- constructor({ walletProviderKey }) {
280
- super({
281
- cause: null,
282
- code: "no_wallet_provider_found_error",
283
- docsUrl: null,
284
- name: "NoWalletProviderFoundError",
285
- shortMessage: `No wallet provider found with key: ${walletProviderKey}`
286
- });
287
- }
288
- };
289
-
290
- //#endregion
291
- //#region src/services/runtimeServices/createRuntimeServiceAccessKey/createRuntimeServiceAccessKey.ts
292
- /**
293
- * Creates a service accessor function that manages service instantiation and caching.
294
- * The returned function will either retrieve an existing service from the registry or
295
- * create a new one using the provided builder function.
296
- *
297
- * @template - The type of service to be created/accessed
298
- * @param key - Unique identifier for the service in the registry
299
- * @param builder - Function that creates the service instance when called with a DynamicClient
300
- * @not-instrumented
301
- */
302
- const createRuntimeServiceAccessKey = (key, builder) => (client) => {
303
- const { runtimeServices } = getCore(client);
304
- const currentService = runtimeServices.getByKey(key);
305
- if (currentService) return currentService;
306
- const service = builder(client);
307
- runtimeServices.register(key, service);
308
- return service;
309
- };
310
-
311
- //#endregion
312
- //#region src/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.ts
313
- /**
314
- * Creates a new wallet provider registry that manages wallet providers with priority-based registration.
315
- *
316
- * @returns The wallet provider registry instance
317
- *
318
- * @example
319
- * ```typescript
320
- * const registry = createWalletProviderRegistry();
321
- *
322
- * registry.register({
323
- * priority: WalletProviderPriority.WALLET_SDK,
324
- * walletProvider: myWalletProvider
325
- * });
326
- *
327
- * const provider = registry.getByKey('my-wallet-key');
328
- * const providers = registry.listProviders();
329
- * ```
330
- * @not-instrumented
331
- */
332
- const createWalletProviderRegistry = (client) => {
333
- const registry = /* @__PURE__ */ new Map();
334
- return {
335
- getByKey: (key) => registry.get(key)?.walletProvider,
336
- listProviderEntries: () => Array.from(registry.values()),
337
- listProviders: () => Array.from(registry.values()).map((v) => v.walletProvider),
338
- register: (args) => {
339
- const existingEntry = registry.get(args.walletProvider.key);
340
- if (existingEntry) {
341
- if (existingEntry.priority < args.priority) {
342
- registry.set(args.walletProvider.key, args);
343
- emitEvent({
344
- args: { walletProviderKey: args.walletProvider.key },
345
- event: "walletProviderChanged"
346
- }, client);
347
- }
348
- } else {
349
- registry.set(args.walletProvider.key, args);
350
- emitEvent({
351
- args: { walletProvider: args.walletProvider },
352
- event: "walletProviderRegistered"
353
- }, client);
354
- emitEvent({
355
- args: { walletProviderKey: args.walletProvider.key },
356
- event: "walletProviderChanged"
357
- }, client);
358
- }
359
- },
360
- unregister: (key) => {
361
- registry.delete(key);
362
- emitEvent({
363
- args: { walletProviderKey: key },
364
- event: "walletProviderUnregistered"
365
- }, client);
366
- }
367
- };
368
- };
369
-
370
- //#endregion
371
- //#region src/modules/wallets/walletProviderRegistry/getWalletProviderRegistry/getWalletProviderRegistry.ts
372
- /**
373
- * This function provides access to a shared instance of the wallet provider registry.
374
- *
375
- * It ensures that the same registry instance is used throughout the client to maintaining
376
- * consistency of registered wallet providers across different parts of the codebase.
377
- *
378
- * @returns The wallet provider registry instance
379
- *
380
- * @example
381
- * ```typescript
382
- * // Get the registry instance
383
- * const registry = getWalletProviderRegistry();
384
- *
385
- * // Register a wallet provider
386
- * registry.register({
387
- * priority: WalletProviderPriority.WALLET_SDK,
388
- * walletProvider: myWalletProvider
389
- * });
390
- *
391
- * // Retrieve a specific provider
392
- * const provider = registry.getByKey('metamaskevm');
393
- * ```
394
- */
395
- const getWalletProviderRegistry = createRuntimeServiceAccessKey("walletProviderRegistry", (client) => createWalletProviderRegistry(client));
396
-
397
- //#endregion
398
- //#region src/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.ts
399
- let WalletProviderPriority = /* @__PURE__ */ function(WalletProviderPriority$1) {
400
- /**
401
- * Highest priority should be used by wallet providers that implement
402
- * the most reliable wallet integration.
403
- * example: The SDK provided by the wallet provider.
404
- */
405
- WalletProviderPriority$1[WalletProviderPriority$1["WALLET_SDK"] = 100] = "WALLET_SDK";
406
- /**
407
- * Medium priority should be used by wallet providers that implement
408
- * a wallet integration via some reliable standard.
409
- * example: A wallet provider that uses EIP6963 announcement.
410
- */
411
- WalletProviderPriority$1[WalletProviderPriority$1["WALLET_SELF_ANNOUNCEMENT_STANDARD"] = 50] = "WALLET_SELF_ANNOUNCEMENT_STANDARD";
412
- /**
413
- * Low priority should be used by wallet providers that implement
414
- * a wallet integration on a less reliable standard.
415
- * example: A wallet provider that uses window.ethereum, where the
416
- * window key can be overridden by other extensions.
417
- */
418
- WalletProviderPriority$1[WalletProviderPriority$1["WINDOW_INJECT"] = 20] = "WINDOW_INJECT";
419
- return WalletProviderPriority$1;
420
- }({});
421
-
422
- //#endregion
423
- //#region src/modules/wallets/utils/getWalletProviderFromWalletAccount/getWalletProviderFromWalletAccount.ts
424
- /** @not-instrumented */
425
- const getWalletProviderFromWalletAccount = ({ walletAccount }, client) => {
426
- const walletProvider = getWalletProviderRegistry(client).getByKey(walletAccount.walletProviderKey);
427
- if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey: walletAccount.walletProviderKey });
428
- return walletProvider;
429
- };
430
-
431
- //#endregion
432
- //#region src/modules/auth/consts.ts
433
- const DYNAMIC_AUTH_COOKIE_NAME = "DYNAMIC_JWT_TOKEN";
434
-
435
- //#endregion
436
- //#region src/modules/wallets/emitWalletAccountsChangedEvent/emitWalletAccountsChangedEvent.ts
437
- /**
438
- * Emits the `walletAccountsChanged` event.
439
- * @not-instrumented
440
- */
441
- const emitWalletAccountsChangedEvent = (client) => {
442
- emitEvent({
443
- args: { walletAccounts: getWalletAccounts(client) },
444
- event: "walletAccountsChanged"
445
- }, client);
446
- };
447
-
448
- //#endregion
449
- //#region src/modules/auth/updateAuthFromVerifyResponse/checkAndRaiseWalletAccountsChangedEvent/checkAndRaiseWalletAccountsChangedEvent.ts
450
- /** @not-instrumented */
451
- const checkAndRaiseWalletAccountsChangedEvent = ({ previousState }, client) => {
452
- const core = getCore(client);
453
- if (getWalletAccountsHash(previousState, client) !== getWalletAccountsHash(core.state.get(), client)) emitWalletAccountsChangedEvent(client);
454
- };
455
- const getWalletAccountsHash = (state, client) => getWalletAccountsFromState(state, client).map((walletAccount) => JSON.stringify(walletAccount)).sort().join("-");
456
-
457
- //#endregion
458
- //#region src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.ts
459
- /**
460
- * Checks if the user requires additional MFA authentication.
461
- *
462
- * This function determines if the current user session requires
463
- * additional multi-factor authentication to access certain features.
464
- *
465
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
466
- * @returns True if the user needs additional MFA authentication, false otherwise.
467
- * @not-instrumented
468
- */
469
- const isUserMissingMfaAuth = (client = getDefaultClient()) => {
470
- const user = client.user;
471
- assertDefined(user, "User not logged in");
472
- return Boolean(user.scope?.includes("requiresAdditionalAuth"));
473
- };
474
-
475
- //#endregion
476
- //#region src/modules/wallets/getWalletProviders/getWalletProviders.ts
477
- /**
478
- * Get all available wallet providers to interact with internally.
479
- * @not-instrumented
480
- */
481
- const getWalletProviders = (client) => {
482
- return getWalletProviderRegistry(client).listProviders();
483
- };
484
-
485
- //#endregion
486
- //#region src/modules/waas/isWaasWalletProvider/isWaasWalletProvider.ts
487
- /** @not-instrumented */
488
- const isWaasWalletProvider = (walletProvider) => {
489
- return walletProvider.key.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
490
- };
491
-
492
- //#endregion
493
- //#region src/modules/waas/findWaasWalletProviderByChain/findWaasWalletProviderByChain.ts
494
- /** @not-instrumented */
495
- const findWaasWalletProviderByChain = ({ chain }, client) => {
496
- const providers = getWalletProviders(client);
497
- const waasProviderKey = formatWalletProviderKey({
498
- chain,
499
- displayName: DYNAMIC_WAAS_METADATA.displayName,
500
- walletProviderType: WalletProviderEnum.EmbeddedWallet
501
- });
502
- const waasProvider = providers.find((provider) => provider.key === waasProviderKey && provider.chain === chain);
503
- if (!waasProvider || !isWaasWalletProvider(waasProvider)) return null;
504
- return waasProvider;
505
- };
506
-
507
- //#endregion
508
- //#region src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.ts
509
- /**
510
- * This function determines whether the provided wallet account is a Dynamic
511
- * WaaS wallet account.
512
- *
513
- * @param params.walletAccount - The wallet account to check.
514
- * @returns True if the wallet account is a WaaS wallet account, false otherwise.
515
- * @not-instrumented
516
- */
517
- const isWaasWalletAccount = ({ walletAccount }) => {
518
- return walletAccount.walletProviderKey.includes(DYNAMIC_WAAS_METADATA.normalizedWalletName);
519
- };
520
-
521
- //#endregion
522
- //#region src/modules/waas/restoreUserSharesForAllWalletAccounts/restoreUserSharesForAllWalletAccounts.ts
523
- /** @not-instrumented */
524
- const restoreUserSharesForAllWalletAccounts = async (client) => {
525
- /**
526
- * Restoring the user shares will fails if the user is missing the MFA auth.
527
- * This early return prevents the attempt to restore the user shares to fail
528
- * when we know it will fails and just add noise to the logs.
529
- */
530
- if (isUserMissingMfaAuth(client)) return;
531
- const waasWalletAccounts = getWalletAccounts(client).filter((walletAccount) => isWaasWalletAccount({ walletAccount }));
532
- await Promise.all(waasWalletAccounts.map(async (walletAccount) => {
533
- const provider = findWaasWalletProviderByChain({ chain: walletAccount.chain }, client);
534
- /**
535
- * The environment might not have the embedded wallet extensions installed.
536
- * In that case there is no provider for the chain and we can skip restoring the user share.
537
- */
538
- if (!provider) return;
539
- return provider.restoreUserShareForWalletAccount({ walletAccount });
540
- }));
541
- };
542
-
543
- //#endregion
544
- //#region src/modules/auth/decodeJwt/decodeJwt.ts
545
- /**
546
- * Decodes a JWT token and returns the full payload.
547
- *
548
- * This function extracts and returns the complete JWT payload including scopes,
549
- * expiration time, and other claims.
550
- *
551
- * @param jwt - The JWT token string.
552
- * @returns The decoded JWT payload object.
553
- * @throws InvalidParamError if the token is invalid or cannot be decoded.
554
- *
555
- * @example
556
- * ```typescript
557
- * const payload = decodeJwt(jwt);
558
- * // Returns: { scopes: ['wallet:export'], exp: 1234567890, ... }
559
- * ```
560
- * @not-instrumented
561
- */
562
- const decodeJwt = (jwt) => {
563
- try {
564
- const parts = jwt.split(".");
565
- if (parts.length !== 3) throw new InvalidParamError("Invalid JWT format");
566
- const base64Payload = parts[1].replaceAll("-", "+").replaceAll("_", "/");
567
- const paddedPayload = base64Payload + "=".repeat((4 - base64Payload.length % 4) % 4);
568
- const decodedPayload = atob(paddedPayload);
569
- return JSON.parse(decodedPayload);
570
- } catch (error) {
571
- if (error instanceof InvalidParamError) throw error;
572
- throw new InvalidParamError(`Failed to decode JWT: ${error instanceof Error ? error.message : String(error)}`);
573
- }
574
- };
575
-
576
- //#endregion
577
- //#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.ts
578
- /**
579
- * Normalizes scopes by deduplicating and sorting them.
580
- * This creates a canonical representation for comparison.
581
- *
582
- * @param scopes - Array of scope strings (may contain duplicates)
583
- * @returns Normalized, sorted array of unique scopes
584
- * @not-instrumented
585
- */
586
- const normalizeScopes = (scopes) => {
587
- return [...new Set(scopes)].sort((a, b) => a.localeCompare(b));
588
- };
589
-
590
- //#endregion
591
- //#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.ts
592
- /**
593
- * Validates and parses an elevated access token from a JWT string.
594
- * Extracts scopes, expiration, and validates the token structure.
595
- *
596
- * Policy decisions:
597
- * - Tokens without scopes are rejected (returns null)
598
- * - Tokens with empty scopes array are rejected (returns null)
599
- * - Tokens without exp field are rejected (returns null)
600
- * - Expired tokens are rejected (returns null)
601
- *
602
- * @returns Parsed token data or null if token is invalid/expired
603
- * @not-instrumented
604
- */
605
- const parseElevatedAccessToken = ({ token }) => {
606
- const payload = decodeJwt(token);
607
- const filteredScopes = ((payload?.scope)?.split(" ") ?? []).filter((s) => s.length > 0);
608
- const singleUse = payload.singleUse ?? false;
609
- if (!filteredScopes || filteredScopes.length === 0) return null;
610
- if (!payload.exp) return null;
611
- const expiresAt = /* @__PURE__ */ new Date(payload.exp * 1e3);
612
- if (expiresAt <= /* @__PURE__ */ new Date()) return null;
613
- return {
614
- expiresAt,
615
- normalizedScopes: normalizeScopes(filteredScopes),
616
- scopes: filteredScopes,
617
- singleUse,
618
- token
619
- };
620
- };
621
-
622
- //#endregion
623
- //#region src/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.ts
624
- /**
625
- * Upserts an elevated access token into the current tokens array.
626
- *
627
- * Policy: Only one token per normalized scope-set is allowed.
628
- * If a token with the same normalized scopes exists, it is replaced.
629
- * This ensures we don't accumulate multiple tokens for the same scope combination.
630
- *
631
- * @param currentTokens - Current array of elevated access tokens
632
- * @param newToken - New token to upsert
633
- * @returns Updated array of tokens with the new token upserted
634
- * @not-instrumented
635
- */
636
- const upsertElevatedAccessToken = ({ currentTokens, newToken }) => {
637
- const newScopeKey = normalizeScopes(newToken.scopes).join(" ");
638
- return [...currentTokens.filter((existingToken) => {
639
- return normalizeScopes(existingToken.scopes).join(" ") !== newScopeKey;
640
- }), {
641
- expiresAt: newToken.expiresAt,
642
- scopes: newToken.scopes,
643
- singleUse: newToken.singleUse,
644
- token: newToken.token
645
- }];
646
- };
647
-
648
- //#endregion
649
- //#region src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.ts
650
- /** @not-instrumented */
651
- const updateAuthFromVerifyResponse = ({ response }, client) => {
652
- const core = getCore(client);
653
- const previousState = { ...core.state.get() };
654
- const { user, minifiedJwt, jwt, expiresAt, mfaToken, elevatedAccessToken } = response;
655
- const sessionExpiresAt = /* @__PURE__ */ new Date(expiresAt * 1e3);
656
- const newState = {
657
- legacyToken: jwt ?? null,
658
- sessionExpiresAt,
659
- token: minifiedJwt ?? null,
660
- user
661
- };
662
- if (mfaToken) newState.mfaToken = mfaToken;
663
- const currentTokens = core.state.get().elevatedAccessTokens || [];
664
- newState.elevatedAccessTokens = currentTokens;
665
- if (elevatedAccessToken) {
666
- const parsedToken = parseElevatedAccessToken({ token: elevatedAccessToken });
667
- if (parsedToken) newState.elevatedAccessTokens = upsertElevatedAccessToken({
668
- currentTokens,
669
- newToken: parsedToken
670
- });
671
- }
672
- core.state.set(newState);
673
- /**
674
- * For customers using a sandbox environment with cookies enabled, we need to set the cookie
675
- * programmatically because Redcoast won't set the cookie via headers. We set the cookie programmatically
676
- * so customers can access the cookie from document.cookie consistently between sandbox and live environments.
677
- */
678
- if (minifiedJwt && isCookieEnabled(client)) setCookie(`${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${sessionExpiresAt.toUTCString()}; path=/; SameSite=Lax`);
679
- checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);
680
- if (!previousState.user && Boolean(newState.user)) restoreUserSharesForAllWalletAccounts(client);
681
- };
682
-
683
- //#endregion
684
- //#region src/modules/wallets/getWalletProviderByKey/getWalletProviderByKey.ts
685
- /** @not-instrumented */
686
- const getWalletProviderByKey = ({ walletProviderKey }, client) => {
687
- const walletProvider = getWalletProviders(client).find((walletProvider$1) => walletProvider$1.key === walletProviderKey);
688
- if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey });
689
- return walletProvider;
690
- };
691
-
692
- //#endregion
693
- //#region src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.ts
694
- /** @not-instrumented */
695
- const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client) => {
696
- return client.user?.verifiedCredentials.find((vc) => vc.id === walletAccount.verifiedCredentialId);
697
- };
698
-
699
- //#endregion
700
- export { onceEvent as A, formatWalletAccountId as C, emitEvent as D, InvalidWalletProviderKeyError as E, offEvent as O, normalizeWalletNameWithChain as S, splitWalletProviderKey as T, getWalletProviderRegistry as _, parseElevatedAccessToken as a, getWalletAccounts as b, findWaasWalletProviderByChain as c, isUserMissingMfaAuth as d, checkAndRaiseWalletAccountsChangedEvent as f, WalletProviderPriority as g, getWalletProviderFromWalletAccount as h, upsertElevatedAccessToken as i, setCookie as j, onEvent as k, isWaasWalletProvider as l, DYNAMIC_AUTH_COOKIE_NAME as m, getWalletProviderByKey as n, restoreUserSharesForAllWalletAccounts as o, emitWalletAccountsChangedEvent as p, updateAuthFromVerifyResponse as r, isWaasWalletAccount as s, getVerifiedCredentialForWalletAccount as t, getWalletProviders as u, createRuntimeServiceAccessKey as v, normalizeAddress as w, formatWalletProviderKey as x, NoWalletProviderFoundError as y };
701
- //# sourceMappingURL=getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js.map