@dynamic-labs/sdk-react-core 4.67.3-device-registration.0 → 4.69.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 +15 -10
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/lib/Main.cjs +0 -1
- package/src/lib/Main.d.ts +0 -1
- package/src/lib/Main.js +0 -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/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/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/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +34 -5
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +34 -5
- 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 +2 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -4
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -2
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +0 -2
- 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/data/api/oauth/oauth.cjs +19 -4
- package/src/lib/data/api/oauth/oauth.js +19 -4
- package/src/lib/data/api/user/user.cjs +11 -3
- package/src/lib/data/api/user/user.js +11 -3
- package/src/lib/main.global.cjs +0 -3
- package/src/lib/main.global.js +0 -3
- 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/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/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 +2 -2
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.js +2 -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/useVerifyWallet/useVerifyWallet.cjs +0 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +0 -2
- 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/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/TrustedDevicesSection/TrustedDevicesSection.cjs +6 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/TrustedDevicesSection/TrustedDevicesSection.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/TrustedDevicesSection/TrustedDevicesSection.js +6 -0
- package/_virtual/style-inject.cjs +0 -31
- package/_virtual/style-inject.js +0 -29
- 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/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { useCallback } from 'react';
|
|
4
5
|
import { SocialIcon } from '@dynamic-labs/iconic';
|
|
6
|
+
import { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
5
7
|
import '../../../Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
8
|
import 'react-i18next';
|
|
7
9
|
import { ReactComponent as SvgAdd } from '../../../../shared/assets/add.js';
|
|
8
10
|
import { ReactComponent as SvgUnlink } from '../../../../shared/assets/unlink.js';
|
|
9
11
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
11
12
|
import '@dynamic-labs/utils';
|
|
12
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
13
14
|
import '../../../../shared/logger.js';
|
|
@@ -15,7 +16,6 @@ import '@dynamic-labs/wallet-book';
|
|
|
15
16
|
import '../../../../utils/constants/colors.js';
|
|
16
17
|
import '../../../../utils/constants/values.js';
|
|
17
18
|
import { providerLabel } from '../../../../shared/utils/functions/providerLabel/providerLabel.js';
|
|
18
|
-
import '@dynamic-labs/sdk-api-core';
|
|
19
19
|
import '../../../../shared/consts/index.js';
|
|
20
20
|
import '../../../Alert/Alert.js';
|
|
21
21
|
import '../../../../events/dynamicEvents.js';
|
|
@@ -69,8 +69,8 @@ import 'react-focus-lock';
|
|
|
69
69
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
70
70
|
import { Icon } from '../../../Icon/Icon.js';
|
|
71
71
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
72
|
+
import { useStepUpAuthentication } from '../../../../utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js';
|
|
72
73
|
import '../../../../context/WalletContext/WalletContext.js';
|
|
73
|
-
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
74
74
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
75
75
|
import '../../../IconButton/IconButton.js';
|
|
76
76
|
import { TypographyButton } from '../../../TypographyButton/TypographyButton.js';
|
|
@@ -86,6 +86,7 @@ import '../../../../views/TransactionConfirmationView/TransactionConfirmationVie
|
|
|
86
86
|
import '../../../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
87
87
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
88
88
|
import '../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
89
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
89
90
|
import '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
90
91
|
import '../../../../utils/hooks/useWalletBackup/types.js';
|
|
91
92
|
import '../../../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
@@ -117,20 +118,48 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
117
118
|
var _a;
|
|
118
119
|
const { user, primaryWallet } = useInternalDynamicContext();
|
|
119
120
|
const { linkSocialAccount, unlinkSocialAccount, isProcessing, isLinked, getLinkedAccountInformation, } = useSocialAccounts();
|
|
121
|
+
const { isStepUpRequired, promptStepUpAuth } = useStepUpAuthentication();
|
|
120
122
|
const isProviderLinked = isLinked(provider);
|
|
121
123
|
const connectedAccountInfo = getLinkedAccountInformation(provider);
|
|
122
124
|
const iconThemeVariant = useIconThemeVariant();
|
|
123
125
|
const isActiveCredential = !primaryWallet &&
|
|
124
126
|
connectedAccountInfo &&
|
|
125
127
|
(connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.id) === (user === null || user === void 0 ? void 0 : user.lastVerifiedCredentialId);
|
|
126
|
-
const handleSocialAccountButton = useCallback(() => {
|
|
128
|
+
const handleSocialAccountButton = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
129
|
if (isProviderLinked) {
|
|
130
|
+
if (isStepUpRequired({ scope: TokenScope.Credentialunlink })) {
|
|
131
|
+
try {
|
|
132
|
+
yield promptStepUpAuth({
|
|
133
|
+
requestedScopes: [TokenScope.Credentialunlink],
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (_b) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
128
140
|
unlinkSocialAccount(provider);
|
|
129
141
|
}
|
|
130
142
|
else {
|
|
143
|
+
if (isStepUpRequired({ scope: TokenScope.Credentiallink })) {
|
|
144
|
+
try {
|
|
145
|
+
yield promptStepUpAuth({
|
|
146
|
+
requestedScopes: [TokenScope.Credentiallink],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
catch (_c) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
131
153
|
linkSocialAccount(provider, { showWidgetAfterConnection: true });
|
|
132
154
|
}
|
|
133
|
-
}, [
|
|
155
|
+
}), [
|
|
156
|
+
isProviderLinked,
|
|
157
|
+
isStepUpRequired,
|
|
158
|
+
promptStepUpAuth,
|
|
159
|
+
linkSocialAccount,
|
|
160
|
+
provider,
|
|
161
|
+
unlinkSocialAccount,
|
|
162
|
+
]);
|
|
134
163
|
const renderButton = () => (jsx(TypographyButton, { buttonClassName: 'user-profile-social-account__button', buttonVariant: 'secondary', buttonPadding: 'none', onClick: handleSocialAccountButton, loading: isProcessing, dataTestId: `social-account-${isProviderLinked ? 'disconnect' : 'connect'}-button`, typographyProps: {
|
|
135
164
|
color: 'secondary',
|
|
136
165
|
variant: 'button_tertiary',
|
|
@@ -28,10 +28,10 @@ require('@dynamic-labs/locale');
|
|
|
28
28
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
29
29
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
30
30
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
31
|
-
var getClientSessionKeys = require('../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
32
31
|
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
33
32
|
require('../../../events/dynamicEvents.cjs');
|
|
34
33
|
var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
34
|
+
var generateSessionKeys = require('../../../client/extension/functions/generateSessionKeys/generateSessionKeys.cjs');
|
|
35
35
|
|
|
36
36
|
const createEmailHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, generateSessionKey, }) => (email$1, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
const createEmailVerificationResponse = yield email.createEmailVerification({
|
|
@@ -57,7 +57,7 @@ const createEmailHandler = (environmentId, { shouldRegisterSessionKeysOnSignin,
|
|
|
57
57
|
const keypair = yield generateSessionKey();
|
|
58
58
|
sessionPublicKey = keypair.publicKey;
|
|
59
59
|
}
|
|
60
|
-
yield
|
|
60
|
+
yield generateSessionKeys.generateSessionKeys();
|
|
61
61
|
const response = yield email.signInWithEmailVerification({
|
|
62
62
|
captchaToken,
|
|
63
63
|
environmentId,
|
|
@@ -24,10 +24,10 @@ import '@dynamic-labs/locale';
|
|
|
24
24
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
25
25
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
26
26
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
27
|
-
import { generateClientSessionKeys } from '../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
28
27
|
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
29
28
|
import '../../../events/dynamicEvents.js';
|
|
30
29
|
import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
30
|
+
import { generateSessionKeys } from '../../../client/extension/functions/generateSessionKeys/generateSessionKeys.js';
|
|
31
31
|
|
|
32
32
|
const createEmailHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, generateSessionKey, }) => (email, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
33
|
const createEmailVerificationResponse = yield createEmailVerification({
|
|
@@ -53,7 +53,7 @@ const createEmailHandler = (environmentId, { shouldRegisterSessionKeysOnSignin,
|
|
|
53
53
|
const keypair = yield generateSessionKey();
|
|
54
54
|
sessionPublicKey = keypair.publicKey;
|
|
55
55
|
}
|
|
56
|
-
yield
|
|
56
|
+
yield generateSessionKeys();
|
|
57
57
|
const response = yield signInWithEmailVerification({
|
|
58
58
|
captchaToken,
|
|
59
59
|
environmentId,
|
|
@@ -27,10 +27,10 @@ var sms = require('../../../data/api/sms/sms.cjs');
|
|
|
27
27
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
28
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
29
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
-
var getClientSessionKeys = require('../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
31
30
|
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
32
31
|
require('../../../events/dynamicEvents.cjs');
|
|
33
32
|
var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
33
|
+
var generateSessionKeys = require('../../../client/extension/functions/generateSessionKeys/generateSessionKeys.cjs');
|
|
34
34
|
|
|
35
35
|
const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, generateSessionKey, }) => (phone, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
const { verificationUUID } = yield sms.createSmsVerification({
|
|
@@ -48,7 +48,7 @@ const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, ge
|
|
|
48
48
|
const keypair = yield generateSessionKey();
|
|
49
49
|
sessionPublicKey = keypair.publicKey;
|
|
50
50
|
}
|
|
51
|
-
yield
|
|
51
|
+
yield generateSessionKeys.generateSessionKeys();
|
|
52
52
|
const response = yield sms.signInWithSmsVerification({
|
|
53
53
|
captchaToken,
|
|
54
54
|
environmentId,
|
|
@@ -23,10 +23,10 @@ import { createSmsVerification, signInWithSmsVerification } from '../../../data/
|
|
|
23
23
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
24
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
25
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
-
import { generateClientSessionKeys } from '../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
27
26
|
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
28
27
|
import '../../../events/dynamicEvents.js';
|
|
29
28
|
import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
29
|
+
import { generateSessionKeys } from '../../../client/extension/functions/generateSessionKeys/generateSessionKeys.js';
|
|
30
30
|
|
|
31
31
|
const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, generateSessionKey, }) => (phone, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
const { verificationUUID } = yield createSmsVerification({
|
|
@@ -44,7 +44,7 @@ const createSmsHandler = (environmentId, { shouldRegisterSessionKeysOnSignin, ge
|
|
|
44
44
|
const keypair = yield generateSessionKey();
|
|
45
45
|
sessionPublicKey = keypair.publicKey;
|
|
46
46
|
}
|
|
47
|
-
yield
|
|
47
|
+
yield generateSessionKeys();
|
|
48
48
|
const response = yield signInWithSmsVerification({
|
|
49
49
|
captchaToken,
|
|
50
50
|
environmentId,
|
|
@@ -14,6 +14,7 @@ var walletBook = require('@dynamic-labs/wallet-book');
|
|
|
14
14
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
15
15
|
var locale = require('@dynamic-labs/locale');
|
|
16
16
|
var app = require('../../app.cjs');
|
|
17
|
+
var main_global = require('../../main.global.cjs');
|
|
17
18
|
require('@dynamic-labs-sdk/client/core');
|
|
18
19
|
require('@dynamic-labs/sdk-api-core');
|
|
19
20
|
require('../../client/client.cjs');
|
|
@@ -87,7 +88,6 @@ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
87
88
|
var useEndUserWarning = require('../../utils/hooks/useEndUserWarning/useEndUserWarning.cjs');
|
|
88
89
|
var useDeviceFingerprint = require('../../utils/hooks/useDeviceFingerprint/useDeviceFingerprint.cjs');
|
|
89
90
|
var useAggregateWalletEvents = require('../../utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.cjs');
|
|
90
|
-
var useClientSessionKeys = require('../../utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs');
|
|
91
91
|
require('../../utils/hooks/useGetMfaToken/useGetMfaToken.cjs');
|
|
92
92
|
var OnrampContext = require('../OnrampContext/OnrampContext.cjs');
|
|
93
93
|
require('../../../index.cjs');
|
|
@@ -235,8 +235,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
235
235
|
}
|
|
236
236
|
// Calculates and stores a device fingerprint
|
|
237
237
|
useDeviceFingerprint.useDeviceFingerprint();
|
|
238
|
-
// Generate client session keys
|
|
239
|
-
useClientSessionKeys.useClientSessionKeys();
|
|
240
238
|
const isAuthenticated = Boolean(user);
|
|
241
239
|
const [qrcodeUri, setQrcodeUri] = React.useState('');
|
|
242
240
|
const [desktopUri, setDesktopUri] = React.useState('');
|
|
@@ -744,7 +742,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
744
742
|
isBridgeFlow,
|
|
745
743
|
isMultiWalletEnabled: multiWallet,
|
|
746
744
|
});
|
|
747
|
-
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.
|
|
745
|
+
return (jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: i18nSDKInstance, children: jsxRuntime.jsxs(DynamicContext.Provider, { value: value, children: [(jsxRuntime.jsx("style", { nonce: cspNonce, children: main_global })), jsxRuntime.jsx(walletBook.WalletBookContextProvider, { walletBook: walletBook$1, children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme.parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsxs(ViewContext.ViewContextProvider, { initialViewType: initialViewType, children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(OnrampContext.OnrampContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithOtpProvider.ConnectWithOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(OnrampWidget.OnrampWidget, {}), jsxRuntime.jsx(SyncAuthFlow.SyncAuthFlow, {}), jsxRuntime.jsx(WalletConnectorEvents.WalletConnectorEvents, { connectorProps: connectorProps }), confirmationModal, jsxRuntime.jsx(ErrorBoundaryExclude.ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) })] }) }));
|
|
748
746
|
};
|
|
749
747
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
750
748
|
const DynamicContextProvider = (props) => {
|
|
@@ -10,6 +10,7 @@ import { useWalletBookCdn, getWalletBookCdnUrl, WalletBookContextProvider } from
|
|
|
10
10
|
import { setChainInfoOverrides, isSessionKeyCompatibleWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
11
11
|
import { Locale } from '@dynamic-labs/locale';
|
|
12
12
|
import { DynamicAuthFlow } from '../../app.js';
|
|
13
|
+
import css_248z from '../../main.global.js';
|
|
13
14
|
import '@dynamic-labs-sdk/client/core';
|
|
14
15
|
import '@dynamic-labs/sdk-api-core';
|
|
15
16
|
import '../../client/client.js';
|
|
@@ -83,7 +84,6 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
83
84
|
import { useEndUserWarning } from '../../utils/hooks/useEndUserWarning/useEndUserWarning.js';
|
|
84
85
|
import { useDeviceFingerprint } from '../../utils/hooks/useDeviceFingerprint/useDeviceFingerprint.js';
|
|
85
86
|
import { useAggregateWalletEvents } from '../../utils/hooks/useAggregateWalletEvents/useAggregateWalletEvents.js';
|
|
86
|
-
import { useClientSessionKeys } from '../../utils/hooks/useClientSessionKeys/useClientSessionKeys.js';
|
|
87
87
|
import '../../utils/hooks/useGetMfaToken/useGetMfaToken.js';
|
|
88
88
|
import { OnrampContextProvider } from '../OnrampContext/OnrampContext.js';
|
|
89
89
|
import '../../../index.js';
|
|
@@ -231,8 +231,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
231
231
|
}
|
|
232
232
|
// Calculates and stores a device fingerprint
|
|
233
233
|
useDeviceFingerprint();
|
|
234
|
-
// Generate client session keys
|
|
235
|
-
useClientSessionKeys();
|
|
236
234
|
const isAuthenticated = Boolean(user);
|
|
237
235
|
const [qrcodeUri, setQrcodeUri] = useState('');
|
|
238
236
|
const [desktopUri, setDesktopUri] = useState('');
|
|
@@ -740,7 +738,7 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
740
738
|
isBridgeFlow,
|
|
741
739
|
isMultiWalletEnabled: multiWallet,
|
|
742
740
|
});
|
|
743
|
-
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children:
|
|
741
|
+
return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsxs(DynamicContext.Provider, { value: value, children: [(jsx("style", { nonce: cspNonce, children: css_248z })), jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { cspNonce: cspNonce, customerTheme: parseTheme(theme, ((_w = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _w === void 0 ? void 0 : _w.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialViewType: initialViewType, children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { children: jsx(VerificationProvider, { children: jsx(PasskeyContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(OnrampContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(OnrampWidget, {}), jsx(SyncAuthFlow, {}), jsx(WalletConnectorEvents, { connectorProps: connectorProps }), confirmationModal, jsx(ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) })] }) }));
|
|
744
742
|
};
|
|
745
743
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
746
744
|
const DynamicContextProvider = (props) => {
|
|
@@ -35,7 +35,6 @@ require('../../../../config/ApiEndpoint.cjs');
|
|
|
35
35
|
require('../../../../events/dynamicEvents.cjs');
|
|
36
36
|
require('@dynamic-labs/locale');
|
|
37
37
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
38
|
-
var getClientSessionKeys = require('../../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
39
38
|
require('../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
40
39
|
require('../../../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
41
40
|
require('../../../AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -134,7 +133,6 @@ const useHandleLogout = (params) => {
|
|
|
134
133
|
utils.StorageService.removeItem(localStorage.EXCHANGE_PICKER_SEARCH_KEY);
|
|
135
134
|
utils.StorageService.removeItem(localStorage.PHANTOM_SIGNATURE_STATE);
|
|
136
135
|
utils.StorageService.removeItem(localStorage.DELEGATION_STATE);
|
|
137
|
-
getClientSessionKeys.clearClientSessionKeys();
|
|
138
136
|
authMode.setAuthMode(p.initialAuthenticationMode);
|
|
139
137
|
p.setShowAuthFlow(false, {
|
|
140
138
|
emitCancelAuth: false,
|
|
@@ -31,7 +31,6 @@ import '../../../../config/ApiEndpoint.js';
|
|
|
31
31
|
import '../../../../events/dynamicEvents.js';
|
|
32
32
|
import '@dynamic-labs/locale';
|
|
33
33
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
34
|
-
import { clearClientSessionKeys } from '../../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
35
34
|
import '../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
36
35
|
import '../../../AccessDeniedContext/AccessDeniedContext.js';
|
|
37
36
|
import '../../../AccountExistsContext/AccountExistsContext.js';
|
|
@@ -130,7 +129,6 @@ const useHandleLogout = (params) => {
|
|
|
130
129
|
StorageService.removeItem(EXCHANGE_PICKER_SEARCH_KEY);
|
|
131
130
|
StorageService.removeItem(PHANTOM_SIGNATURE_STATE);
|
|
132
131
|
StorageService.removeItem(DELEGATION_STATE);
|
|
133
|
-
clearClientSessionKeys();
|
|
134
132
|
setAuthMode(p.initialAuthenticationMode);
|
|
135
133
|
p.setShowAuthFlow(false, {
|
|
136
134
|
emitCancelAuth: false,
|
|
@@ -24,7 +24,6 @@ var updatePrimaryWalletId = require('../../utils/functions/updatePrimaryWalletId
|
|
|
24
24
|
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
25
25
|
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
26
26
|
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
27
|
-
var getClientSessionKeys = require('../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
28
27
|
require('@dynamic-labs-sdk/client');
|
|
29
28
|
require('@dynamic-labs-sdk/client/core');
|
|
30
29
|
require('../../client/client.cjs');
|
|
@@ -237,7 +236,6 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
237
236
|
yield connectWallet(socialWalletConnector);
|
|
238
237
|
const address = yield socialWalletConnector.getAddress();
|
|
239
238
|
walletUiUtils.disabledConfirmationOnce();
|
|
240
|
-
yield getClientSessionKeys.generateClientSessionKeys();
|
|
241
239
|
yield verifyWallet({
|
|
242
240
|
captchaToken: getCaptchaToken(),
|
|
243
241
|
oauth: {
|
|
@@ -20,7 +20,6 @@ import { updatePrimaryWalletId } from '../../utils/functions/updatePrimaryWallet
|
|
|
20
20
|
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
21
21
|
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
22
22
|
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
23
|
-
import { generateClientSessionKeys } from '../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
24
23
|
import '@dynamic-labs-sdk/client';
|
|
25
24
|
import '@dynamic-labs-sdk/client/core';
|
|
26
25
|
import '../../client/client.js';
|
|
@@ -233,7 +232,6 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
233
232
|
yield connectWallet(socialWalletConnector);
|
|
234
233
|
const address = yield socialWalletConnector.getAddress();
|
|
235
234
|
walletUiUtils.disabledConfirmationOnce();
|
|
236
|
-
yield generateClientSessionKeys();
|
|
237
235
|
yield verifyWallet({
|
|
238
236
|
captchaToken: getCaptchaToken(),
|
|
239
237
|
oauth: {
|
package/src/lib/data/api/api.cjs
CHANGED
|
@@ -19,10 +19,10 @@ require('@dynamic-labs/wallet-book');
|
|
|
19
19
|
require('../../utils/constants/colors.cjs');
|
|
20
20
|
require('../../utils/constants/values.cjs');
|
|
21
21
|
require('../../shared/consts/index.cjs');
|
|
22
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
22
23
|
var getApiHeaders = require('../../client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.cjs');
|
|
23
24
|
require('../../events/dynamicEvents.cjs');
|
|
24
25
|
var getProjectSettings = require('../../client/extension/projectSettings/getProjectSettings/getProjectSettings.cjs');
|
|
25
|
-
require('../../../../_virtual/_tslib.cjs');
|
|
26
26
|
var isCookieEnabled = require('../../client/extension/functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
27
27
|
var getMinAuthToken = require('../../client/extension/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
28
28
|
var createDeviceSignatureHeadersMiddleware = require('../../client/extension/functions/createDeviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.cjs');
|
package/src/lib/data/api/api.js
CHANGED
|
@@ -15,10 +15,10 @@ import '@dynamic-labs/wallet-book';
|
|
|
15
15
|
import '../../utils/constants/colors.js';
|
|
16
16
|
import '../../utils/constants/values.js';
|
|
17
17
|
import '../../shared/consts/index.js';
|
|
18
|
+
import '../../../../_virtual/_tslib.js';
|
|
18
19
|
import { getApiHeaders } from '../../client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.js';
|
|
19
20
|
import '../../events/dynamicEvents.js';
|
|
20
21
|
import { getProjectSettings } from '../../client/extension/projectSettings/getProjectSettings/getProjectSettings.js';
|
|
21
|
-
import '../../../../_virtual/_tslib.js';
|
|
22
22
|
import { isCookieEnabled } from '../../client/extension/functions/isCookieEnabled/isCookieEnabled.js';
|
|
23
23
|
import { getMinAuthToken } from '../../client/extension/functions/getMinAuthToken/getMinAuthToken.js';
|
|
24
24
|
import { createDeviceSignatureHeadersMiddleware } from '../../client/extension/functions/createDeviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.js';
|
|
@@ -29,10 +29,10 @@ require('@dynamic-labs/locale');
|
|
|
29
29
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
30
30
|
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
31
31
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
32
|
-
var getClientSessionKeys = require('../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
33
32
|
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
34
33
|
require('../../../events/dynamicEvents.cjs');
|
|
35
34
|
var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
35
|
+
var getClientSessionNonceHeaders = require('../../../client/extension/functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders.cjs');
|
|
36
36
|
|
|
37
37
|
const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [sdkApiCore.EmbeddedWalletChainEnum.Evm], passkeyAlias, sessionPublicKey, }) {
|
|
38
38
|
const embeddedWallets = [
|
|
@@ -159,9 +159,7 @@ const exportEmbeddedWallet = (_g) => _tslib.__awaiter(void 0, [_g], void 0, func
|
|
|
159
159
|
const registerSessionKey = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ environmentId, walletId, publicKey, prevSessionKeySignature, }) {
|
|
160
160
|
let response;
|
|
161
161
|
try {
|
|
162
|
-
const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield
|
|
163
|
-
environmentId,
|
|
164
|
-
});
|
|
162
|
+
const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield getClientSessionNonceHeaders.getClientSessionNonceHeaders();
|
|
165
163
|
response = yield api.sdkApi({
|
|
166
164
|
customHeaders: {
|
|
167
165
|
[constants.DYNAMIC_SESSION_NONCE_HEADER]: nonce,
|
|
@@ -25,10 +25,10 @@ import '@dynamic-labs/locale';
|
|
|
25
25
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
26
26
|
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
27
27
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
28
|
-
import { getClientSessionNonceSignature } from '../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
29
28
|
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
30
29
|
import '../../../events/dynamicEvents.js';
|
|
31
30
|
import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
31
|
+
import { getClientSessionNonceHeaders } from '../../../client/extension/functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders.js';
|
|
32
32
|
|
|
33
33
|
const createTurnkeyEmbeddedWallet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [EmbeddedWalletChainEnum.Evm], passkeyAlias, sessionPublicKey, }) {
|
|
34
34
|
const embeddedWallets = [
|
|
@@ -155,9 +155,7 @@ const exportEmbeddedWallet = (_g) => __awaiter(void 0, [_g], void 0, function* (
|
|
|
155
155
|
const registerSessionKey = (_h) => __awaiter(void 0, [_h], void 0, function* ({ environmentId, walletId, publicKey, prevSessionKeySignature, }) {
|
|
156
156
|
let response;
|
|
157
157
|
try {
|
|
158
|
-
const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield
|
|
159
|
-
environmentId,
|
|
160
|
-
});
|
|
158
|
+
const { nonce, nonceSignature, publicKey: sessionPublicKey, } = yield getClientSessionNonceHeaders();
|
|
161
159
|
response = yield sdkApi({
|
|
162
160
|
customHeaders: {
|
|
163
161
|
[DYNAMIC_SESSION_NONCE_HEADER]: nonce,
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
9
|
var utils$1 = require('@dynamic-labs/utils');
|
|
8
10
|
require('@dynamic-labs-sdk/client/core');
|
|
9
|
-
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../../client/client.cjs');
|
|
11
12
|
require('react');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
13
|
require('../../../config/ApiEndpoint.cjs');
|
|
14
14
|
require('@dynamic-labs/iconic');
|
|
15
15
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -24,6 +24,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
24
24
|
require('react-international-phone');
|
|
25
25
|
require('../../../store/state/nonce/nonce.cjs');
|
|
26
26
|
var api = require('../api.cjs');
|
|
27
|
+
var constants = require('../constants.cjs');
|
|
27
28
|
var utils = require('../utils.cjs');
|
|
28
29
|
require('@dynamic-labs/locale');
|
|
29
30
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
@@ -62,7 +63,14 @@ const verifyOAuth = (environmentId_1, providerType_1, _b) => _tslib.__awaiter(vo
|
|
|
62
63
|
state,
|
|
63
64
|
};
|
|
64
65
|
try {
|
|
65
|
-
const
|
|
66
|
+
const elevatedToken = client.getElevatedAccessToken({
|
|
67
|
+
scope: sdkApiCore.TokenScope.Credentiallink,
|
|
68
|
+
});
|
|
69
|
+
const response = yield api.sdkApi({
|
|
70
|
+
customHeaders: elevatedToken
|
|
71
|
+
? { [constants.ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
72
|
+
: undefined,
|
|
73
|
+
}).oauthVerify({
|
|
66
74
|
environmentId,
|
|
67
75
|
oauthRequest,
|
|
68
76
|
providerType,
|
|
@@ -77,7 +85,14 @@ const unlinkOAuth = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({
|
|
|
77
85
|
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
78
86
|
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
79
87
|
try {
|
|
80
|
-
const
|
|
88
|
+
const elevatedToken = client.getElevatedAccessToken({
|
|
89
|
+
scope: sdkApiCore.TokenScope.Credentialunlink,
|
|
90
|
+
});
|
|
91
|
+
const response = yield api.sdkApi({
|
|
92
|
+
customHeaders: elevatedToken
|
|
93
|
+
? { [constants.ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
94
|
+
: undefined,
|
|
95
|
+
}).verifyUnlink({
|
|
81
96
|
environmentId,
|
|
82
97
|
verifyUnlinkRequest: {
|
|
83
98
|
primaryWalletId: normalizedPrimaryWalletId,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
3
5
|
import { SocialAccountAlreadyExistsError, SandboxMaximumThresholdReachedError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
4
6
|
import '@dynamic-labs-sdk/client/core';
|
|
5
|
-
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../../client/client.js';
|
|
7
8
|
import 'react';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
9
|
import '../../../config/ApiEndpoint.js';
|
|
10
10
|
import '@dynamic-labs/iconic';
|
|
11
11
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -20,6 +20,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
20
20
|
import 'react-international-phone';
|
|
21
21
|
import '../../../store/state/nonce/nonce.js';
|
|
22
22
|
import { sdkApi } from '../api.js';
|
|
23
|
+
import { ELEVATED_ACCESS_TOKEN_HEADER } from '../constants.js';
|
|
23
24
|
import { logResponseError } from '../utils.js';
|
|
24
25
|
import '@dynamic-labs/locale';
|
|
25
26
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
@@ -58,7 +59,14 @@ const verifyOAuth = (environmentId_1, providerType_1, _b) => __awaiter(void 0, [
|
|
|
58
59
|
state,
|
|
59
60
|
};
|
|
60
61
|
try {
|
|
61
|
-
const
|
|
62
|
+
const elevatedToken = getElevatedAccessToken({
|
|
63
|
+
scope: TokenScope.Credentiallink,
|
|
64
|
+
});
|
|
65
|
+
const response = yield sdkApi({
|
|
66
|
+
customHeaders: elevatedToken
|
|
67
|
+
? { [ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
68
|
+
: undefined,
|
|
69
|
+
}).oauthVerify({
|
|
62
70
|
environmentId,
|
|
63
71
|
oauthRequest,
|
|
64
72
|
providerType,
|
|
@@ -73,7 +81,14 @@ const unlinkOAuth = (_c) => __awaiter(void 0, [_c], void 0, function* ({ environ
|
|
|
73
81
|
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
74
82
|
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
75
83
|
try {
|
|
76
|
-
const
|
|
84
|
+
const elevatedToken = getElevatedAccessToken({
|
|
85
|
+
scope: TokenScope.Credentialunlink,
|
|
86
|
+
});
|
|
87
|
+
const response = yield sdkApi({
|
|
88
|
+
customHeaders: elevatedToken
|
|
89
|
+
? { [ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
90
|
+
: undefined,
|
|
91
|
+
}).verifyUnlink({
|
|
77
92
|
environmentId,
|
|
78
93
|
verifyUnlinkRequest: {
|
|
79
94
|
primaryWalletId: normalizedPrimaryWalletId,
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
7
9
|
var utils$1 = require('@dynamic-labs/utils');
|
|
8
10
|
require('@dynamic-labs-sdk/client/core');
|
|
9
|
-
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../../client/client.cjs');
|
|
11
12
|
require('react');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
13
|
require('../../../config/ApiEndpoint.cjs');
|
|
14
14
|
require('@dynamic-labs/iconic');
|
|
15
15
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -24,6 +24,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
24
24
|
require('react-international-phone');
|
|
25
25
|
require('../../../store/state/nonce/nonce.cjs');
|
|
26
26
|
var api = require('../api.cjs');
|
|
27
|
+
var constants = require('../constants.cjs');
|
|
27
28
|
var utils = require('../utils.cjs');
|
|
28
29
|
require('@dynamic-labs/locale');
|
|
29
30
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
@@ -132,7 +133,14 @@ const getUserFieldsCheck = (_c) => _tslib.__awaiter(void 0, [_c], void 0, functi
|
|
|
132
133
|
const unlinkEmail = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, primaryWalletId, verifiedCredentialId, }) {
|
|
133
134
|
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
134
135
|
try {
|
|
135
|
-
const
|
|
136
|
+
const elevatedToken = client.getElevatedAccessToken({
|
|
137
|
+
scope: sdkApiCore.TokenScope.Credentialunlink,
|
|
138
|
+
});
|
|
139
|
+
const response = yield api.sdkApi({
|
|
140
|
+
customHeaders: elevatedToken
|
|
141
|
+
? { [constants.ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
142
|
+
: undefined,
|
|
143
|
+
}).verifyUnlink({
|
|
136
144
|
environmentId,
|
|
137
145
|
verifyUnlinkRequest: {
|
|
138
146
|
primaryWalletId: normalizedPrimaryWalletId,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
3
5
|
import { EmailAlreadyExistsError, CustomFieldNotUniqueError, UsernameAlreadyExistsError, TooManyEmailVerificationsError, InvalidPhoneNumberError } from '@dynamic-labs/utils';
|
|
4
6
|
import '@dynamic-labs-sdk/client/core';
|
|
5
|
-
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../../client/client.js';
|
|
7
8
|
import 'react';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
9
|
import '../../../config/ApiEndpoint.js';
|
|
10
10
|
import '@dynamic-labs/iconic';
|
|
11
11
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -20,6 +20,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
20
20
|
import 'react-international-phone';
|
|
21
21
|
import '../../../store/state/nonce/nonce.js';
|
|
22
22
|
import { sdkApi } from '../api.js';
|
|
23
|
+
import { ELEVATED_ACCESS_TOKEN_HEADER } from '../constants.js';
|
|
23
24
|
import { logResponseError } from '../utils.js';
|
|
24
25
|
import '@dynamic-labs/locale';
|
|
25
26
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
@@ -128,7 +129,14 @@ const getUserFieldsCheck = (_c) => __awaiter(void 0, [_c], void 0, function* ({
|
|
|
128
129
|
const unlinkEmail = (_d) => __awaiter(void 0, [_d], void 0, function* ({ environmentId, primaryWalletId, verifiedCredentialId, }) {
|
|
129
130
|
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
130
131
|
try {
|
|
131
|
-
const
|
|
132
|
+
const elevatedToken = getElevatedAccessToken({
|
|
133
|
+
scope: TokenScope.Credentialunlink,
|
|
134
|
+
});
|
|
135
|
+
const response = yield sdkApi({
|
|
136
|
+
customHeaders: elevatedToken
|
|
137
|
+
? { [ELEVATED_ACCESS_TOKEN_HEADER]: elevatedToken }
|
|
138
|
+
: undefined,
|
|
139
|
+
}).verifyUnlink({
|
|
132
140
|
environmentId,
|
|
133
141
|
verifyUnlinkRequest: {
|
|
134
142
|
primaryWalletId: normalizedPrimaryWalletId,
|