@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/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
## [4.69.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.68.0...v4.69.0) (2026-03-19)
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
|
-
* add
|
|
8
|
-
* add
|
|
9
|
-
*
|
|
10
|
-
* add step-up auth for email and SMS credential updates ([#10676](https://github.com/dynamic-labs/dynamic-auth/issues/10676)) ([4c7f0a5](https://github.com/dynamic-labs/dynamic-auth/commit/4c7f0a5330e557aea4db85359f7ac10d3c7545a5))
|
|
11
|
-
* add step-up auth for wallet link and unlink ([#10678](https://github.com/dynamic-labs/dynamic-auth/issues/10678)) ([8a015ca](https://github.com/dynamic-labs/dynamic-auth/commit/8a015ca0fd0bda71559c21b811b7e6acb43a7909))
|
|
12
|
-
* add TrustedDevicesSection and ManageTrustedDevicesView ([#10639](https://github.com/dynamic-labs/dynamic-auth/issues/10639)) ([17df870](https://github.com/dynamic-labs/dynamic-auth/commit/17df870caa34a8428d65510e5b3c9e9c7b93cea2))
|
|
13
|
-
* add useSyncDeviceRegistrationFlow ([#10640](https://github.com/dynamic-labs/dynamic-auth/issues/10640)) ([8c7752d](https://github.com/dynamic-labs/dynamic-auth/commit/8c7752d7a8afedaa3cc99fad83091586f7b6107e))
|
|
14
|
-
* **sdk-react-core:** prompt step-up auth before export private key ([#10647](https://github.com/dynamic-labs/dynamic-auth/issues/10647)) ([a39d886](https://github.com/dynamic-labs/dynamic-auth/commit/a39d88643af83484aae09332adcd05df8c0f923c))
|
|
15
|
-
* **step-up:** reauth flow with signInCredentialId and choose-method UI ([#10644](https://github.com/dynamic-labs/dynamic-auth/issues/10644)) ([086a97f](https://github.com/dynamic-labs/dynamic-auth/commit/086a97f27d908780b17f49f8a85ce88c34f61ed8))
|
|
7
|
+
* add MoonPay icon to iconic ([#10666](https://github.com/dynamic-labs/dynamic-auth/issues/10666)) ([19d437b](https://github.com/dynamic-labs/dynamic-auth/commit/19d437b1a55e2b7800d65f375217b735f29d10eb))
|
|
8
|
+
* add step-up auth for OAuth and email credential link and unlink ([#10679](https://github.com/dynamic-labs/dynamic-auth/issues/10679)) ([ba48be8](https://github.com/dynamic-labs/dynamic-auth/commit/ba48be874e44c033563ae107e46a1b90f3c307d6))
|
|
9
|
+
* replace React session chaining with pure SDK implementation ([#10423](https://github.com/dynamic-labs/dynamic-auth/issues/10423)) ([2279421](https://github.com/dynamic-labs/dynamic-auth/commit/227942153828192d316d19295a69d9e7a5baa85c))
|
|
16
10
|
|
|
17
11
|
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* csp nonce global styles ([#10591](https://github.com/dynamic-labs/dynamic-auth/issues/10591)) ([6ea9c14](https://github.com/dynamic-labs/dynamic-auth/commit/6ea9c141055b3a337d8841dbebec00c7a3cb5d93))
|
|
15
|
+
|
|
16
|
+
## [4.68.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.67.2...v4.68.0) (2026-03-19)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add freighter ledger support on stellar ([#10665](https://github.com/dynamic-labs/dynamic-auth/issues/10665)) ([dedbaa6](https://github.com/dynamic-labs/dynamic-auth/commit/dedbaa6038f282b9e41b9166cad3ad6d5032948d))
|
|
22
|
+
|
|
18
23
|
### Bug Fixes
|
|
19
24
|
|
|
20
25
|
* close auth flow on re-login when user already has embedded wallets ([#10641](https://github.com/dynamic-labs/dynamic-auth/issues/10641)) ([1aab930](https://github.com/dynamic-labs/dynamic-auth/commit/1aab9307c904f79bc0534026547fc112c55f6dc9))
|
package/package.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.69.0";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.907",
|
|
9
|
-
"@dynamic-labs-sdk/client": "0.17.
|
|
9
|
+
"@dynamic-labs-sdk/client": "0.17.2",
|
|
10
10
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.289",
|
|
11
11
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
12
12
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.
|
|
2
|
+
var version = "4.69.0";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.907",
|
|
5
|
-
"@dynamic-labs-sdk/client": "0.17.
|
|
5
|
+
"@dynamic-labs-sdk/client": "0.17.2",
|
|
6
6
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.289",
|
|
7
7
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
8
8
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.69.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.907",
|
|
6
|
-
"@dynamic-labs-sdk/client": "0.17.
|
|
6
|
+
"@dynamic-labs-sdk/client": "0.17.2",
|
|
7
7
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.289",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
9
9
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
20
|
-
"@dynamic-labs/iconic": "4.
|
|
21
|
-
"@dynamic-labs/locale": "4.
|
|
22
|
-
"@dynamic-labs/logger": "4.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
25
|
-
"@dynamic-labs/store": "4.
|
|
26
|
-
"@dynamic-labs/types": "4.
|
|
27
|
-
"@dynamic-labs/utils": "4.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.69.0",
|
|
20
|
+
"@dynamic-labs/iconic": "4.69.0",
|
|
21
|
+
"@dynamic-labs/locale": "4.69.0",
|
|
22
|
+
"@dynamic-labs/logger": "4.69.0",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.69.0",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.69.0",
|
|
25
|
+
"@dynamic-labs/store": "4.69.0",
|
|
26
|
+
"@dynamic-labs/types": "4.69.0",
|
|
27
|
+
"@dynamic-labs/utils": "4.69.0",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.69.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.69.0",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/lib/Main.cjs
CHANGED
|
@@ -109,7 +109,6 @@ var PopperContext = require('./components/Popper/PopperContext/PopperContext.cjs
|
|
|
109
109
|
var Portal = require('./components/Portal/Portal.cjs');
|
|
110
110
|
require('qrcode');
|
|
111
111
|
var RenderView = require('./components/RenderView/RenderView.cjs');
|
|
112
|
-
require('./main.global.cjs');
|
|
113
112
|
var useVerifyOnAwaitingSignature = require('./utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs');
|
|
114
113
|
|
|
115
114
|
const viewsToDisableCloseOnOverlayClick = [
|
package/src/lib/Main.d.ts
CHANGED
package/src/lib/Main.js
CHANGED
|
@@ -105,7 +105,6 @@ import { PopperProvider } from './components/Popper/PopperContext/PopperContext.
|
|
|
105
105
|
import { Portal } from './components/Portal/Portal.js';
|
|
106
106
|
import 'qrcode';
|
|
107
107
|
import { RenderView } from './components/RenderView/RenderView.js';
|
|
108
|
-
import './main.global.js';
|
|
109
108
|
import { useVerifyOnAwaitingSignature } from './utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js';
|
|
110
109
|
|
|
111
110
|
const viewsToDisableCloseOnOverlayClick = [
|
package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
|
+
|
|
10
|
+
const generateChainingSignature = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const { signature } = yield core.getSignedSessionId(client.getDefaultClient());
|
|
12
|
+
return signature;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.generateChainingSignature = generateChainingSignature;
|
package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateChainingSignature: () => Promise<string>;
|
package/src/lib/client/extension/functions/generateChainingSignature/generateChainingSignature.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { getSignedSessionId } from '@dynamic-labs-sdk/client/core';
|
|
5
|
+
|
|
6
|
+
const generateChainingSignature = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { signature } = yield getSignedSessionId(getDefaultClient());
|
|
8
|
+
return signature;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { generateChainingSignature };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
8
|
+
|
|
9
|
+
const generateSessionKeys = () => core.generateSessionKeys(client.getDefaultClient());
|
|
10
|
+
|
|
11
|
+
exports.generateSessionKeys = generateSessionKeys;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateSessionKeys: () => Promise<import("@dynamic-labs-sdk/client/core").SessionKeys>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
3
|
+
import { generateSessionKeys as generateSessionKeys$1 } from '@dynamic-labs-sdk/client/core';
|
|
4
|
+
|
|
5
|
+
const generateSessionKeys = () => generateSessionKeys$1(getDefaultClient());
|
|
6
|
+
|
|
7
|
+
export { generateSessionKeys };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the nonce, nonce signature, and session public key needed for
|
|
12
|
+
* Turnkey session key registration headers.
|
|
13
|
+
*
|
|
14
|
+
* Parses the combined session chaining signature format:
|
|
15
|
+
* `${signedSessionId}/${nonceSignature}/${nonce}`
|
|
16
|
+
*
|
|
17
|
+
* Note: signatures are hex-encoded (no slashes), so splitting on '/' is safe.
|
|
18
|
+
*/
|
|
19
|
+
const getClientSessionNonceHeaders = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const client$1 = client.getDefaultClient();
|
|
22
|
+
const { signature } = yield core.getSignedSessionId(client$1);
|
|
23
|
+
// signature format: "${signedSessionId}/${nonceSignature}/${nonce}"
|
|
24
|
+
const parts = signature.split('/');
|
|
25
|
+
if (parts.length < 3) {
|
|
26
|
+
throw new Error(`Unexpected session chaining signature format: expected 3 parts, got ${parts.length}`);
|
|
27
|
+
}
|
|
28
|
+
const [, nonceSignature, nonce] = parts;
|
|
29
|
+
const publicKey = (_b = (_a = core.getSessionKeys(client$1)) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : '';
|
|
30
|
+
return { nonce, nonceSignature, publicKey };
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.getClientSessionNonceHeaders = getClientSessionNonceHeaders;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ClientSessionNonceHeaders = {
|
|
2
|
+
nonce: string;
|
|
3
|
+
nonceSignature: string;
|
|
4
|
+
publicKey: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns the nonce, nonce signature, and session public key needed for
|
|
8
|
+
* Turnkey session key registration headers.
|
|
9
|
+
*
|
|
10
|
+
* Parses the combined session chaining signature format:
|
|
11
|
+
* `${signedSessionId}/${nonceSignature}/${nonce}`
|
|
12
|
+
*
|
|
13
|
+
* Note: signatures are hex-encoded (no slashes), so splitting on '/' is safe.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getClientSessionNonceHeaders: () => Promise<ClientSessionNonceHeaders>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { getSignedSessionId, getSessionKeys } from '@dynamic-labs-sdk/client/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the nonce, nonce signature, and session public key needed for
|
|
8
|
+
* Turnkey session key registration headers.
|
|
9
|
+
*
|
|
10
|
+
* Parses the combined session chaining signature format:
|
|
11
|
+
* `${signedSessionId}/${nonceSignature}/${nonce}`
|
|
12
|
+
*
|
|
13
|
+
* Note: signatures are hex-encoded (no slashes), so splitting on '/' is safe.
|
|
14
|
+
*/
|
|
15
|
+
const getClientSessionNonceHeaders = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const client = getDefaultClient();
|
|
18
|
+
const { signature } = yield getSignedSessionId(client);
|
|
19
|
+
// signature format: "${signedSessionId}/${nonceSignature}/${nonce}"
|
|
20
|
+
const parts = signature.split('/');
|
|
21
|
+
if (parts.length < 3) {
|
|
22
|
+
throw new Error(`Unexpected session chaining signature format: expected 3 parts, got ${parts.length}`);
|
|
23
|
+
}
|
|
24
|
+
const [, nonceSignature, nonce] = parts;
|
|
25
|
+
const publicKey = (_b = (_a = getSessionKeys(client)) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : '';
|
|
26
|
+
return { nonce, nonceSignature, publicKey };
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { getClientSessionNonceHeaders };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getSessionKeys: () => import("@dynamic-labs-sdk/client/core").SessionKeys | undefined;
|
package/src/lib/client/extension/functions/migrateClientSessionKey/migrateClientSessionKey.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
|
+
require('@dynamic-labs/iconic');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
require('react');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
15
|
+
require('@dynamic-labs/wallet-book');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../utils/constants/colors.cjs');
|
|
18
|
+
require('../../../../utils/constants/values.cjs');
|
|
19
|
+
require('@dynamic-labs/sdk-api-core');
|
|
20
|
+
require('../../../../shared/consts/index.cjs');
|
|
21
|
+
var getClientSessionKeys = require('../../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
22
|
+
|
|
23
|
+
const migrateClientSessionKey = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
try {
|
|
25
|
+
// Wait for the SDK to finish initializing (including its own migration phase)
|
|
26
|
+
// before overwriting the keychain — react-SDK keys always take precedence.
|
|
27
|
+
const client$1 = client.getDefaultClient();
|
|
28
|
+
yield client.waitForClientInitialized(client$1);
|
|
29
|
+
logger.logger.debug('[migrateClientSessionKey] Checking for legacy session key in storage');
|
|
30
|
+
const legacy = getClientSessionKeys.getClientSessionKeys();
|
|
31
|
+
if (!legacy) {
|
|
32
|
+
logger.logger.debug('[migrateClientSessionKey] No legacy session key found in storage, skipping migration');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const { keychain } = core.getCore(client$1);
|
|
36
|
+
logger.logger.debug('[migrateClientSessionKey] Found legacy session key, importing into keychain', { expectedPublicKey: legacy.publicKey });
|
|
37
|
+
const importedPublicKey = yield keychain.importKey('session', legacy.privateKeyJwk);
|
|
38
|
+
logger.logger.debug('[migrateClientSessionKey] Key imported into IndexedDB', {
|
|
39
|
+
expectedPublicKey: legacy.publicKey,
|
|
40
|
+
importedPublicKey,
|
|
41
|
+
});
|
|
42
|
+
core.getCore(client$1).state.set({ sessionKeys: importedPublicKey });
|
|
43
|
+
getClientSessionKeys.clearClientSessionKeys();
|
|
44
|
+
logger.logger.debug('[migrateClientSessionKey] Migration complete, legacy entry removed from storage');
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
logger.logger.debug('[migrateClientSessionKey] Migration failed, ignoring:', error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.migrateClientSessionKey = migrateClientSessionKey;
|
package/src/lib/client/extension/functions/migrateClientSessionKey/migrateClientSessionKey.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const migrateClientSessionKey: () => Promise<void>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { getDefaultClient, waitForClientInitialized } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { getCore } from '@dynamic-labs-sdk/client/core';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import 'react';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import { logger } from '../../../../shared/logger.js';
|
|
11
|
+
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../utils/constants/colors.js';
|
|
14
|
+
import '../../../../utils/constants/values.js';
|
|
15
|
+
import '@dynamic-labs/sdk-api-core';
|
|
16
|
+
import '../../../../shared/consts/index.js';
|
|
17
|
+
import { getClientSessionKeys, clearClientSessionKeys } from '../../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
18
|
+
|
|
19
|
+
const migrateClientSessionKey = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
// Wait for the SDK to finish initializing (including its own migration phase)
|
|
22
|
+
// before overwriting the keychain — react-SDK keys always take precedence.
|
|
23
|
+
const client = getDefaultClient();
|
|
24
|
+
yield waitForClientInitialized(client);
|
|
25
|
+
logger.debug('[migrateClientSessionKey] Checking for legacy session key in storage');
|
|
26
|
+
const legacy = getClientSessionKeys();
|
|
27
|
+
if (!legacy) {
|
|
28
|
+
logger.debug('[migrateClientSessionKey] No legacy session key found in storage, skipping migration');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const { keychain } = getCore(client);
|
|
32
|
+
logger.debug('[migrateClientSessionKey] Found legacy session key, importing into keychain', { expectedPublicKey: legacy.publicKey });
|
|
33
|
+
const importedPublicKey = yield keychain.importKey('session', legacy.privateKeyJwk);
|
|
34
|
+
logger.debug('[migrateClientSessionKey] Key imported into IndexedDB', {
|
|
35
|
+
expectedPublicKey: legacy.publicKey,
|
|
36
|
+
importedPublicKey,
|
|
37
|
+
});
|
|
38
|
+
getCore(client).state.set({ sessionKeys: importedPublicKey });
|
|
39
|
+
clearClientSessionKeys();
|
|
40
|
+
logger.debug('[migrateClientSessionKey] Migration complete, legacy entry removed from storage');
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.debug('[migrateClientSessionKey] Migration failed, ignoring:', error);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { migrateClientSessionKey };
|
package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.cjs
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
6
8
|
var version = require('../../../../../../version.cjs');
|
|
7
9
|
var isGlobalWalletPopup = require('../../../../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.cjs');
|
|
8
10
|
require('@dynamic-labs/sdk-api-core');
|
|
@@ -23,16 +25,13 @@ require('../../../../../utils/constants/colors.cjs');
|
|
|
23
25
|
require('../../../../../shared/consts/index.cjs');
|
|
24
26
|
require('../../../../../store/state/nonce/nonce.cjs');
|
|
25
27
|
var randomString = require('../../../../../utils/functions/randomString/randomString.cjs');
|
|
26
|
-
require('@dynamic-labs-sdk/client/core');
|
|
27
28
|
require('../../../../client.cjs');
|
|
28
|
-
require('@dynamic-labs-sdk/client');
|
|
29
29
|
require('../../../../../config/ApiEndpoint.cjs');
|
|
30
30
|
require('../../../../../events/dynamicEvents.cjs');
|
|
31
31
|
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('../../../../../utils/functions/clientSessionKeys/getClientSessionKeys.cjs');
|
|
36
35
|
require('../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
37
36
|
|
|
38
37
|
const getApiHeaders = () => {
|
|
@@ -43,9 +42,9 @@ const getApiHeaders = () => {
|
|
|
43
42
|
if (deviceFingerprint) {
|
|
44
43
|
apiHeaders['x-dyn-device-fingerprint'] = deviceFingerprint;
|
|
45
44
|
}
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
apiHeaders['x-dyn-session-public-key'] =
|
|
45
|
+
const sessionKeys = core.getSessionKeys(client.getDefaultClient());
|
|
46
|
+
if (sessionKeys === null || sessionKeys === void 0 ? void 0 : sessionKeys.publicKey) {
|
|
47
|
+
apiHeaders['x-dyn-session-public-key'] = sessionKeys.publicKey;
|
|
49
48
|
}
|
|
50
49
|
apiHeaders['x-dyn-version'] = `WalletKit/${version.VERSION}`;
|
|
51
50
|
apiHeaders['x-dyn-api-version'] = `API/${version.API_VERSION}`;
|
package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
3
|
+
import { getSessionKeys } from '@dynamic-labs-sdk/client/core';
|
|
2
4
|
import { VERSION, API_VERSION } from '../../../../../../version.js';
|
|
3
5
|
import { isGlobalWalletPopup } from '../../../../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.js';
|
|
4
6
|
import '@dynamic-labs/sdk-api-core';
|
|
@@ -19,16 +21,13 @@ import '../../../../../utils/constants/colors.js';
|
|
|
19
21
|
import '../../../../../shared/consts/index.js';
|
|
20
22
|
import '../../../../../store/state/nonce/nonce.js';
|
|
21
23
|
import { randomString } from '../../../../../utils/functions/randomString/randomString.js';
|
|
22
|
-
import '@dynamic-labs-sdk/client/core';
|
|
23
24
|
import '../../../../client.js';
|
|
24
|
-
import '@dynamic-labs-sdk/client';
|
|
25
25
|
import '../../../../../config/ApiEndpoint.js';
|
|
26
26
|
import '../../../../../events/dynamicEvents.js';
|
|
27
27
|
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 { getClientSessionPublicKey } from '../../../../../utils/functions/clientSessionKeys/getClientSessionKeys.js';
|
|
32
31
|
import '../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
33
32
|
|
|
34
33
|
const getApiHeaders = () => {
|
|
@@ -39,9 +38,9 @@ const getApiHeaders = () => {
|
|
|
39
38
|
if (deviceFingerprint) {
|
|
40
39
|
apiHeaders['x-dyn-device-fingerprint'] = deviceFingerprint;
|
|
41
40
|
}
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
apiHeaders['x-dyn-session-public-key'] =
|
|
41
|
+
const sessionKeys = getSessionKeys(getDefaultClient());
|
|
42
|
+
if (sessionKeys === null || sessionKeys === void 0 ? void 0 : sessionKeys.publicKey) {
|
|
43
|
+
apiHeaders['x-dyn-session-public-key'] = sessionKeys.publicKey;
|
|
45
44
|
}
|
|
46
45
|
apiHeaders['x-dyn-version'] = `WalletKit/${VERSION}`;
|
|
47
46
|
apiHeaders['x-dyn-api-version'] = `API/${API_VERSION}`;
|
|
@@ -20,6 +20,7 @@ require('../../../../utils/constants/colors.cjs');
|
|
|
20
20
|
require('../../../../utils/constants/values.cjs');
|
|
21
21
|
require('@dynamic-labs/sdk-api-core');
|
|
22
22
|
require('../../../../shared/consts/index.cjs');
|
|
23
|
+
var migrateClientSessionKey = require('../../functions/migrateClientSessionKey/migrateClientSessionKey.cjs');
|
|
23
24
|
var getApiHeaders = require('./getApiHeaders/getApiHeaders.cjs');
|
|
24
25
|
var syncEvents = require('./syncEvents/syncEvents.cjs');
|
|
25
26
|
|
|
@@ -69,6 +70,7 @@ const useInitializeSdkClient = ({ settings, client: clientFromProps }, key) => {
|
|
|
69
70
|
logLevel: settings.logLevel === 'DEBUG' ? 'debug' : undefined,
|
|
70
71
|
});
|
|
71
72
|
setClient(client$2);
|
|
73
|
+
void migrateClientSessionKey.migrateClientSessionKey();
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
exports.useInitializeSdkClient = useInitializeSdkClient;
|
|
@@ -16,6 +16,7 @@ import '../../../../utils/constants/colors.js';
|
|
|
16
16
|
import '../../../../utils/constants/values.js';
|
|
17
17
|
import '@dynamic-labs/sdk-api-core';
|
|
18
18
|
import '../../../../shared/consts/index.js';
|
|
19
|
+
import { migrateClientSessionKey } from '../../functions/migrateClientSessionKey/migrateClientSessionKey.js';
|
|
19
20
|
import { getApiHeaders } from './getApiHeaders/getApiHeaders.js';
|
|
20
21
|
import { syncEvents } from './syncEvents/syncEvents.js';
|
|
21
22
|
|
|
@@ -65,6 +66,7 @@ const useInitializeSdkClient = ({ settings, client: clientFromProps }, key) => {
|
|
|
65
66
|
logLevel: settings.logLevel === 'DEBUG' ? 'debug' : undefined,
|
|
66
67
|
});
|
|
67
68
|
setClient(client);
|
|
69
|
+
void migrateClientSessionKey();
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
export { useInitializeSdkClient };
|
|
@@ -16,6 +16,10 @@ export { getSignInCredentialIdFromMinToken } from './functions/getSignInCredenti
|
|
|
16
16
|
export { getAuthToken } from './functions/getAuthToken';
|
|
17
17
|
export { getExpiresAt } from './functions/getExpiresAt';
|
|
18
18
|
export { hasElevatedAccessToken } from './functions/hasElevatedAccessToken';
|
|
19
|
+
export { generateChainingSignature } from './functions/generateChainingSignature/generateChainingSignature';
|
|
20
|
+
export { generateSessionKeys } from './functions/generateSessionKeys/generateSessionKeys';
|
|
21
|
+
export { getSessionKeys } from './functions/getSessionKeys/getSessionKeys';
|
|
22
|
+
export { getClientSessionNonceHeaders } from './functions/getClientSessionNonceHeaders/getClientSessionNonceHeaders';
|
|
19
23
|
export { useInitStatus } from './initStatus/useInitStatus';
|
|
20
24
|
export { setUnverifiedWalletAccounts } from './unverifiedWalletAccounts/setUnverifiedWalletAccounts';
|
|
21
25
|
export { createDeviceSignatureHeadersMiddleware } from './functions/createDeviceSignatureHeadersMiddleware';
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var iconic = require('@dynamic-labs/iconic');
|
|
10
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
11
|
require('../../../Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
12
|
require('react-i18next');
|
|
11
13
|
var add = require('../../../../shared/assets/add.cjs');
|
|
12
14
|
var unlink = require('../../../../shared/assets/unlink.cjs');
|
|
13
15
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
15
16
|
require('@dynamic-labs/utils');
|
|
16
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
17
18
|
require('../../../../shared/logger.cjs');
|
|
@@ -19,7 +20,6 @@ require('@dynamic-labs/wallet-book');
|
|
|
19
20
|
require('../../../../utils/constants/colors.cjs');
|
|
20
21
|
require('../../../../utils/constants/values.cjs');
|
|
21
22
|
var providerLabel = require('../../../../shared/utils/functions/providerLabel/providerLabel.cjs');
|
|
22
|
-
require('@dynamic-labs/sdk-api-core');
|
|
23
23
|
require('../../../../shared/consts/index.cjs');
|
|
24
24
|
require('../../../Alert/Alert.cjs');
|
|
25
25
|
require('../../../../events/dynamicEvents.cjs');
|
|
@@ -73,8 +73,8 @@ require('react-focus-lock');
|
|
|
73
73
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
74
74
|
var Icon = require('../../../Icon/Icon.cjs');
|
|
75
75
|
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
76
|
+
var useStepUpAuthentication = require('../../../../utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs');
|
|
76
77
|
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
77
|
-
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
78
78
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
79
79
|
require('../../../IconButton/IconButton.cjs');
|
|
80
80
|
var TypographyButton = require('../../../TypographyButton/TypographyButton.cjs');
|
|
@@ -90,6 +90,7 @@ require('../../../../views/TransactionConfirmationView/TransactionConfirmationVi
|
|
|
90
90
|
require('../../../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
91
91
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
92
92
|
require('../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
93
|
+
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
93
94
|
require('../../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
94
95
|
require('../../../../utils/hooks/useWalletBackup/types.cjs');
|
|
95
96
|
require('../../../../utils/hooks/useWalletBackup/cloudProviders.cjs');
|
|
@@ -121,20 +122,48 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
121
122
|
var _a;
|
|
122
123
|
const { user, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
123
124
|
const { linkSocialAccount, unlinkSocialAccount, isProcessing, isLinked, getLinkedAccountInformation, } = useSocialAccounts.useSocialAccounts();
|
|
125
|
+
const { isStepUpRequired, promptStepUpAuth } = useStepUpAuthentication.useStepUpAuthentication();
|
|
124
126
|
const isProviderLinked = isLinked(provider);
|
|
125
127
|
const connectedAccountInfo = getLinkedAccountInformation(provider);
|
|
126
128
|
const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
|
|
127
129
|
const isActiveCredential = !primaryWallet &&
|
|
128
130
|
connectedAccountInfo &&
|
|
129
131
|
(connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.id) === (user === null || user === void 0 ? void 0 : user.lastVerifiedCredentialId);
|
|
130
|
-
const handleSocialAccountButton = React.useCallback(() => {
|
|
132
|
+
const handleSocialAccountButton = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
131
133
|
if (isProviderLinked) {
|
|
134
|
+
if (isStepUpRequired({ scope: sdkApiCore.TokenScope.Credentialunlink })) {
|
|
135
|
+
try {
|
|
136
|
+
yield promptStepUpAuth({
|
|
137
|
+
requestedScopes: [sdkApiCore.TokenScope.Credentialunlink],
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (_b) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
132
144
|
unlinkSocialAccount(provider);
|
|
133
145
|
}
|
|
134
146
|
else {
|
|
147
|
+
if (isStepUpRequired({ scope: sdkApiCore.TokenScope.Credentiallink })) {
|
|
148
|
+
try {
|
|
149
|
+
yield promptStepUpAuth({
|
|
150
|
+
requestedScopes: [sdkApiCore.TokenScope.Credentiallink],
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (_c) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
135
157
|
linkSocialAccount(provider, { showWidgetAfterConnection: true });
|
|
136
158
|
}
|
|
137
|
-
}, [
|
|
159
|
+
}), [
|
|
160
|
+
isProviderLinked,
|
|
161
|
+
isStepUpRequired,
|
|
162
|
+
promptStepUpAuth,
|
|
163
|
+
linkSocialAccount,
|
|
164
|
+
provider,
|
|
165
|
+
unlinkSocialAccount,
|
|
166
|
+
]);
|
|
138
167
|
const renderButton = () => (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'user-profile-social-account__button', buttonVariant: 'secondary', buttonPadding: 'none', onClick: handleSocialAccountButton, loading: isProcessing, dataTestId: `social-account-${isProviderLinked ? 'disconnect' : 'connect'}-button`, typographyProps: {
|
|
139
168
|
color: 'secondary',
|
|
140
169
|
variant: 'button_tertiary',
|