@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
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
6
|
var utils = require('@dynamic-labs/utils');
|
|
8
7
|
var sessionStorage = require('../../constants/sessionStorage.cjs');
|
|
9
|
-
var keyService = require('../keyService/keyService.cjs');
|
|
10
8
|
require('@dynamic-labs/iconic');
|
|
11
9
|
require('@dynamic-labs/wallet-connector-core');
|
|
12
10
|
require('react');
|
|
@@ -18,21 +16,6 @@ require('../../constants/colors.cjs');
|
|
|
18
16
|
require('../../constants/values.cjs');
|
|
19
17
|
require('@dynamic-labs/sdk-api-core');
|
|
20
18
|
require('../../../shared/consts/index.cjs');
|
|
21
|
-
require('@dynamic-labs-sdk/client');
|
|
22
|
-
require('@dynamic-labs-sdk/client/core');
|
|
23
|
-
require('../../../client/client.cjs');
|
|
24
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
25
|
-
require('@dynamic-labs/multi-wallet');
|
|
26
|
-
require('react-international-phone');
|
|
27
|
-
require('../../../store/state/nonce/nonce.cjs');
|
|
28
|
-
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
29
|
-
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
30
|
-
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
31
|
-
var constants = require('./constants.cjs');
|
|
32
|
-
require('../getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
33
|
-
require('../../../events/dynamicEvents.cjs');
|
|
34
|
-
var utils$1 = require('../../../data/api/utils.cjs');
|
|
35
|
-
require('@dynamic-labs/locale');
|
|
36
19
|
|
|
37
20
|
const getClientSessionKeys = () => {
|
|
38
21
|
const sessionKeysSS = utils.StorageService.getItem(sessionStorage.CLIENT_SESSION_KEYS, sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
@@ -41,70 +24,6 @@ const getClientSessionKeys = () => {
|
|
|
41
24
|
: undefined;
|
|
42
25
|
return decodedSessionKeys;
|
|
43
26
|
};
|
|
44
|
-
const generateKeyPair = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
const { private: privateKey, public: publicKey, privateJwk, } = yield keyService.p256Keygen();
|
|
46
|
-
// convert to base64 and store the session keys in session storage
|
|
47
|
-
utils.StorageService.setItem(sessionStorage.CLIENT_SESSION_KEYS, keyService.toEncodedFormat(publicKey, privateKey, privateJwk, false), sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
48
|
-
logger.logger.instrument('[SessionChaining] Generated new session key pair', {
|
|
49
|
-
key: 'generated_session_key_pair',
|
|
50
|
-
sessionPublicKey: publicKey,
|
|
51
|
-
time: 0,
|
|
52
|
-
});
|
|
53
|
-
utils.tracing.logEvent(constants.clientSessionKeyLogScope, 'Generated new session key pair', utils.tracing.formatObject({
|
|
54
|
-
publicKey,
|
|
55
|
-
}));
|
|
56
|
-
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
57
|
-
});
|
|
58
|
-
const generateSessionSignature = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return keyService.p256Sign(privateKeyJwk, sessionId); });
|
|
59
|
-
const generateNonceSignature = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ privateKeyJwk, nonce, }) { return keyService.p256Sign(privateKeyJwk, nonce); });
|
|
60
|
-
const generateClientSessionKeys = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
// check if session keys are already stored in session storage
|
|
62
|
-
const clientSessionKeysSS = getClientSessionKeys();
|
|
63
|
-
utils.tracing.logEvent(constants.clientSessionKeyLogScope, 'getClientSessionKeys', utils.tracing.formatObject({
|
|
64
|
-
hasDecodedSessionKeys: Boolean(clientSessionKeysSS),
|
|
65
|
-
publicKey: clientSessionKeysSS === null || clientSessionKeysSS === void 0 ? void 0 : clientSessionKeysSS.publicKey,
|
|
66
|
-
}));
|
|
67
|
-
let publicKey;
|
|
68
|
-
if (clientSessionKeysSS) {
|
|
69
|
-
({ publicKey } = clientSessionKeysSS);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
({ publicKey } = yield generateKeyPair());
|
|
73
|
-
}
|
|
74
|
-
return { publicKey };
|
|
75
|
-
});
|
|
76
|
-
const getClientSessionPublicKey = () => {
|
|
77
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
78
|
-
return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
|
|
79
|
-
};
|
|
80
|
-
const getClientSessionSignature = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ sessionId, }) {
|
|
81
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
82
|
-
if (!clientSessionKeys) {
|
|
83
|
-
throw new Error('Client session keys not found');
|
|
84
|
-
}
|
|
85
|
-
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
86
|
-
const sessionSignature = yield generateSessionSignature({
|
|
87
|
-
privateKeyJwk,
|
|
88
|
-
sessionId,
|
|
89
|
-
});
|
|
90
|
-
return { publicKey, sessionSignature };
|
|
91
|
-
});
|
|
92
|
-
const getClientSessionNonceSignature = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ environmentId, }) {
|
|
93
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
94
|
-
if (!clientSessionKeys) {
|
|
95
|
-
throw new Error('Client session keys not found');
|
|
96
|
-
}
|
|
97
|
-
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
98
|
-
const nonce = yield utils$1.getNonce(environmentId);
|
|
99
|
-
if (!nonce) {
|
|
100
|
-
throw new Error('Nonce not found');
|
|
101
|
-
}
|
|
102
|
-
const nonceSignature = yield generateNonceSignature({
|
|
103
|
-
nonce,
|
|
104
|
-
privateKeyJwk,
|
|
105
|
-
});
|
|
106
|
-
return { nonce, nonceSignature, publicKey };
|
|
107
|
-
});
|
|
108
27
|
const clearClientSessionKeys = () => {
|
|
109
28
|
const clientSessionKeys = getClientSessionKeys();
|
|
110
29
|
logger.logger.instrument('[SessionChaining] Clearing client session keys', {
|
|
@@ -116,11 +35,4 @@ const clearClientSessionKeys = () => {
|
|
|
116
35
|
};
|
|
117
36
|
|
|
118
37
|
exports.clearClientSessionKeys = clearClientSessionKeys;
|
|
119
|
-
exports.generateClientSessionKeys = generateClientSessionKeys;
|
|
120
|
-
exports.generateKeyPair = generateKeyPair;
|
|
121
|
-
exports.generateNonceSignature = generateNonceSignature;
|
|
122
|
-
exports.generateSessionSignature = generateSessionSignature;
|
|
123
38
|
exports.getClientSessionKeys = getClientSessionKeys;
|
|
124
|
-
exports.getClientSessionNonceSignature = getClientSessionNonceSignature;
|
|
125
|
-
exports.getClientSessionPublicKey = getClientSessionPublicKey;
|
|
126
|
-
exports.getClientSessionSignature = getClientSessionSignature;
|
|
@@ -1,29 +1,4 @@
|
|
|
1
1
|
import { ClientSessionKey } from './types';
|
|
2
2
|
export declare const getClientSessionKeys: () => ClientSessionKey | undefined;
|
|
3
|
-
export declare const generateKeyPair: () => Promise<ClientSessionKey>;
|
|
4
|
-
export declare const generateSessionSignature: ({ privateKeyJwk, sessionId, }: {
|
|
5
|
-
privateKeyJwk: JsonWebKey;
|
|
6
|
-
sessionId: string;
|
|
7
|
-
}) => Promise<string>;
|
|
8
|
-
export declare const generateNonceSignature: ({ privateKeyJwk, nonce, }: {
|
|
9
|
-
privateKeyJwk: JsonWebKey;
|
|
10
|
-
nonce: string;
|
|
11
|
-
}) => Promise<string>;
|
|
12
|
-
export declare const generateClientSessionKeys: () => Promise<{
|
|
13
|
-
publicKey: string;
|
|
14
|
-
}>;
|
|
15
3
|
export declare const getClientSessionPublicKey: () => string | undefined;
|
|
16
|
-
export declare const getClientSessionSignature: ({ sessionId, }: {
|
|
17
|
-
sessionId: string;
|
|
18
|
-
}) => Promise<{
|
|
19
|
-
publicKey: string;
|
|
20
|
-
sessionSignature: string;
|
|
21
|
-
}>;
|
|
22
|
-
export declare const getClientSessionNonceSignature: ({ environmentId, }: {
|
|
23
|
-
environmentId: string;
|
|
24
|
-
}) => Promise<{
|
|
25
|
-
nonce: string;
|
|
26
|
-
nonceSignature: string;
|
|
27
|
-
publicKey: string;
|
|
28
|
-
}>;
|
|
29
4
|
export declare const clearClientSessionKeys: () => void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
3
|
-
import { StorageService, tracing } from '@dynamic-labs/utils';
|
|
2
|
+
import { StorageService } from '@dynamic-labs/utils';
|
|
4
3
|
import { CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS } from '../../constants/sessionStorage.js';
|
|
5
|
-
import { p256Keygen, toEncodedFormat, p256Sign } from '../keyService/keyService.js';
|
|
6
4
|
import '@dynamic-labs/iconic';
|
|
7
5
|
import '@dynamic-labs/wallet-connector-core';
|
|
8
6
|
import 'react';
|
|
@@ -14,21 +12,6 @@ import '../../constants/colors.js';
|
|
|
14
12
|
import '../../constants/values.js';
|
|
15
13
|
import '@dynamic-labs/sdk-api-core';
|
|
16
14
|
import '../../../shared/consts/index.js';
|
|
17
|
-
import '@dynamic-labs-sdk/client';
|
|
18
|
-
import '@dynamic-labs-sdk/client/core';
|
|
19
|
-
import '../../../client/client.js';
|
|
20
|
-
import '../../../config/ApiEndpoint.js';
|
|
21
|
-
import '@dynamic-labs/multi-wallet';
|
|
22
|
-
import 'react-international-phone';
|
|
23
|
-
import '../../../store/state/nonce/nonce.js';
|
|
24
|
-
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
25
|
-
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
26
|
-
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
27
|
-
import { clientSessionKeyLogScope } from './constants.js';
|
|
28
|
-
import '../getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
29
|
-
import '../../../events/dynamicEvents.js';
|
|
30
|
-
import { getNonce } from '../../../data/api/utils.js';
|
|
31
|
-
import '@dynamic-labs/locale';
|
|
32
15
|
|
|
33
16
|
const getClientSessionKeys = () => {
|
|
34
17
|
const sessionKeysSS = StorageService.getItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
@@ -37,70 +20,6 @@ const getClientSessionKeys = () => {
|
|
|
37
20
|
: undefined;
|
|
38
21
|
return decodedSessionKeys;
|
|
39
22
|
};
|
|
40
|
-
const generateKeyPair = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
const { private: privateKey, public: publicKey, privateJwk, } = yield p256Keygen();
|
|
42
|
-
// convert to base64 and store the session keys in session storage
|
|
43
|
-
StorageService.setItem(CLIENT_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateJwk, false), CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
44
|
-
logger.instrument('[SessionChaining] Generated new session key pair', {
|
|
45
|
-
key: 'generated_session_key_pair',
|
|
46
|
-
sessionPublicKey: publicKey,
|
|
47
|
-
time: 0,
|
|
48
|
-
});
|
|
49
|
-
tracing.logEvent(clientSessionKeyLogScope, 'Generated new session key pair', tracing.formatObject({
|
|
50
|
-
publicKey,
|
|
51
|
-
}));
|
|
52
|
-
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
53
|
-
});
|
|
54
|
-
const generateSessionSignature = (_a) => __awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return p256Sign(privateKeyJwk, sessionId); });
|
|
55
|
-
const generateNonceSignature = (_b) => __awaiter(void 0, [_b], void 0, function* ({ privateKeyJwk, nonce, }) { return p256Sign(privateKeyJwk, nonce); });
|
|
56
|
-
const generateClientSessionKeys = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
// check if session keys are already stored in session storage
|
|
58
|
-
const clientSessionKeysSS = getClientSessionKeys();
|
|
59
|
-
tracing.logEvent(clientSessionKeyLogScope, 'getClientSessionKeys', tracing.formatObject({
|
|
60
|
-
hasDecodedSessionKeys: Boolean(clientSessionKeysSS),
|
|
61
|
-
publicKey: clientSessionKeysSS === null || clientSessionKeysSS === void 0 ? void 0 : clientSessionKeysSS.publicKey,
|
|
62
|
-
}));
|
|
63
|
-
let publicKey;
|
|
64
|
-
if (clientSessionKeysSS) {
|
|
65
|
-
({ publicKey } = clientSessionKeysSS);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
({ publicKey } = yield generateKeyPair());
|
|
69
|
-
}
|
|
70
|
-
return { publicKey };
|
|
71
|
-
});
|
|
72
|
-
const getClientSessionPublicKey = () => {
|
|
73
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
74
|
-
return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
|
|
75
|
-
};
|
|
76
|
-
const getClientSessionSignature = (_c) => __awaiter(void 0, [_c], void 0, function* ({ sessionId, }) {
|
|
77
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
78
|
-
if (!clientSessionKeys) {
|
|
79
|
-
throw new Error('Client session keys not found');
|
|
80
|
-
}
|
|
81
|
-
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
82
|
-
const sessionSignature = yield generateSessionSignature({
|
|
83
|
-
privateKeyJwk,
|
|
84
|
-
sessionId,
|
|
85
|
-
});
|
|
86
|
-
return { publicKey, sessionSignature };
|
|
87
|
-
});
|
|
88
|
-
const getClientSessionNonceSignature = (_d) => __awaiter(void 0, [_d], void 0, function* ({ environmentId, }) {
|
|
89
|
-
const clientSessionKeys = getClientSessionKeys();
|
|
90
|
-
if (!clientSessionKeys) {
|
|
91
|
-
throw new Error('Client session keys not found');
|
|
92
|
-
}
|
|
93
|
-
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
94
|
-
const nonce = yield getNonce(environmentId);
|
|
95
|
-
if (!nonce) {
|
|
96
|
-
throw new Error('Nonce not found');
|
|
97
|
-
}
|
|
98
|
-
const nonceSignature = yield generateNonceSignature({
|
|
99
|
-
nonce,
|
|
100
|
-
privateKeyJwk,
|
|
101
|
-
});
|
|
102
|
-
return { nonce, nonceSignature, publicKey };
|
|
103
|
-
});
|
|
104
23
|
const clearClientSessionKeys = () => {
|
|
105
24
|
const clientSessionKeys = getClientSessionKeys();
|
|
106
25
|
logger.instrument('[SessionChaining] Clearing client session keys', {
|
|
@@ -111,4 +30,4 @@ const clearClientSessionKeys = () => {
|
|
|
111
30
|
StorageService.removeItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
112
31
|
};
|
|
113
32
|
|
|
114
|
-
export { clearClientSessionKeys,
|
|
33
|
+
export { clearClientSessionKeys, getClientSessionKeys };
|
|
@@ -74,7 +74,6 @@ export * from './getWalletUniqueId';
|
|
|
74
74
|
export * from './openPopup';
|
|
75
75
|
export * from './hasAllRequiredWalletsConnected';
|
|
76
76
|
export * from './isZKSyncEnabled';
|
|
77
|
-
export * from './clientSessionKeys';
|
|
78
77
|
export * from './usingV3Wallets';
|
|
79
78
|
export * from './isPasskeyProviderEnabled';
|
|
80
79
|
export * from './exportWalletCredential';
|
|
@@ -35,7 +35,6 @@ require('@dynamic-labs/locale');
|
|
|
35
35
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
36
36
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
37
37
|
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
38
|
-
var getClientSessionKeys = require('../../../functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
39
38
|
require('../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
40
39
|
var useHandleWalletsToConnect = require('../../useHandleWalletsToConnect/useHandleWalletsToConnect.cjs');
|
|
41
40
|
var useVerifyWallet = require('../../useVerifyWallet/useVerifyWallet.cjs');
|
|
@@ -139,7 +138,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
139
138
|
else {
|
|
140
139
|
walletUiUtils.disabledConfirmationOnce();
|
|
141
140
|
}
|
|
142
|
-
yield getClientSessionKeys.generateClientSessionKeys();
|
|
143
141
|
return verifyWallet({
|
|
144
142
|
captchaToken,
|
|
145
143
|
publicWalletAddress,
|
|
@@ -31,7 +31,6 @@ import '@dynamic-labs/locale';
|
|
|
31
31
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
32
32
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
33
33
|
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
34
|
-
import { generateClientSessionKeys } from '../../../functions/clientSessionKeys/getClientSessionKeys.js';
|
|
35
34
|
import '../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
36
35
|
import { useHandleWalletsToConnect } from '../../useHandleWalletsToConnect/useHandleWalletsToConnect.js';
|
|
37
36
|
import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
@@ -135,7 +134,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
135
134
|
else {
|
|
136
135
|
walletUiUtils.disabledConfirmationOnce();
|
|
137
136
|
}
|
|
138
|
-
yield generateClientSessionKeys();
|
|
139
137
|
return verifyWallet({
|
|
140
138
|
captchaToken,
|
|
141
139
|
publicWalletAddress,
|
|
@@ -35,7 +35,6 @@ require('@dynamic-labs/locale');
|
|
|
35
35
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
36
36
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
37
37
|
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
38
|
-
var getClientSessionKeys = require('../../../functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
39
38
|
require('../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
40
39
|
var useHandleWalletsToConnect = require('../../useHandleWalletsToConnect/useHandleWalletsToConnect.cjs');
|
|
41
40
|
var useVerifyWallet = require('../../useVerifyWallet/useVerifyWallet.cjs');
|
|
@@ -196,7 +195,6 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
196
195
|
}
|
|
197
196
|
return pushView('network-not-supported');
|
|
198
197
|
}
|
|
199
|
-
yield getClientSessionKeys.generateClientSessionKeys();
|
|
200
198
|
yield verifyWallet({
|
|
201
199
|
captchaToken: getCaptchaToken(),
|
|
202
200
|
publicWalletAddress: connectionResult.address,
|
|
@@ -31,7 +31,6 @@ import '@dynamic-labs/locale';
|
|
|
31
31
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
32
32
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
33
33
|
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
34
|
-
import { generateClientSessionKeys } from '../../../functions/clientSessionKeys/getClientSessionKeys.js';
|
|
35
34
|
import '../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
36
35
|
import { useHandleWalletsToConnect } from '../../useHandleWalletsToConnect/useHandleWalletsToConnect.js';
|
|
37
36
|
import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
@@ -192,7 +191,6 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
192
191
|
}
|
|
193
192
|
return pushView('network-not-supported');
|
|
194
193
|
}
|
|
195
|
-
yield generateClientSessionKeys();
|
|
196
194
|
yield verifyWallet({
|
|
197
195
|
captchaToken: getCaptchaToken(),
|
|
198
196
|
publicWalletAddress: connectionResult.address,
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs
CHANGED
|
@@ -32,7 +32,6 @@ require('@dynamic-labs/locale');
|
|
|
32
32
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
33
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
34
|
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
35
|
-
var getClientSessionKeys = require('../../../functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
36
35
|
require('../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
37
36
|
var useVerifyWallet = require('../../useVerifyWallet/useVerifyWallet.cjs');
|
|
38
37
|
require('../../../../store/state/authMode/authMode.cjs');
|
|
@@ -144,7 +143,6 @@ const useSignConnectOnlyUser = () => {
|
|
|
144
143
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
yield getClientSessionKeys.generateClientSessionKeys();
|
|
148
146
|
yield verifyWallet({
|
|
149
147
|
captchaToken: getCaptchaToken(),
|
|
150
148
|
publicWalletAddress: connectionResult.address,
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js
CHANGED
|
@@ -28,7 +28,6 @@ import '@dynamic-labs/locale';
|
|
|
28
28
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
29
29
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
30
30
|
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
31
|
-
import { generateClientSessionKeys } from '../../../functions/clientSessionKeys/getClientSessionKeys.js';
|
|
32
31
|
import '../../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
33
32
|
import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
34
33
|
import '../../../../store/state/authMode/authMode.js';
|
|
@@ -140,7 +139,6 @@ const useSignConnectOnlyUser = () => {
|
|
|
140
139
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address)) {
|
|
141
140
|
return;
|
|
142
141
|
}
|
|
143
|
-
yield generateClientSessionKeys();
|
|
144
142
|
yield verifyWallet({
|
|
145
143
|
captchaToken: getCaptchaToken(),
|
|
146
144
|
publicWalletAddress: connectionResult.address,
|
|
@@ -2,7 +2,7 @@ import { DynamicEvents } from '../../../../events';
|
|
|
2
2
|
import { EventArgs } from '../types';
|
|
3
3
|
type DynamicEventListener<E extends keyof DynamicEvents> = (...args: EventArgs<DynamicEvents, E>) => void;
|
|
4
4
|
/** Allows us to subscribe to all dynamicEvents with a hook, even the internal ones */
|
|
5
|
-
export declare const useInternalDynamicEvents: <E extends keyof import("../../../../events/auth").AuthEvents | keyof import("../../../../events/ui").UIEvents | keyof import("../../../../events/otp").OTPEvents | keyof import("../../../../events/wallets").WalletEvents | keyof import("../../../../events/passkey").PasskeyEvents | "farcasterConnectCancelled" | keyof import("../../../../events/embeddedWallet").EmbeddedWalletEvents | keyof import("../../../../events/multiWallet").MultiWalletInternalEvents | "tokenBalancesChanged" | "userProfileUpdated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
5
|
+
export declare const useInternalDynamicEvents: <E extends keyof import("../../../../events/auth").AuthEvents | keyof import("../../../../events/deviceRegistration").DeviceRegistrationEvents | keyof import("../../../../events/ui").UIEvents | keyof import("../../../../events/otp").OTPEvents | keyof import("../../../../events/wallets").WalletEvents | keyof import("../../../../events/passkey").PasskeyEvents | "farcasterConnectCancelled" | keyof import("../../../../events/embeddedWallet").EmbeddedWalletEvents | keyof import("../../../../events/multiWallet").MultiWalletInternalEvents | "tokenBalancesChanged" | "userProfileUpdated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
6
6
|
/** Allows subscribing to dynamic events directly inside components with a hook */
|
|
7
|
-
export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "walletReturnFromDeepLink" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
7
|
+
export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "deviceRegistrationCompleted" | "deviceRegistrationCompletedInAnotherTab" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "walletReturnFromDeepLink" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
8
8
|
export {};
|
|
@@ -80,7 +80,6 @@ export { useDynamicWaas } from './useDynamicWaas';
|
|
|
80
80
|
export { useSyncDynamicWaas } from './useSyncDynamicWaas';
|
|
81
81
|
export { useExchangeAccounts } from './useExchangeAccounts';
|
|
82
82
|
export { useConnectExchangeForFunding } from './useConnectExchangeForFunding';
|
|
83
|
-
export { useClientSessionKeys } from './useClientSessionKeys';
|
|
84
83
|
export { usePromptAmountAndFundWithExchange } from './usePromptAndFundWithExchange';
|
|
85
84
|
export { usePayWithDynamic, type PayWithDynamicProps, } from './usePayWithDynamic';
|
|
86
85
|
export { useSubmitExchangeFunding } from './useSubmitExchangeFunding';
|
|
@@ -36,6 +36,7 @@ var useUser = require('../../../client/extension/user/useUser/useUser.cjs');
|
|
|
36
36
|
var useProjectSettings = require('../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
37
37
|
var isCookieEnabled = require('../../../client/extension/functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
38
38
|
var getMinAuthToken = require('../../../client/extension/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
39
|
+
var generateChainingSignature = require('../../../client/extension/functions/generateChainingSignature/generateChainingSignature.cjs');
|
|
39
40
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
40
41
|
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
41
42
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -89,7 +90,6 @@ require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
89
90
|
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
90
91
|
var normalizeWaasChainName = require('./normalizeWaasChainName.cjs');
|
|
91
92
|
var apiUrl = require('../../constants/waas/apiUrl.cjs');
|
|
92
|
-
var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
|
|
93
93
|
var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
|
|
94
94
|
var useGetWalletPassword = require('../useGetWalletPassword/useGetWalletPassword.cjs');
|
|
95
95
|
var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
|
|
@@ -183,7 +183,6 @@ const useDynamicWaas = () => {
|
|
|
183
183
|
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
184
184
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
185
185
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
186
|
-
const { getSignedSessionId } = useClientSessionKeys.useClientSessionKeys();
|
|
187
186
|
const getMfaToken = useGetMfaToken.useGetMfaToken();
|
|
188
187
|
const getWalletPassword = useGetWalletPassword.useGetWalletPassword();
|
|
189
188
|
const getElevatedAccessToken = useGetElevatedAccessToken.useGetElevatedAccessToken();
|
|
@@ -210,7 +209,7 @@ const useDynamicWaas = () => {
|
|
|
210
209
|
environmentId,
|
|
211
210
|
getElevatedAccessToken,
|
|
212
211
|
getMfaToken,
|
|
213
|
-
getSignedSessionId,
|
|
212
|
+
getSignedSessionId: generateChainingSignature.generateChainingSignature,
|
|
214
213
|
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
215
214
|
getWalletPassword,
|
|
216
215
|
relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
|
|
@@ -226,7 +225,6 @@ const useDynamicWaas = () => {
|
|
|
226
225
|
getElevatedAccessToken,
|
|
227
226
|
getMfaToken,
|
|
228
227
|
getWalletPassword,
|
|
229
|
-
getSignedSessionId,
|
|
230
228
|
relayUrl,
|
|
231
229
|
baseClientKeysharesRelayApiUrl,
|
|
232
230
|
]);
|
|
@@ -303,7 +301,7 @@ const useDynamicWaas = () => {
|
|
|
303
301
|
walletAddress: wallet.address,
|
|
304
302
|
});
|
|
305
303
|
const keyshareRestorationStart = new Date().getTime();
|
|
306
|
-
const signedSessionId = yield
|
|
304
|
+
const signedSessionId = yield generateChainingSignature.generateChainingSignature();
|
|
307
305
|
yield client.getWallet({
|
|
308
306
|
accountAddress: wallet.address,
|
|
309
307
|
authToken: getMinAuthToken.getMinAuthToken(),
|
|
@@ -361,13 +359,7 @@ const useDynamicWaas = () => {
|
|
|
361
359
|
userId: user.id,
|
|
362
360
|
});
|
|
363
361
|
}
|
|
364
|
-
}), [
|
|
365
|
-
enabledChainNames,
|
|
366
|
-
getSignedSessionId,
|
|
367
|
-
getWaasWalletConnector,
|
|
368
|
-
shouldInitializeWaas,
|
|
369
|
-
user,
|
|
370
|
-
]);
|
|
362
|
+
}), [enabledChainNames, getWaasWalletConnector, shouldInitializeWaas, user]);
|
|
371
363
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
372
364
|
// and make a wallet for each enabled chain
|
|
373
365
|
const createWalletAccount = React.useCallback((requirementsOrChainNames, password, bitcoinConfig, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -32,6 +32,7 @@ import { useUser } from '../../../client/extension/user/useUser/useUser.js';
|
|
|
32
32
|
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
33
33
|
import { isCookieEnabled } from '../../../client/extension/functions/isCookieEnabled/isCookieEnabled.js';
|
|
34
34
|
import { getMinAuthToken } from '../../../client/extension/functions/getMinAuthToken/getMinAuthToken.js';
|
|
35
|
+
import { generateChainingSignature } from '../../../client/extension/functions/generateChainingSignature/generateChainingSignature.js';
|
|
35
36
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
36
37
|
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
37
38
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -85,7 +86,6 @@ import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
85
86
|
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
86
87
|
import { normalizeWaasChainName } from './normalizeWaasChainName.js';
|
|
87
88
|
import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
|
|
88
|
-
import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
|
|
89
89
|
import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
|
|
90
90
|
import { useGetWalletPassword } from '../useGetWalletPassword/useGetWalletPassword.js';
|
|
91
91
|
import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
|
|
@@ -179,7 +179,6 @@ const useDynamicWaas = () => {
|
|
|
179
179
|
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
180
180
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
181
181
|
const authToken = getMinAuthToken();
|
|
182
|
-
const { getSignedSessionId } = useClientSessionKeys();
|
|
183
182
|
const getMfaToken = useGetMfaToken();
|
|
184
183
|
const getWalletPassword = useGetWalletPassword();
|
|
185
184
|
const getElevatedAccessToken = useGetElevatedAccessToken();
|
|
@@ -206,7 +205,7 @@ const useDynamicWaas = () => {
|
|
|
206
205
|
environmentId,
|
|
207
206
|
getElevatedAccessToken,
|
|
208
207
|
getMfaToken,
|
|
209
|
-
getSignedSessionId,
|
|
208
|
+
getSignedSessionId: generateChainingSignature,
|
|
210
209
|
getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
|
|
211
210
|
getWalletPassword,
|
|
212
211
|
relayUrl: relayUrl !== null && relayUrl !== void 0 ? relayUrl : '',
|
|
@@ -222,7 +221,6 @@ const useDynamicWaas = () => {
|
|
|
222
221
|
getElevatedAccessToken,
|
|
223
222
|
getMfaToken,
|
|
224
223
|
getWalletPassword,
|
|
225
|
-
getSignedSessionId,
|
|
226
224
|
relayUrl,
|
|
227
225
|
baseClientKeysharesRelayApiUrl,
|
|
228
226
|
]);
|
|
@@ -299,7 +297,7 @@ const useDynamicWaas = () => {
|
|
|
299
297
|
walletAddress: wallet.address,
|
|
300
298
|
});
|
|
301
299
|
const keyshareRestorationStart = new Date().getTime();
|
|
302
|
-
const signedSessionId = yield
|
|
300
|
+
const signedSessionId = yield generateChainingSignature();
|
|
303
301
|
yield client.getWallet({
|
|
304
302
|
accountAddress: wallet.address,
|
|
305
303
|
authToken: getMinAuthToken(),
|
|
@@ -357,13 +355,7 @@ const useDynamicWaas = () => {
|
|
|
357
355
|
userId: user.id,
|
|
358
356
|
});
|
|
359
357
|
}
|
|
360
|
-
}), [
|
|
361
|
-
enabledChainNames,
|
|
362
|
-
getSignedSessionId,
|
|
363
|
-
getWaasWalletConnector,
|
|
364
|
-
shouldInitializeWaas,
|
|
365
|
-
user,
|
|
366
|
-
]);
|
|
358
|
+
}), [enabledChainNames, getWaasWalletConnector, shouldInitializeWaas, user]);
|
|
367
359
|
// If no chain names are provided, filter out chains that already have a wallet
|
|
368
360
|
// and make a wallet for each enabled chain
|
|
369
361
|
const createWalletAccount = useCallback((requirementsOrChainNames, password, bitcoinConfig, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -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 keyService = require('../../functions/keyService/keyService.cjs');
|
|
33
32
|
require('../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
34
33
|
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
35
34
|
var useOnboardingCompleteUser = require('../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.cjs');
|
|
35
|
+
var keyService = require('../../functions/keyService/keyService.cjs');
|
|
36
36
|
var getTurnkeyWalletId = require('../../functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs');
|
|
37
37
|
var embeddedWalletSessionKeysUtils = require('../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.cjs');
|
|
38
38
|
|
|
@@ -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 { toEncodedFormat, p256Sign } from '../../functions/keyService/keyService.js';
|
|
29
28
|
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
30
29
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
31
30
|
import { useOnboardingCompleteUserProfile } from '../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js';
|
|
31
|
+
import { toEncodedFormat, p256Sign } from '../../functions/keyService/keyService.js';
|
|
32
32
|
import { getTurnkeyWalletId } from '../../functions/getTurnkeyWalletId/getTurnkeyWalletId.js';
|
|
33
33
|
import { generateAndSaveSessionKey, generateSessionKey } from '../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.js';
|
|
34
34
|
|