@dynamic-labs/sdk-react-core 4.70.0 → 4.72.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/CHANGELOG.md +28 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.cjs +15 -0
- package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.d.ts +1 -0
- package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.js +11 -0
- package/src/lib/client/extension/functions/generateSessionKeys/generateSessionKeys.cjs +11 -0
- package/src/lib/client/extension/functions/generateSessionKeys/generateSessionKeys.d.ts +1 -0
- package/src/lib/client/extension/functions/generateSessionKeys/generateSessionKeys.js +7 -0
- package/src/lib/client/extension/functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders.cjs +33 -0
- package/src/lib/client/extension/functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders.d.ts +16 -0
- package/src/lib/client/extension/functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders.js +29 -0
- package/src/lib/client/extension/functions/getSessionKeys/getSessionKeys.d.ts +1 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.cjs +5 -9
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.d.ts +4 -0
- package/src/lib/client/extension/functions/hasElevatedAccessToken/hasElevatedAccessToken.js +6 -10
- package/src/lib/client/extension/functions/migrateClientSessionKey/migrateClientSessionKey.cjs +51 -0
- package/src/lib/client/extension/functions/migrateClientSessionKey/migrateClientSessionKey.d.ts +1 -0
- package/src/lib/client/extension/functions/migrateClientSessionKey/migrateClientSessionKey.js +47 -0
- package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.cjs +5 -6
- package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.js +5 -6
- package/src/lib/client/extension/hooks/useInitializeSdkClient/syncEvents/syncEvents.cjs +12 -0
- package/src/lib/client/extension/hooks/useInitializeSdkClient/syncEvents/syncEvents.js +12 -0
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.cjs +2 -0
- package/src/lib/client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.js +2 -0
- package/src/lib/client/extension/index.d.ts +4 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +15 -2
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +4 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +15 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +25 -3
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +26 -4
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +4 -1
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +4 -1
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +9 -5
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +9 -5
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +2 -2
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +2 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +2 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +2 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +2 -2
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +0 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +0 -3
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +3 -4
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +3 -4
- package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +10 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +0 -2
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +0 -2
- package/src/lib/data/api/api.cjs +1 -1
- package/src/lib/data/api/api.js +1 -1
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +2 -4
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +2 -4
- package/src/lib/events/deviceRegistration.d.ts +4 -0
- package/src/lib/events/dynamicEvents.cjs +2 -0
- package/src/lib/events/dynamicEvents.d.ts +3 -2
- package/src/lib/events/dynamicEvents.js +2 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.cjs +2 -0
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.d.ts +3 -3
- package/src/lib/store/state/dynamicContextProps/defaultDynamicSettings.js +2 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.cjs +0 -88
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.d.ts +0 -25
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.js +2 -83
- package/src/lib/utils/functions/compareChains/compareChains.cjs +1 -0
- package/src/lib/utils/functions/compareChains/compareChains.js +1 -0
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +0 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +0 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +0 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +0 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +0 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +0 -2
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +2 -2
- package/src/lib/utils/hooks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +4 -12
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +4 -12
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +1 -1
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.cjs +28 -36
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.d.ts +5 -2
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.js +29 -37
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +7 -2
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +7 -2
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +2 -3
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +2 -3
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.cjs +14 -14
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.js +14 -14
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +3 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +3 -3
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs +14 -38
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js +14 -38
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpAuthentication.types.d.ts +3 -2
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpPromptMfa.cjs +4 -1
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpPromptMfa.js +4 -1
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpPromptReauth.cjs +22 -6
- package/src/lib/utils/hooks/useStepUpAuthentication/useStepUpPromptReauth.js +22 -6
- package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.cjs +5 -1
- package/src/lib/utils/hooks/useSyncDeviceRegistrationFlow/useSyncDeviceRegistrationFlow.js +5 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +0 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +0 -2
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +2 -2
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +2 -2
- package/src/lib/views/StepUpReauthOtpView/StepUpReauthOtpView.cjs +1 -109
- package/src/lib/views/StepUpReauthOtpView/StepUpReauthOtpView.js +1 -109
- package/src/lib/views/StepUpReauthSocialView/StepUpReauthSocialView.cjs +1 -2
- package/src/lib/views/StepUpReauthSocialView/StepUpReauthSocialView.js +1 -2
- package/src/lib/views/StepUpReauthWalletView/StepUpReauthWalletView.cjs +2 -96
- package/src/lib/views/StepUpReauthWalletView/StepUpReauthWalletView.js +2 -96
- package/src/lib/views/WalletList/data.cjs +1 -0
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/views/WalletList/data.js +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +1 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +9 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +9 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/TokenBalanceItem/TokenBalanceItem.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js +1 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +22 -0
- package/src/lib/widgets/DynamicWidget/helpers/helpers.js +22 -0
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +60 -5
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +61 -6
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +12 -54
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +12 -54
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js +2 -2
- package/src/lib/data/api/externalAuth/externalAuth.cjs +0 -66
- package/src/lib/data/api/externalAuth/externalAuth.js +0 -62
- package/src/lib/utils/functions/clientSessionKeys/constants.cjs +0 -8
- package/src/lib/utils/functions/clientSessionKeys/constants.js +0 -4
- package/src/lib/utils/hooks/useClientSessionKeys/index.d.ts +0 -1
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs +0 -101
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.d.ts +0 -4
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.js +0 -97
package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
3
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
3
|
import { useCallback } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
7
6
|
import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
|
|
8
|
-
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
9
|
-
import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
10
|
-
import '@dynamic-labs/iconic';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
7
|
import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
|
|
13
8
|
import { ReactComponent as SvgFaceId } from '../../../../../shared/assets/face-id.js';
|
|
14
9
|
import { ReactComponent as SvgLock } from '../../../../../shared/assets/lock.js';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import '
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '../../../../../events/dynamicEvents.js';
|
|
13
|
+
import '../../../../../../../_virtual/_tslib.js';
|
|
18
14
|
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
16
|
+
import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
17
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
18
|
+
import '../../../../../shared/logger.js';
|
|
19
|
+
import '@dynamic-labs/wallet-book';
|
|
19
20
|
import '../../../../../utils/constants/colors.js';
|
|
20
21
|
import '../../../../../utils/constants/values.js';
|
|
21
22
|
import '@dynamic-labs/sdk-api-core';
|
|
22
23
|
import '../../../../../shared/consts/index.js';
|
|
23
|
-
import '../../../../../
|
|
24
|
+
import '../../../../../store/state/authMode/authMode.js';
|
|
24
25
|
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
26
|
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
26
27
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -38,13 +39,11 @@ import '../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTyp
|
|
|
38
39
|
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
39
40
|
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
41
|
import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
41
|
-
import '../../../../../store/state/authMode/authMode.js';
|
|
42
42
|
import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
43
43
|
import 'react-dom';
|
|
44
44
|
import '../../../../../utils/functions/compareChains/compareChains.js';
|
|
45
45
|
import '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
46
46
|
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
47
|
-
import { useSmartWallets } from '../../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
48
47
|
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
49
48
|
import 'bs58';
|
|
50
49
|
import '@dynamic-labs/types';
|
|
@@ -94,7 +93,6 @@ import '../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
|
94
93
|
import '../../../../../context/FooterAnimationContext/index.js';
|
|
95
94
|
import '../../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
96
95
|
import '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
97
|
-
import { useWalletPassword } from '../../../../../utils/hooks/useWalletPassword/useWalletPassword.js';
|
|
98
96
|
import '../../../../../context/OnrampContext/OnrampContext.js';
|
|
99
97
|
import '../../../../../store/state/sendBalances.js';
|
|
100
98
|
import '../../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
@@ -102,7 +100,6 @@ import '../../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardT
|
|
|
102
100
|
import '../../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
103
101
|
import '../../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
104
102
|
import '../../../components/PasskeyCard/PasskeyCard.js';
|
|
105
|
-
import { useIsPasswordEncrypted } from '../../../../../utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.js';
|
|
106
103
|
import '../../CryptoComOnramp/CryptoComOnramp.js';
|
|
107
104
|
import '../../../../../../index.js';
|
|
108
105
|
import '../../ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js';
|
|
@@ -114,60 +111,21 @@ import '../../../../../store/state/tokenBalances.js';
|
|
|
114
111
|
import '../../../../../store/state/multichainBalances.js';
|
|
115
112
|
import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
116
113
|
import { useIsPasskeysMfaEnabled } from '../../../../../utils/hooks/useIsPasskeysMfaEnabled/useIsPasskeysMfaEnabled.js';
|
|
117
|
-
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
118
114
|
|
|
119
115
|
const MfaSection = ({ isLoading }) => {
|
|
120
|
-
var _a, _b;
|
|
121
116
|
const { t } = useTranslation();
|
|
122
117
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
123
|
-
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
124
|
-
const { pushView } = useViewContext();
|
|
125
|
-
const { getEOAWallet } = useSmartWallets();
|
|
126
|
-
const { setPassword } = useWalletPassword();
|
|
127
|
-
const isPasswordEncrypted = useIsPasswordEncrypted();
|
|
128
118
|
const isMfaEnabled = useIsMfaEnabled();
|
|
129
119
|
const isTotpMfaEnabled = useIsTotpMfaEnabled();
|
|
130
120
|
const isPasskeyMfaEnabled = useIsPasskeysMfaEnabled();
|
|
131
|
-
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
132
|
-
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
133
|
-
const isWaasWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('dynamicwaas')));
|
|
134
|
-
const shouldShowPasswordSetup = isWaasWallet;
|
|
135
121
|
const handleTotpMfaClick = useCallback(() => setDynamicWidgetView('manage-totp-mfa'), [setDynamicWidgetView]);
|
|
136
122
|
const handlePasskeyMfaClick = useCallback(() => setDynamicWidgetView('manage-passkeys-mfa'), [setDynamicWidgetView]);
|
|
137
|
-
|
|
138
|
-
setDynamicWidgetView('setup-password', {
|
|
139
|
-
onComplete: (password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address) || !(wallet === null || wallet === void 0 ? void 0 : wallet.chain)) {
|
|
141
|
-
logger.error('No wallet address or chain available for password setup');
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
yield setPassword({
|
|
145
|
-
accountAddress: wallet.address,
|
|
146
|
-
chainName: wallet.chain,
|
|
147
|
-
newPassword: password,
|
|
148
|
-
});
|
|
149
|
-
}),
|
|
150
|
-
});
|
|
151
|
-
}, [setDynamicWidgetView, wallet, setPassword]);
|
|
152
|
-
const handleResetPasswordClick = useCallback(() => {
|
|
153
|
-
setShowAuthFlow(true, {
|
|
154
|
-
ignoreIfIsEmbeddedWidget: false,
|
|
155
|
-
performMultiWalletChecks: false,
|
|
156
|
-
});
|
|
157
|
-
pushView('reset-password-flow');
|
|
158
|
-
}, [setShowAuthFlow, pushView]);
|
|
159
|
-
if (!isMfaEnabled && !isWaasWallet) {
|
|
123
|
+
if (!isMfaEnabled) {
|
|
160
124
|
return null;
|
|
161
125
|
}
|
|
162
126
|
return (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.mfa_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.mfa_section.title') }) }), isPasskeyMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-passkeys-mfa-button', onClick: handlePasskeyMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
163
127
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
164
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })),
|
|
165
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
166
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgLock, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: isPasswordEncrypted
|
|
167
|
-
? 'dyn_settings.account_security.password.reset_button'
|
|
168
|
-
: 'dyn_settings.account_security.password.set_button', children: isPasswordEncrypted
|
|
169
|
-
? t('dyn_settings.account_security.password.reset_button')
|
|
170
|
-
: t('dyn_settings.account_security.password.set_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
128
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
171
129
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
172
130
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgLock, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.totp_button', children: t('dyn_settings.mfa_section.totp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false }))] }));
|
|
173
131
|
};
|
|
@@ -127,7 +127,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
127
127
|
const hasPhoneChange = formValues.phoneNumber !== undefined &&
|
|
128
128
|
formValues.phoneNumber !== (user === null || user === void 0 ? void 0 : user.phoneNumber);
|
|
129
129
|
if ((hasEmailChange || hasPhoneChange) &&
|
|
130
|
-
isStepUpRequired({ scope: sdkApiCore.TokenScope.Credentiallink })) {
|
|
130
|
+
(yield isStepUpRequired({ scope: sdkApiCore.TokenScope.Credentiallink }))) {
|
|
131
131
|
try {
|
|
132
132
|
yield promptStepUpAuth({
|
|
133
133
|
requestedScopes: [sdkApiCore.TokenScope.Credentiallink],
|
|
@@ -123,7 +123,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
123
123
|
const hasPhoneChange = formValues.phoneNumber !== undefined &&
|
|
124
124
|
formValues.phoneNumber !== (user === null || user === void 0 ? void 0 : user.phoneNumber);
|
|
125
125
|
if ((hasEmailChange || hasPhoneChange) &&
|
|
126
|
-
isStepUpRequired({ scope: TokenScope.Credentiallink })) {
|
|
126
|
+
(yield isStepUpRequired({ scope: TokenScope.Credentiallink }))) {
|
|
127
127
|
try {
|
|
128
128
|
yield promptStepUpAuth({
|
|
129
129
|
requestedScopes: [TokenScope.Credentiallink],
|
|
@@ -150,7 +150,7 @@ const ManagePasskeysMfaWidgetView = () => {
|
|
|
150
150
|
return passkeys.map((passkey) => (jsxRuntime.jsx(PasskeyCard.PasskeyCard, { passkey: passkey, onUpdate: retrigger }, passkey.id)));
|
|
151
151
|
};
|
|
152
152
|
return (jsxRuntime.jsxs("div", { className: 'manage-totp-mfa-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys_mfa.title', children: t('dyn_manage_passkeys_mfa.title') }) }) }), jsxRuntime.jsx(ModalHeaderBanner.ModalHeaderBanner, { type: 'error', messageKey: registerPasskeyError ? errorMessage : undefined, className: 'manage-totp-mfa-widget-view__header-banner' }), jsxRuntime.jsx("div", { className: 'manage-totp-mfa-widget-view__scroll-container', children: getPasskeysContent() }), jsxRuntime.jsx("div", { className: 'manage-totp-mfa-widget-view__add-mfa-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
-
if (isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
153
|
+
if (yield isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
154
154
|
try {
|
|
155
155
|
yield promptStepUpAuth({
|
|
156
156
|
requestedScopes: [CREDENTIAL_LINK_SCOPE],
|
|
@@ -146,7 +146,7 @@ const ManagePasskeysMfaWidgetView = () => {
|
|
|
146
146
|
return passkeys.map((passkey) => (jsx(PasskeyCard, { passkey: passkey, onUpdate: retrigger }, passkey.id)));
|
|
147
147
|
};
|
|
148
148
|
return (jsxs("div", { className: 'manage-totp-mfa-widget-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_passkeys_mfa.title', children: t('dyn_manage_passkeys_mfa.title') }) }) }), jsx(ModalHeaderBanner, { type: 'error', messageKey: registerPasskeyError ? errorMessage : undefined, className: 'manage-totp-mfa-widget-view__header-banner' }), jsx("div", { className: 'manage-totp-mfa-widget-view__scroll-container', children: getPasskeysContent() }), jsx("div", { className: 'manage-totp-mfa-widget-view__add-mfa-button-container', children: jsx(TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
-
if (isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
149
|
+
if (yield isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
150
150
|
try {
|
|
151
151
|
yield promptStepUpAuth({
|
|
152
152
|
requestedScopes: [CREDENTIAL_LINK_SCOPE],
|
package/src/lib/widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs
CHANGED
|
@@ -158,7 +158,7 @@ const ManageTotpMfaWidgetView = () => {
|
|
|
158
158
|
}));
|
|
159
159
|
// delete device — use elevated token if step-up is available, else fall back to OTP flow
|
|
160
160
|
const deleteDevice = (id) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
-
if (isStepUpRequired({ scope: MFA_DEVICE_DELETE_SCOPE })) {
|
|
161
|
+
if (yield isStepUpRequired({ scope: MFA_DEVICE_DELETE_SCOPE })) {
|
|
162
162
|
try {
|
|
163
163
|
yield promptStepUpAuth({ requestedScopes: [MFA_DEVICE_DELETE_SCOPE] });
|
|
164
164
|
}
|
|
@@ -184,7 +184,7 @@ const ManageTotpMfaWidgetView = () => {
|
|
|
184
184
|
clearStackAndPush('mfa-display-backup-codes', { regenerateCodes: true });
|
|
185
185
|
});
|
|
186
186
|
return (jsxRuntime.jsxs("div", { className: 'manage-totp-mfa-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_mfa.title', children: t('dyn_manage_mfa.title') }) }) }), jsxRuntime.jsxs("div", { className: 'manage-totp-mfa-widget-view__scroll-container', children: [loading && jsxRuntime.jsx(MfaDeviceTileSkeleton.MfaDeviceTileSkeleton, {}), !loading && userDevices.length === 0 && (jsxRuntime.jsx(Typography.Typography, { className: 'manage-totp-mfa-widget-view__no-devices', variant: 'body_normal', color: 'secondary', copykey: 'dyn_manage_mfa.no_devices', children: t('dyn_manage_mfa.no_devices') })), userDevices.map((device, index) => (jsxRuntime.jsx(UserDeviceTile.UserDeviceTile, { isMfaRequired: isMfaRequired, userDevice: device, index: index, deleteDevice: deleteDevice }, device.id)))] }), jsxRuntime.jsx("div", { className: 'manage-totp-mfa-widget-view__add-mfa-button-container', children: userDevices.length > 0 ? (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: handleGenerateBackupCodes, copykey: 'dyn_manage_mfa.generate_backup_codes_button', children: t('dyn_manage_mfa.generate_backup_codes_button') })) : (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
-
if (isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
187
|
+
if (yield isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
188
188
|
try {
|
|
189
189
|
yield promptStepUpAuth({
|
|
190
190
|
requestedScopes: [CREDENTIAL_LINK_SCOPE],
|
package/src/lib/widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js
CHANGED
|
@@ -154,7 +154,7 @@ const ManageTotpMfaWidgetView = () => {
|
|
|
154
154
|
}));
|
|
155
155
|
// delete device — use elevated token if step-up is available, else fall back to OTP flow
|
|
156
156
|
const deleteDevice = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
-
if (isStepUpRequired({ scope: MFA_DEVICE_DELETE_SCOPE })) {
|
|
157
|
+
if (yield isStepUpRequired({ scope: MFA_DEVICE_DELETE_SCOPE })) {
|
|
158
158
|
try {
|
|
159
159
|
yield promptStepUpAuth({ requestedScopes: [MFA_DEVICE_DELETE_SCOPE] });
|
|
160
160
|
}
|
|
@@ -180,7 +180,7 @@ const ManageTotpMfaWidgetView = () => {
|
|
|
180
180
|
clearStackAndPush('mfa-display-backup-codes', { regenerateCodes: true });
|
|
181
181
|
});
|
|
182
182
|
return (jsxs("div", { className: 'manage-totp-mfa-widget-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_manage_mfa.title', children: t('dyn_manage_mfa.title') }) }) }), jsxs("div", { className: 'manage-totp-mfa-widget-view__scroll-container', children: [loading && jsx(MfaDeviceTileSkeleton, {}), !loading && userDevices.length === 0 && (jsx(Typography, { className: 'manage-totp-mfa-widget-view__no-devices', variant: 'body_normal', color: 'secondary', copykey: 'dyn_manage_mfa.no_devices', children: t('dyn_manage_mfa.no_devices') })), userDevices.map((device, index) => (jsx(UserDeviceTile, { isMfaRequired: isMfaRequired, userDevice: device, index: index, deleteDevice: deleteDevice }, device.id)))] }), jsx("div", { className: 'manage-totp-mfa-widget-view__add-mfa-button-container', children: userDevices.length > 0 ? (jsx(TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: handleGenerateBackupCodes, copykey: 'dyn_manage_mfa.generate_backup_codes_button', children: t('dyn_manage_mfa.generate_backup_codes_button') })) : (jsx(TypographyButton, { buttonClassName: 'manage-totp-mfa-widget-view__add-mfa-button-container__button', onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
-
if (isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
183
|
+
if (yield isStepUpRequired({ scope: CREDENTIAL_LINK_SCOPE })) {
|
|
184
184
|
try {
|
|
185
185
|
yield promptStepUpAuth({
|
|
186
186
|
requestedScopes: [CREDENTIAL_LINK_SCOPE],
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
-
var utils$1 = require('@dynamic-labs/utils');
|
|
9
|
-
require('@dynamic-labs-sdk/client/core');
|
|
10
|
-
require('@dynamic-labs/sdk-api-core');
|
|
11
|
-
require('../../../client/client.cjs');
|
|
12
|
-
require('react');
|
|
13
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
14
|
-
require('@dynamic-labs/iconic');
|
|
15
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
-
require('react/jsx-runtime');
|
|
17
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../../shared/logger.cjs');
|
|
19
|
-
require('@dynamic-labs/wallet-book');
|
|
20
|
-
require('../../../utils/constants/colors.cjs');
|
|
21
|
-
require('../../../utils/constants/values.cjs');
|
|
22
|
-
require('../../../shared/consts/index.cjs');
|
|
23
|
-
require('@dynamic-labs/multi-wallet');
|
|
24
|
-
require('react-international-phone');
|
|
25
|
-
require('../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
var api = require('../api.cjs');
|
|
27
|
-
var utils = require('../utils.cjs');
|
|
28
|
-
require('@dynamic-labs/locale');
|
|
29
|
-
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
30
|
-
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
31
|
-
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
32
|
-
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
33
|
-
require('../../../events/dynamicEvents.cjs');
|
|
34
|
-
var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Use `signInWithExternalJwt` instead.
|
|
38
|
-
* This currently does not work.
|
|
39
|
-
*/
|
|
40
|
-
const externalAuthVerify = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, }) {
|
|
41
|
-
try {
|
|
42
|
-
/* istanbul ignore next */
|
|
43
|
-
const response = (yield api.sdkApi().externalAuthVerify({
|
|
44
|
-
environmentId,
|
|
45
|
-
externalAuthSigninRequest: {
|
|
46
|
-
jwt: externalJwt,
|
|
47
|
-
},
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
}));
|
|
50
|
-
return storeTokenAndUser.storeTokenAndUser(response);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
const data = yield utils.logResponseError(e, 'Error verifying external JWT');
|
|
54
|
-
if (data.code === 'invalid_external_auth') {
|
|
55
|
-
throw new client.InvalidExternalAuthError({
|
|
56
|
-
cause: data,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
60
|
-
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
61
|
-
}
|
|
62
|
-
throw new utils$1.DynamicError(data.error);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
exports.externalAuthVerify = externalAuthVerify;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { InvalidExternalAuthError } from '@dynamic-labs-sdk/client';
|
|
4
|
-
import { SandboxMaximumThresholdReachedError, DynamicError } from '@dynamic-labs/utils';
|
|
5
|
-
import '@dynamic-labs-sdk/client/core';
|
|
6
|
-
import '@dynamic-labs/sdk-api-core';
|
|
7
|
-
import '../../../client/client.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '../../../config/ApiEndpoint.js';
|
|
10
|
-
import '@dynamic-labs/iconic';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
-
import 'react/jsx-runtime';
|
|
13
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import '../../../shared/logger.js';
|
|
15
|
-
import '@dynamic-labs/wallet-book';
|
|
16
|
-
import '../../../utils/constants/colors.js';
|
|
17
|
-
import '../../../utils/constants/values.js';
|
|
18
|
-
import '../../../shared/consts/index.js';
|
|
19
|
-
import '@dynamic-labs/multi-wallet';
|
|
20
|
-
import 'react-international-phone';
|
|
21
|
-
import '../../../store/state/nonce/nonce.js';
|
|
22
|
-
import { sdkApi } from '../api.js';
|
|
23
|
-
import { logResponseError } from '../utils.js';
|
|
24
|
-
import '@dynamic-labs/locale';
|
|
25
|
-
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
26
|
-
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
27
|
-
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
28
|
-
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
29
|
-
import '../../../events/dynamicEvents.js';
|
|
30
|
-
import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use `signInWithExternalJwt` instead.
|
|
34
|
-
* This currently does not work.
|
|
35
|
-
*/
|
|
36
|
-
const externalAuthVerify = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, }) {
|
|
37
|
-
try {
|
|
38
|
-
/* istanbul ignore next */
|
|
39
|
-
const response = (yield sdkApi().externalAuthVerify({
|
|
40
|
-
environmentId,
|
|
41
|
-
externalAuthSigninRequest: {
|
|
42
|
-
jwt: externalJwt,
|
|
43
|
-
},
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
}));
|
|
46
|
-
return storeTokenAndUser(response);
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
const data = yield logResponseError(e, 'Error verifying external JWT');
|
|
50
|
-
if (data.code === 'invalid_external_auth') {
|
|
51
|
-
throw new InvalidExternalAuthError({
|
|
52
|
-
cause: data,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
56
|
-
throw new SandboxMaximumThresholdReachedError(data.error.message);
|
|
57
|
-
}
|
|
58
|
-
throw new DynamicError(data.error);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export { externalAuthVerify };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useClientSessionKeys } from './useClientSessionKeys';
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
require('@dynamic-labs-sdk/client/core');
|
|
10
|
-
require('@dynamic-labs/sdk-api-core');
|
|
11
|
-
require('../../../client/client.cjs');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
14
|
-
require('@dynamic-labs/iconic');
|
|
15
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
-
require('react/jsx-runtime');
|
|
17
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
var logger = require('../../../shared/logger.cjs');
|
|
19
|
-
require('@dynamic-labs/wallet-book');
|
|
20
|
-
require('../../constants/colors.cjs');
|
|
21
|
-
require('../../constants/values.cjs');
|
|
22
|
-
require('../../../shared/consts/index.cjs');
|
|
23
|
-
require('@dynamic-labs/multi-wallet');
|
|
24
|
-
require('react-international-phone');
|
|
25
|
-
require('../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
require('@dynamic-labs/locale');
|
|
27
|
-
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
-
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
-
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
-
var getClientSessionKeys = require('../../functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
31
|
-
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
32
|
-
require('../../../events/dynamicEvents.cjs');
|
|
33
|
-
var getUserProfile = require('../../../client/extension/user/getUserProfile/getUserProfile.cjs');
|
|
34
|
-
var useOnboardingCompleteUser = require('../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.cjs');
|
|
35
|
-
var getMinAuthToken = require('../../../client/extension/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
36
|
-
var sessionStorage = require('../../constants/sessionStorage.cjs');
|
|
37
|
-
|
|
38
|
-
const useClientSessionKeys = () => {
|
|
39
|
-
const user = useOnboardingCompleteUser.useOnboardingCompleteUser();
|
|
40
|
-
const sessionPublicKey = getClientSessionKeys.getClientSessionPublicKey();
|
|
41
|
-
// Use refs to capture latest values without causing function reference changes
|
|
42
|
-
const userRef = React.useRef(user);
|
|
43
|
-
const sessionPublicKeyRef = React.useRef(sessionPublicKey);
|
|
44
|
-
// Update refs on every render
|
|
45
|
-
userRef.current = user;
|
|
46
|
-
sessionPublicKeyRef.current = sessionPublicKey;
|
|
47
|
-
/**
|
|
48
|
-
* Get a signed session ID with nonce for replay protection.
|
|
49
|
-
* Returns signature in format: `${signedSessionId}/${signedNonce}/${nonce}`
|
|
50
|
-
*
|
|
51
|
-
* This is a lazy function - nonce API is only called when this function is invoked.
|
|
52
|
-
*/
|
|
53
|
-
const getSignedSessionId = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
const currentUser = userRef.current;
|
|
55
|
-
const currentPublicKey = sessionPublicKeyRef.current;
|
|
56
|
-
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.sessionId) || !currentPublicKey) {
|
|
57
|
-
logger.logger.instrument('[SessionChaining] Session ID and public key are required', {
|
|
58
|
-
hasClientSessionKeysInSecureStorage: Boolean(utils.StorageService.getItem(sessionStorage.CLIENT_SESSION_KEYS, sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS)),
|
|
59
|
-
hasLocalStorage: Boolean(utils.StorageService.getSourceStorage('localStorage')),
|
|
60
|
-
hasSecureStorage: Boolean(utils.StorageService.getSourceStorage('secureStorage')),
|
|
61
|
-
hasSessionId: currentUser ? Boolean(currentUser.sessionId) : false,
|
|
62
|
-
hasSessionPublicKey: Boolean(currentPublicKey),
|
|
63
|
-
hasSessionStorage: Boolean(utils.StorageService.getSourceStorage('sessionStorage')),
|
|
64
|
-
hasUser: Boolean(currentUser),
|
|
65
|
-
key: 'session_chaining_missing_requirements',
|
|
66
|
-
sessionId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.sessionId,
|
|
67
|
-
sessionPublicKey: currentPublicKey,
|
|
68
|
-
stateHasMinAuthToken: Boolean(getMinAuthToken.getMinAuthToken()),
|
|
69
|
-
stateHasUser: Boolean(getUserProfile.getUserProfile()),
|
|
70
|
-
time: 0,
|
|
71
|
-
userId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.id,
|
|
72
|
-
});
|
|
73
|
-
throw new Error('Session ID and public key are required');
|
|
74
|
-
}
|
|
75
|
-
const { sessionSignature: signedSessionId } = yield getClientSessionKeys.getClientSessionSignature({
|
|
76
|
-
sessionId: currentUser.sessionId,
|
|
77
|
-
});
|
|
78
|
-
const { nonce, nonceSignature } = yield getClientSessionKeys.getClientSessionNonceSignature({
|
|
79
|
-
environmentId: currentUser.projectEnvironmentId,
|
|
80
|
-
});
|
|
81
|
-
const sessionSignature = `${signedSessionId}/${nonceSignature}/${nonce}`;
|
|
82
|
-
logger.logger.instrument('[SessionChaining] Generated session signature', {
|
|
83
|
-
environmentId: currentUser.projectEnvironmentId,
|
|
84
|
-
key: 'generated_session_signature',
|
|
85
|
-
nonce,
|
|
86
|
-
nonceSignature,
|
|
87
|
-
sessionId: currentUser.sessionId,
|
|
88
|
-
sessionPublicKey: currentPublicKey,
|
|
89
|
-
sessionSignature,
|
|
90
|
-
signedSessionId,
|
|
91
|
-
time: 0,
|
|
92
|
-
});
|
|
93
|
-
return sessionSignature;
|
|
94
|
-
}), []);
|
|
95
|
-
return {
|
|
96
|
-
getSignedSessionId,
|
|
97
|
-
sessionPublicKey,
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
exports.useClientSessionKeys = useClientSessionKeys;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useRef, useCallback } from 'react';
|
|
4
|
-
import { StorageService } from '@dynamic-labs/utils';
|
|
5
|
-
import '@dynamic-labs-sdk/client/core';
|
|
6
|
-
import '@dynamic-labs/sdk-api-core';
|
|
7
|
-
import '../../../client/client.js';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
|
-
import '../../../config/ApiEndpoint.js';
|
|
10
|
-
import '@dynamic-labs/iconic';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
-
import 'react/jsx-runtime';
|
|
13
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import { logger } from '../../../shared/logger.js';
|
|
15
|
-
import '@dynamic-labs/wallet-book';
|
|
16
|
-
import '../../constants/colors.js';
|
|
17
|
-
import '../../constants/values.js';
|
|
18
|
-
import '../../../shared/consts/index.js';
|
|
19
|
-
import '@dynamic-labs/multi-wallet';
|
|
20
|
-
import 'react-international-phone';
|
|
21
|
-
import '../../../store/state/nonce/nonce.js';
|
|
22
|
-
import '@dynamic-labs/locale';
|
|
23
|
-
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
-
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
-
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
-
import { getClientSessionPublicKey, getClientSessionSignature, getClientSessionNonceSignature } from '../../functions/clientSessionKeys/getClientSessionKeys.js';
|
|
27
|
-
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
28
|
-
import '../../../events/dynamicEvents.js';
|
|
29
|
-
import { getUserProfile } from '../../../client/extension/user/getUserProfile/getUserProfile.js';
|
|
30
|
-
import { useOnboardingCompleteUser } from '../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js';
|
|
31
|
-
import { getMinAuthToken } from '../../../client/extension/functions/getMinAuthToken/getMinAuthToken.js';
|
|
32
|
-
import { CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS } from '../../constants/sessionStorage.js';
|
|
33
|
-
|
|
34
|
-
const useClientSessionKeys = () => {
|
|
35
|
-
const user = useOnboardingCompleteUser();
|
|
36
|
-
const sessionPublicKey = getClientSessionPublicKey();
|
|
37
|
-
// Use refs to capture latest values without causing function reference changes
|
|
38
|
-
const userRef = useRef(user);
|
|
39
|
-
const sessionPublicKeyRef = useRef(sessionPublicKey);
|
|
40
|
-
// Update refs on every render
|
|
41
|
-
userRef.current = user;
|
|
42
|
-
sessionPublicKeyRef.current = sessionPublicKey;
|
|
43
|
-
/**
|
|
44
|
-
* Get a signed session ID with nonce for replay protection.
|
|
45
|
-
* Returns signature in format: `${signedSessionId}/${signedNonce}/${nonce}`
|
|
46
|
-
*
|
|
47
|
-
* This is a lazy function - nonce API is only called when this function is invoked.
|
|
48
|
-
*/
|
|
49
|
-
const getSignedSessionId = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
const currentUser = userRef.current;
|
|
51
|
-
const currentPublicKey = sessionPublicKeyRef.current;
|
|
52
|
-
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.sessionId) || !currentPublicKey) {
|
|
53
|
-
logger.instrument('[SessionChaining] Session ID and public key are required', {
|
|
54
|
-
hasClientSessionKeysInSecureStorage: Boolean(StorageService.getItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS)),
|
|
55
|
-
hasLocalStorage: Boolean(StorageService.getSourceStorage('localStorage')),
|
|
56
|
-
hasSecureStorage: Boolean(StorageService.getSourceStorage('secureStorage')),
|
|
57
|
-
hasSessionId: currentUser ? Boolean(currentUser.sessionId) : false,
|
|
58
|
-
hasSessionPublicKey: Boolean(currentPublicKey),
|
|
59
|
-
hasSessionStorage: Boolean(StorageService.getSourceStorage('sessionStorage')),
|
|
60
|
-
hasUser: Boolean(currentUser),
|
|
61
|
-
key: 'session_chaining_missing_requirements',
|
|
62
|
-
sessionId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.sessionId,
|
|
63
|
-
sessionPublicKey: currentPublicKey,
|
|
64
|
-
stateHasMinAuthToken: Boolean(getMinAuthToken()),
|
|
65
|
-
stateHasUser: Boolean(getUserProfile()),
|
|
66
|
-
time: 0,
|
|
67
|
-
userId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.id,
|
|
68
|
-
});
|
|
69
|
-
throw new Error('Session ID and public key are required');
|
|
70
|
-
}
|
|
71
|
-
const { sessionSignature: signedSessionId } = yield getClientSessionSignature({
|
|
72
|
-
sessionId: currentUser.sessionId,
|
|
73
|
-
});
|
|
74
|
-
const { nonce, nonceSignature } = yield getClientSessionNonceSignature({
|
|
75
|
-
environmentId: currentUser.projectEnvironmentId,
|
|
76
|
-
});
|
|
77
|
-
const sessionSignature = `${signedSessionId}/${nonceSignature}/${nonce}`;
|
|
78
|
-
logger.instrument('[SessionChaining] Generated session signature', {
|
|
79
|
-
environmentId: currentUser.projectEnvironmentId,
|
|
80
|
-
key: 'generated_session_signature',
|
|
81
|
-
nonce,
|
|
82
|
-
nonceSignature,
|
|
83
|
-
sessionId: currentUser.sessionId,
|
|
84
|
-
sessionPublicKey: currentPublicKey,
|
|
85
|
-
sessionSignature,
|
|
86
|
-
signedSessionId,
|
|
87
|
-
time: 0,
|
|
88
|
-
});
|
|
89
|
-
return sessionSignature;
|
|
90
|
-
}), []);
|
|
91
|
-
return {
|
|
92
|
-
getSignedSessionId,
|
|
93
|
-
sessionPublicKey,
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export { useClientSessionKeys };
|