@dynamic-labs/sdk-react-core 4.20.4 → 4.20.6
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 +22 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/functions.d.ts +1 -0
- package/src/index.cjs +5 -2
- package/src/index.d.ts +3 -1
- package/src/index.js +3 -2
- package/src/lib/Main.cjs +2 -2
- package/src/lib/Main.js +3 -3
- package/src/lib/components/ModalCard/ModalCard.cjs +3 -1
- package/src/lib/components/ModalCard/ModalCard.d.ts +2 -0
- package/src/lib/components/ModalCard/ModalCard.js +3 -1
- package/src/lib/components/UserWalletsList/UserWalletsList.cjs +2 -2
- package/src/lib/components/UserWalletsList/UserWalletsList.js +3 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +8 -3
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +8 -3
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +2 -2
- package/src/lib/context/UserWalletsContext/UserWalletsContext.d.ts +1 -1
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +2 -2
- package/src/lib/data/api/api.cjs +5 -0
- package/src/lib/data/api/api.js +5 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +1 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +1 -0
- package/src/lib/locale/en/translation.cjs +15 -0
- package/src/lib/locale/en/translation.d.ts +15 -0
- package/src/lib/locale/en/translation.js +15 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/sessionStorage.cjs +12 -0
- package/src/lib/utils/constants/sessionStorage.d.ts +2 -0
- package/src/lib/utils/constants/sessionStorage.js +7 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.cjs +8 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.d.ts +1 -0
- package/src/lib/utils/functions/clientSessionKeys/constants.js +4 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.cjs +67 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.d.ts +17 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.js +58 -0
- package/src/lib/utils/functions/clientSessionKeys/index.d.ts +1 -0
- package/src/lib/utils/functions/clientSessionKeys/types.d.ts +5 -0
- package/src/lib/utils/functions/index.d.ts +2 -0
- package/src/lib/utils/functions/keyService/index.d.ts +1 -0
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.cjs → functions/keyService/keyService.cjs} +13 -1
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.d.ts → functions/keyService/keyService.d.ts} +1 -0
- package/src/lib/utils/{hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/utils.js → functions/keyService/keyService.js} +13 -2
- package/src/lib/utils/functions/usingV3Wallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useClientSessionKeys/index.d.ts +1 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs +63 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.d.ts +5 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.js +59 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useDynamicWaas/constants.cjs +3 -1
- package/src/lib/utils/hooks/useDynamicWaas/constants.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/constants.js +3 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +75 -57
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +76 -58
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +6 -17
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +1 -12
- package/src/lib/utils/hooks/useFundWithWallet/useChooseLinkedWallet/useChooseLinkedWallet.cjs +1 -1
- package/src/lib/utils/hooks/useFundWithWallet/useChooseLinkedWallet/useChooseLinkedWallet.js +2 -2
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +1 -1
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +1 -1
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +1 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +3 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +3 -1
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -1
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +2 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +0 -5
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +0 -5
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +4 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +4 -1
- package/src/lib/utils/hooks/useWalletList/useWalletList.cjs +1 -1
- package/src/lib/utils/hooks/useWalletList/useWalletList.js +2 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +13 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.cjs +134 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.d.ts +18 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.js +130 -0
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/index.d.ts +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const CLIENT_SESSION_KEYS = 'dynamic_client_session_keys';
|
|
7
|
+
const CLIENT_SESSION_KEYS_STORAGE_OPTIONS = {
|
|
8
|
+
priority: ['secureStorage', 'sessionStorage'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.CLIENT_SESSION_KEYS = CLIENT_SESSION_KEYS;
|
|
12
|
+
exports.CLIENT_SESSION_KEYS_STORAGE_OPTIONS = CLIENT_SESSION_KEYS_STORAGE_OPTIONS;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { StorageOptions } from '@dynamic-labs/utils';
|
|
2
|
+
export declare const CLIENT_SESSION_KEYS = "dynamic_client_session_keys";
|
|
3
|
+
export declare const CLIENT_SESSION_KEYS_STORAGE_OPTIONS: StorageOptions;
|
|
2
4
|
export declare const SECURE_ENCLAVE_WALLET_SESSION_KEYS = "dynamic_secure_enclave_session_keys";
|
|
3
5
|
export declare const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS: StorageOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const clientSessionKeyLogScope = "client-session-key";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var sessionStorage = require('../../constants/sessionStorage.cjs');
|
|
9
|
+
var keyService = require('../keyService/keyService.cjs');
|
|
10
|
+
var constants = require('./constants.cjs');
|
|
11
|
+
|
|
12
|
+
const getClientSessionKeys = () => {
|
|
13
|
+
const sessionKeysSS = utils.StorageService.getItem(sessionStorage.CLIENT_SESSION_KEYS, sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
14
|
+
const decodedSessionKeys = sessionKeysSS
|
|
15
|
+
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
16
|
+
: undefined;
|
|
17
|
+
return decodedSessionKeys;
|
|
18
|
+
};
|
|
19
|
+
const generateKeyPair = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const { private: privateKey, public: publicKey, privateJwk, } = yield keyService.p256Keygen();
|
|
21
|
+
// convert to base64 and store the session keys in session storage
|
|
22
|
+
utils.StorageService.setItem(sessionStorage.CLIENT_SESSION_KEYS, keyService.toEncodedFormat(publicKey, privateKey, privateJwk, false), sessionStorage.CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
23
|
+
utils.tracing.logEvent(constants.clientSessionKeyLogScope, 'Generated new session key pair', utils.tracing.formatObject({
|
|
24
|
+
publicKey,
|
|
25
|
+
}));
|
|
26
|
+
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
27
|
+
});
|
|
28
|
+
const generateSessionSignature = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return keyService.p256Sign(privateKeyJwk, sessionId); });
|
|
29
|
+
const generateClientSessionKeys = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
// check if session keys are already stored in session storage
|
|
31
|
+
const clientSessionKeysSS = getClientSessionKeys();
|
|
32
|
+
utils.tracing.logEvent(constants.clientSessionKeyLogScope, 'getClientSessionKeys', utils.tracing.formatObject({
|
|
33
|
+
hasDecodedSessionKeys: Boolean(clientSessionKeysSS),
|
|
34
|
+
publicKey: clientSessionKeysSS === null || clientSessionKeysSS === void 0 ? void 0 : clientSessionKeysSS.publicKey,
|
|
35
|
+
}));
|
|
36
|
+
let publicKey;
|
|
37
|
+
if (clientSessionKeysSS) {
|
|
38
|
+
({ publicKey } = clientSessionKeysSS);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
({ publicKey } = yield generateKeyPair());
|
|
42
|
+
}
|
|
43
|
+
return { publicKey };
|
|
44
|
+
});
|
|
45
|
+
const getClientSessionPublicKey = () => {
|
|
46
|
+
const clientSessionKeys = getClientSessionKeys();
|
|
47
|
+
return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
|
|
48
|
+
};
|
|
49
|
+
const getClientSessionSignature = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ sessionId, }) {
|
|
50
|
+
const clientSessionKeys = getClientSessionKeys();
|
|
51
|
+
if (!clientSessionKeys) {
|
|
52
|
+
throw new Error('Client session keys not found');
|
|
53
|
+
}
|
|
54
|
+
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
55
|
+
const sessionSignature = yield generateSessionSignature({
|
|
56
|
+
privateKeyJwk,
|
|
57
|
+
sessionId,
|
|
58
|
+
});
|
|
59
|
+
return { publicKey, sessionSignature };
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
exports.generateClientSessionKeys = generateClientSessionKeys;
|
|
63
|
+
exports.generateKeyPair = generateKeyPair;
|
|
64
|
+
exports.generateSessionSignature = generateSessionSignature;
|
|
65
|
+
exports.getClientSessionKeys = getClientSessionKeys;
|
|
66
|
+
exports.getClientSessionPublicKey = getClientSessionPublicKey;
|
|
67
|
+
exports.getClientSessionSignature = getClientSessionSignature;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClientSessionKey } from './types';
|
|
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 generateClientSessionKeys: () => Promise<{
|
|
9
|
+
publicKey: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const getClientSessionPublicKey: () => string | undefined;
|
|
12
|
+
export declare const getClientSessionSignature: ({ sessionId, }: {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
publicKey: string;
|
|
16
|
+
sessionSignature: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { StorageService, tracing } from '@dynamic-labs/utils';
|
|
4
|
+
import { CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS } from '../../constants/sessionStorage.js';
|
|
5
|
+
import { p256Sign, p256Keygen, toEncodedFormat } from '../keyService/keyService.js';
|
|
6
|
+
import { clientSessionKeyLogScope } from './constants.js';
|
|
7
|
+
|
|
8
|
+
const getClientSessionKeys = () => {
|
|
9
|
+
const sessionKeysSS = StorageService.getItem(CLIENT_SESSION_KEYS, CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
10
|
+
const decodedSessionKeys = sessionKeysSS
|
|
11
|
+
? JSON.parse(Buffer.from(sessionKeysSS, 'base64').toString())
|
|
12
|
+
: undefined;
|
|
13
|
+
return decodedSessionKeys;
|
|
14
|
+
};
|
|
15
|
+
const generateKeyPair = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const { private: privateKey, public: publicKey, privateJwk, } = yield p256Keygen();
|
|
17
|
+
// convert to base64 and store the session keys in session storage
|
|
18
|
+
StorageService.setItem(CLIENT_SESSION_KEYS, toEncodedFormat(publicKey, privateKey, privateJwk, false), CLIENT_SESSION_KEYS_STORAGE_OPTIONS);
|
|
19
|
+
tracing.logEvent(clientSessionKeyLogScope, 'Generated new session key pair', tracing.formatObject({
|
|
20
|
+
publicKey,
|
|
21
|
+
}));
|
|
22
|
+
return { privateKey, privateKeyJwk: privateJwk, publicKey };
|
|
23
|
+
});
|
|
24
|
+
const generateSessionSignature = (_a) => __awaiter(void 0, [_a], void 0, function* ({ privateKeyJwk, sessionId, }) { return p256Sign(privateKeyJwk, sessionId); });
|
|
25
|
+
const generateClientSessionKeys = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
// check if session keys are already stored in session storage
|
|
27
|
+
const clientSessionKeysSS = getClientSessionKeys();
|
|
28
|
+
tracing.logEvent(clientSessionKeyLogScope, 'getClientSessionKeys', tracing.formatObject({
|
|
29
|
+
hasDecodedSessionKeys: Boolean(clientSessionKeysSS),
|
|
30
|
+
publicKey: clientSessionKeysSS === null || clientSessionKeysSS === void 0 ? void 0 : clientSessionKeysSS.publicKey,
|
|
31
|
+
}));
|
|
32
|
+
let publicKey;
|
|
33
|
+
if (clientSessionKeysSS) {
|
|
34
|
+
({ publicKey } = clientSessionKeysSS);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
({ publicKey } = yield generateKeyPair());
|
|
38
|
+
}
|
|
39
|
+
return { publicKey };
|
|
40
|
+
});
|
|
41
|
+
const getClientSessionPublicKey = () => {
|
|
42
|
+
const clientSessionKeys = getClientSessionKeys();
|
|
43
|
+
return clientSessionKeys === null || clientSessionKeys === void 0 ? void 0 : clientSessionKeys.publicKey;
|
|
44
|
+
};
|
|
45
|
+
const getClientSessionSignature = (_b) => __awaiter(void 0, [_b], void 0, function* ({ sessionId, }) {
|
|
46
|
+
const clientSessionKeys = getClientSessionKeys();
|
|
47
|
+
if (!clientSessionKeys) {
|
|
48
|
+
throw new Error('Client session keys not found');
|
|
49
|
+
}
|
|
50
|
+
const { publicKey, privateKeyJwk } = clientSessionKeys;
|
|
51
|
+
const sessionSignature = yield generateSessionSignature({
|
|
52
|
+
privateKeyJwk,
|
|
53
|
+
sessionId,
|
|
54
|
+
});
|
|
55
|
+
return { publicKey, sessionSignature };
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export { generateClientSessionKeys, generateKeyPair, generateSessionSignature, getClientSessionKeys, getClientSessionPublicKey, getClientSessionSignature };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getClientSessionKeys';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './keyService';
|
|
@@ -3,8 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
|
|
8
|
+
const toEncodedFormat = (publicKey, privateKey, privateKeyJwk, registered, expirationDate) => {
|
|
9
|
+
const sessionKeys = {
|
|
10
|
+
expirationDate,
|
|
11
|
+
privateKey,
|
|
12
|
+
privateKeyJwk,
|
|
13
|
+
publicKey,
|
|
14
|
+
registered,
|
|
15
|
+
};
|
|
16
|
+
const sessionKeysString = JSON.stringify(sessionKeys);
|
|
17
|
+
return Buffer.from(sessionKeysString).toString('base64');
|
|
18
|
+
};
|
|
8
19
|
// Converts an ArrayBuffer to a hex-encoded string
|
|
9
20
|
const buf2hex = (buffer) => [...new Uint8Array(buffer)]
|
|
10
21
|
.map((x) => x.toString(16).padStart(2, '0'))
|
|
@@ -64,3 +75,4 @@ exports.buf2hex = buf2hex;
|
|
|
64
75
|
exports.compressRawPublicKey = compressRawPublicKey;
|
|
65
76
|
exports.p256Keygen = p256Keygen;
|
|
66
77
|
exports.p256Sign = p256Sign;
|
|
78
|
+
exports.toEncodedFormat = toEncodedFormat;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const toEncodedFormat: (publicKey: string, privateKey: string, privateKeyJwk: JsonWebKey, registered: boolean, expirationDate?: Date) => string;
|
|
1
2
|
export declare const buf2hex: (buffer: ArrayBufferLike) => string;
|
|
2
3
|
export declare const base64urlDecode: (s?: string) => Uint8Array;
|
|
3
4
|
export declare const compressRawPublicKey: (rawPublicKey: ArrayBuffer) => ArrayBufferLike;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
|
|
4
|
+
const toEncodedFormat = (publicKey, privateKey, privateKeyJwk, registered, expirationDate) => {
|
|
5
|
+
const sessionKeys = {
|
|
6
|
+
expirationDate,
|
|
7
|
+
privateKey,
|
|
8
|
+
privateKeyJwk,
|
|
9
|
+
publicKey,
|
|
10
|
+
registered,
|
|
11
|
+
};
|
|
12
|
+
const sessionKeysString = JSON.stringify(sessionKeys);
|
|
13
|
+
return Buffer.from(sessionKeysString).toString('base64');
|
|
14
|
+
};
|
|
4
15
|
// Converts an ArrayBuffer to a hex-encoded string
|
|
5
16
|
const buf2hex = (buffer) => [...new Uint8Array(buffer)]
|
|
6
17
|
.map((x) => x.toString(16).padStart(2, '0'))
|
|
@@ -55,4 +66,4 @@ const p256Sign = (privateKeyJwk, message) => __awaiter(void 0, void 0, void 0, f
|
|
|
55
66
|
return buf2hex(signature);
|
|
56
67
|
});
|
|
57
68
|
|
|
58
|
-
export { base64urlDecode, buf2hex, compressRawPublicKey, p256Keygen, p256Sign };
|
|
69
|
+
export { base64urlDecode, buf2hex, compressRawPublicKey, p256Keygen, p256Sign, toEncodedFormat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usingV3Wallets';
|
|
@@ -78,3 +78,4 @@ export { useDynamicWaas } from './useDynamicWaas';
|
|
|
78
78
|
export { useSyncDynamicWaas } from './useSyncDynamicWaas';
|
|
79
79
|
export { useExchangeAccounts } from './useExchangeAccounts';
|
|
80
80
|
export { useConnectExchangeForFunding } from './useConnectExchangeForFunding';
|
|
81
|
+
export { useClientSessionKeys } from './useClientSessionKeys';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useClientSessionKeys } from './useClientSessionKeys';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var usePromise = require('../usePromise/usePromise.cjs');
|
|
9
|
+
require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('../../constants/values.cjs');
|
|
11
|
+
require('@dynamic-labs/utils');
|
|
12
|
+
require('@dynamic-labs/multi-wallet');
|
|
13
|
+
require('../../../shared/logger.cjs');
|
|
14
|
+
require('../../constants/colors.cjs');
|
|
15
|
+
require('react-international-phone');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
+
require('react/jsx-runtime');
|
|
19
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
20
|
+
require('@dynamic-labs/wallet-book');
|
|
21
|
+
require('../../../shared/consts/index.cjs');
|
|
22
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
23
|
+
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
24
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
25
|
+
var user = require('../../../store/state/user/user.cjs');
|
|
26
|
+
require('../../../locale/locale.cjs');
|
|
27
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
+
var getClientSessionKeys = require('../../functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
31
|
+
|
|
32
|
+
const useClientSessionKeys = () => {
|
|
33
|
+
const { user: user$1 } = user.useUser();
|
|
34
|
+
const sessionPublicKey = getClientSessionKeys.getClientSessionPublicKey();
|
|
35
|
+
usePromise.usePromise(getClientSessionKeys.generateClientSessionKeys, {
|
|
36
|
+
deps: [sessionPublicKey],
|
|
37
|
+
enabled: !sessionPublicKey,
|
|
38
|
+
initialData: undefined,
|
|
39
|
+
retries: 2,
|
|
40
|
+
});
|
|
41
|
+
const getSignedSessionId = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
if (!(user$1 === null || user$1 === void 0 ? void 0 : user$1.sessionId) || !sessionPublicKey) {
|
|
43
|
+
throw new Error('Session ID and public key are required');
|
|
44
|
+
}
|
|
45
|
+
const result = yield getClientSessionKeys.getClientSessionSignature({
|
|
46
|
+
sessionId: user$1 === null || user$1 === void 0 ? void 0 : user$1.sessionId,
|
|
47
|
+
});
|
|
48
|
+
return result.sessionSignature;
|
|
49
|
+
}), [user$1 === null || user$1 === void 0 ? void 0 : user$1.sessionId, sessionPublicKey]);
|
|
50
|
+
const { data: sessionSignatureResult } = usePromise.usePromise(getSignedSessionId, {
|
|
51
|
+
deps: [user$1 === null || user$1 === void 0 ? void 0 : user$1.sessionId, sessionPublicKey],
|
|
52
|
+
enabled: Boolean(user$1 === null || user$1 === void 0 ? void 0 : user$1.sessionId) && Boolean(sessionPublicKey),
|
|
53
|
+
initialData: undefined,
|
|
54
|
+
retries: 2,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
getSignedSessionId,
|
|
58
|
+
sessionPublicKey,
|
|
59
|
+
sessionSignature: sessionSignatureResult,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.useClientSessionKeys = useClientSessionKeys;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { usePromise } from '../usePromise/usePromise.js';
|
|
5
|
+
import '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '../../constants/values.js';
|
|
7
|
+
import '@dynamic-labs/utils';
|
|
8
|
+
import '@dynamic-labs/multi-wallet';
|
|
9
|
+
import '../../../shared/logger.js';
|
|
10
|
+
import '../../constants/colors.js';
|
|
11
|
+
import 'react-international-phone';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
+
import 'react/jsx-runtime';
|
|
15
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
16
|
+
import '@dynamic-labs/wallet-book';
|
|
17
|
+
import '../../../shared/consts/index.js';
|
|
18
|
+
import '../../../store/state/nonce/nonce.js';
|
|
19
|
+
import '../../../store/state/projectSettings/projectSettings.js';
|
|
20
|
+
import '../../../config/ApiEndpoint.js';
|
|
21
|
+
import { useUser } from '../../../store/state/user/user.js';
|
|
22
|
+
import '../../../locale/locale.js';
|
|
23
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
+
import { getClientSessionPublicKey, getClientSessionSignature, generateClientSessionKeys } from '../../functions/clientSessionKeys/getClientSessionKeys.js';
|
|
27
|
+
|
|
28
|
+
const useClientSessionKeys = () => {
|
|
29
|
+
const { user } = useUser();
|
|
30
|
+
const sessionPublicKey = getClientSessionPublicKey();
|
|
31
|
+
usePromise(generateClientSessionKeys, {
|
|
32
|
+
deps: [sessionPublicKey],
|
|
33
|
+
enabled: !sessionPublicKey,
|
|
34
|
+
initialData: undefined,
|
|
35
|
+
retries: 2,
|
|
36
|
+
});
|
|
37
|
+
const getSignedSessionId = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
if (!(user === null || user === void 0 ? void 0 : user.sessionId) || !sessionPublicKey) {
|
|
39
|
+
throw new Error('Session ID and public key are required');
|
|
40
|
+
}
|
|
41
|
+
const result = yield getClientSessionSignature({
|
|
42
|
+
sessionId: user === null || user === void 0 ? void 0 : user.sessionId,
|
|
43
|
+
});
|
|
44
|
+
return result.sessionSignature;
|
|
45
|
+
}), [user === null || user === void 0 ? void 0 : user.sessionId, sessionPublicKey]);
|
|
46
|
+
const { data: sessionSignatureResult } = usePromise(getSignedSessionId, {
|
|
47
|
+
deps: [user === null || user === void 0 ? void 0 : user.sessionId, sessionPublicKey],
|
|
48
|
+
enabled: Boolean(user === null || user === void 0 ? void 0 : user.sessionId) && Boolean(sessionPublicKey),
|
|
49
|
+
initialData: undefined,
|
|
50
|
+
retries: 2,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
getSignedSessionId,
|
|
54
|
+
sessionPublicKey,
|
|
55
|
+
sessionSignature: sessionSignatureResult,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { useClientSessionKeys };
|
|
@@ -156,6 +156,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
156
156
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
157
157
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
158
158
|
},
|
|
159
|
+
'confirm-exchange-transfer': {
|
|
160
|
+
copykey: 'dyn_exchange_transfer_confirmation.title',
|
|
161
|
+
heading: t('dyn_exchange_transfer_confirmation.title'),
|
|
162
|
+
},
|
|
159
163
|
'deposit-view': {
|
|
160
164
|
copykey: 'dyn_deposit.title',
|
|
161
165
|
heading: t('dyn_deposit.title'),
|
|
@@ -152,6 +152,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
152
152
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
153
153
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
154
154
|
},
|
|
155
|
+
'confirm-exchange-transfer': {
|
|
156
|
+
copykey: 'dyn_exchange_transfer_confirmation.title',
|
|
157
|
+
heading: t('dyn_exchange_transfer_confirmation.title'),
|
|
158
|
+
},
|
|
155
159
|
'deposit-view': {
|
|
156
160
|
copykey: 'dyn_deposit.title',
|
|
157
161
|
heading: t('dyn_deposit.title'),
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
|
|
6
|
+
const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.';
|
|
7
7
|
const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
|
|
8
8
|
const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
|
|
9
|
+
const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
|
|
9
10
|
|
|
10
11
|
exports.DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR;
|
|
11
12
|
exports.INVALID_CHAINS_ERROR = INVALID_CHAINS_ERROR;
|
|
12
13
|
exports.NO_ENABLED_CHAINS_ERROR = NO_ENABLED_CHAINS_ERROR;
|
|
14
|
+
exports.WALLET_CREATION_FAILED_ERROR = WALLET_CREATION_FAILED_ERROR;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chains";
|
|
1
|
+
export declare const NO_ENABLED_CHAINS_ERROR = "No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.";
|
|
2
2
|
export declare const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = "Dynamic Waas connector not found";
|
|
3
3
|
export declare const INVALID_CHAINS_ERROR = "The following chains are not enabled for embedded wallets";
|
|
4
|
+
export declare const WALLET_CREATION_FAILED_ERROR = "Failed to create wallet account for the following chains";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains';
|
|
2
|
+
const NO_ENABLED_CHAINS_ERROR = 'No enabled embedded wallet chains. Please go to the Dynamic Dashboard, select Embedded Wallets, and then click the gear icon on the top row to enable a new chain.';
|
|
3
3
|
const DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR = 'Dynamic Waas connector not found';
|
|
4
4
|
const INVALID_CHAINS_ERROR = 'The following chains are not enabled for embedded wallets';
|
|
5
|
+
const WALLET_CREATION_FAILED_ERROR = 'Failed to create wallet account for the following chains';
|
|
5
6
|
|
|
6
|
-
export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, INVALID_CHAINS_ERROR, NO_ENABLED_CHAINS_ERROR };
|
|
7
|
+
export { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, INVALID_CHAINS_ERROR, NO_ENABLED_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR };
|