@dynamic-labs-sdk/client 0.12.1 → 0.13.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/dist/{InvalidParamError-Dyhydv4X.esm.js → InvalidParamError-BZPD1J5U.esm.js} +3 -3
- package/dist/{InvalidParamError-Dyhydv4X.esm.js.map → InvalidParamError-BZPD1J5U.esm.js.map} +1 -1
- package/dist/{InvalidParamError-B83QXOQl.cjs.js → InvalidParamError-CH8qePiW.cjs.js} +4 -4
- package/dist/{InvalidParamError-B83QXOQl.cjs.js.map → InvalidParamError-CH8qePiW.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-C_XzpX9u.cjs.js → NotWaasWalletAccountError-Bb8-O3Q9.cjs.js} +3 -3
- package/dist/{NotWaasWalletAccountError-C_XzpX9u.cjs.js.map → NotWaasWalletAccountError-Bb8-O3Q9.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-By6DOi1X.esm.js → NotWaasWalletAccountError-kP6g-sx9.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-By6DOi1X.esm.js.map → NotWaasWalletAccountError-kP6g-sx9.esm.js.map} +1 -1
- package/dist/core.cjs.js +66 -5
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +65 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/exports/core.d.ts +4 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +1 -0
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BRin5Ty5.cjs.js → getNetworkProviderFromNetworkId-gEnLk01L.cjs.js} +66 -3
- package/dist/getNetworkProviderFromNetworkId-gEnLk01L.cjs.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-D2FjIIXH.esm.js → getNetworkProviderFromNetworkId-mlU2KYAn.esm.js} +55 -4
- package/dist/getNetworkProviderFromNetworkId-mlU2KYAn.esm.js.map +1 -0
- package/dist/{getSignedSessionId-BE84R-V_.esm.js → getSignedSessionId-B2kd9qrw.esm.js} +4 -4
- package/dist/{getSignedSessionId-BE84R-V_.esm.js.map → getSignedSessionId-B2kd9qrw.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DqowqxuJ.cjs.js → getSignedSessionId-BYF0o0nI.cjs.js} +9 -3
- package/dist/{getSignedSessionId-DqowqxuJ.cjs.js.map → getSignedSessionId-BYF0o0nI.cjs.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-CsHHUt3-.cjs.js → getVerifiedCredentialForWalletAccount-DZMPlNXZ.cjs.js} +3 -3
- package/dist/{getVerifiedCredentialForWalletAccount-CsHHUt3-.cjs.js.map → getVerifiedCredentialForWalletAccount-DZMPlNXZ.cjs.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-B5WBFgF2.esm.js → getVerifiedCredentialForWalletAccount-DupRN2qF.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-B5WBFgF2.esm.js.map → getVerifiedCredentialForWalletAccount-DupRN2qF.esm.js.map} +1 -1
- package/dist/index.cjs.js +8 -51
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BHmylnPq.esm.js → isMfaRequiredForAction-CBENhE_c.esm.js} +4 -4
- package/dist/isMfaRequiredForAction-CBENhE_c.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-BzWbWDdR.cjs.js → isMfaRequiredForAction-KnGLJETO.cjs.js} +4 -4
- package/dist/isMfaRequiredForAction-KnGLJETO.cjs.js.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/deviceSigningKeys.schema.d.ts +7 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/deviceSigningKeys.schema.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getDeviceSigner.d.ts +4 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getDeviceSigner.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateUserDeviceSigningKeys/getOrCreateUserDeviceSigningKeys.d.ts +9 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/getOrCreateUserDeviceSigningKeys/getOrCreateUserDeviceSigningKeys.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getDeviceSigner/index.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/setWaasWalletAccountPassword/index.d.ts +2 -0
- package/dist/modules/waas/setWaasWalletAccountPassword/index.d.ts.map +1 -0
- package/dist/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.d.ts +16 -0
- package/dist/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +4 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/bufferToHex/bufferToHex.d.ts +2 -2
- package/dist/utils/bufferToHex/bufferToHex.d.ts.map +1 -1
- package/dist/utils/getNonce/getNonce.d.ts +3 -0
- package/dist/utils/getNonce/getNonce.d.ts.map +1 -0
- package/dist/utils/getNonce/index.d.ts +2 -0
- package/dist/utils/getNonce/index.d.ts.map +1 -0
- package/dist/waas.cjs.js +22 -4
- package/dist/waas.cjs.js.map +1 -1
- package/dist/waas.esm.js +21 -4
- package/dist/waas.esm.js.map +1 -1
- package/dist/waasCore.cjs.js +14 -4
- package/dist/waasCore.cjs.js.map +1 -1
- package/dist/waasCore.esm.js +13 -3
- package/dist/waasCore.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/getNetworkProviderFromNetworkId-BRin5Ty5.cjs.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-D2FjIIXH.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-BHmylnPq.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-BzWbWDdR.cjs.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as version, D as BaseError, O as getCore, S as CLIENT_SDK_NAME, T as setDefaultClient, _ as getBuffer, a as DYNAMIC_ICONIC_SPRITE_URL, b as ValueMustBeDefinedError, c as CHAINS_INFO_MAP, d as MfaRateLimitedError, f as MfaInvalidOtpError, h as APIError, k as name, l as createApiClient, m as InvalidExternalAuthError, o as SDK_API_CORE_VERSION, p as LinkCredentialError, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as SandboxMaximumThresholdReachedError, v as isCookieEnabled, w as getDefaultClient, x as randomString, y as assertDefined } from "./InvalidParamError-
|
|
2
|
-
import { C as
|
|
3
|
-
import { D as onceEvent, E as onEvent, O as setCookie, S as splitWalletProviderKey, T as offEvent, _ as getWalletAccounts, b as formatWalletAccountId, c as getWalletProviders, d as DYNAMIC_AUTH_COOKIE_NAME, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, i as restoreUserSharesForAllWalletAccounts, l as checkAndRaiseWalletAccountsChangedEvent, n as getWalletProviderByKey, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as emitWalletAccountsChangedEvent, w as emitEvent, x as normalizeAddress } from "./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
import {
|
|
5
|
-
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
1
|
+
import { A as version, D as BaseError, O as getCore, S as CLIENT_SDK_NAME, T as setDefaultClient, _ as getBuffer, a as DYNAMIC_ICONIC_SPRITE_URL, b as ValueMustBeDefinedError, c as CHAINS_INFO_MAP, d as MfaRateLimitedError, f as MfaInvalidOtpError, h as APIError, k as name, l as createApiClient, m as InvalidExternalAuthError, o as SDK_API_CORE_VERSION, p as LinkCredentialError, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as SandboxMaximumThresholdReachedError, v as isCookieEnabled, w as getDefaultClient, x as randomString, y as assertDefined } from "./InvalidParamError-BZPD1J5U.esm.js";
|
|
2
|
+
import { A as createStorageKeySchema, C as createDeferredPromise, D as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, E as GENERATE_SESSION_KEYS_TRACKER_KEY, F as isEqualShallow, N as createLocalStorageAdapter, O as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, P as subscribeWithSelector, S as CannotTrackError, T as FETCH_PROJECT_SETTINGS_TRACKER_KEY, _ as WalletAlreadyLinkedToAnotherUserError, a as updateWalletProviderKeysForVerifiedCredentials, b as createCrossTabBroadcast, c as createSignInMessageStatement, d as setUnverifiedWalletAccounts, f as createVisit, g as isCaptchaRequired, h as consumeCaptchaToken, i as getNetworksData, j as createStorage, k as p256Keygen, l as formatSignInMessage, m as setCaptchaToken, o as verifyMessageSignatureOwnership, p as hasExtension, s as removeUnverifiedWalletAccount, t as getNetworkProviderFromNetworkId, u as getNonce, v as NoNetworkProvidersError, w as isServerSideRendering, y as createLogger } from "./getNetworkProviderFromNetworkId-mlU2KYAn.esm.js";
|
|
3
|
+
import { D as onceEvent, E as onEvent, O as setCookie, S as splitWalletProviderKey, T as offEvent, _ as getWalletAccounts, b as formatWalletAccountId, c as getWalletProviders, d as DYNAMIC_AUTH_COOKIE_NAME, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, i as restoreUserSharesForAllWalletAccounts, l as checkAndRaiseWalletAccountsChangedEvent, n as getWalletProviderByKey, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as emitWalletAccountsChangedEvent, w as emitEvent, x as normalizeAddress } from "./getVerifiedCredentialForWalletAccount-DupRN2qF.esm.js";
|
|
4
|
+
import { n as getMfaMethods, r as consumeMfaToken, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-CBENhE_c.esm.js";
|
|
5
|
+
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-kP6g-sx9.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AuthModeEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum, MFAAction, MfaBackupCodeAcknowledgement, ProviderEnum, WaasBackupOptionsEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
import * as z from "zod/mini";
|
|
@@ -117,47 +117,6 @@ const fetchProjectSettings = async (client = getDefaultClient()) => {
|
|
|
117
117
|
return projectSettings;
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/utils/base64UrlDecode/base64UrlDecode.ts
|
|
122
|
-
/**
|
|
123
|
-
* Takes a base64url-encoded string (e.g. "nMueRPiAm51YXEjRtka8S_8Ura3HaqbmqDqMJCZmvkM")
|
|
124
|
-
* and return the corresponding bytes, as an array buffer.
|
|
125
|
-
*/
|
|
126
|
-
const base64UrlDecode = (s) => {
|
|
127
|
-
s = s?.replace(/-/g, "+").replace(/_/g, "/") || "";
|
|
128
|
-
return Uint8Array.from(atob(s), (c) => c.charCodeAt(0));
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/utils/compressRawPublicKey/compressRawPublicKey.ts
|
|
133
|
-
/**
|
|
134
|
-
* Accepts a public key array buffer, and returns a buffer with the compressed version of the public key
|
|
135
|
-
*/
|
|
136
|
-
const compressRawPublicKey = (rawPublicKey) => {
|
|
137
|
-
const rawPublicKeyBytes = new Uint8Array(rawPublicKey);
|
|
138
|
-
const len = rawPublicKeyBytes.byteLength;
|
|
139
|
-
const compressedBytes = rawPublicKeyBytes.slice(0, 1 + len >>> 1);
|
|
140
|
-
compressedBytes[0] = 2 | rawPublicKeyBytes[len - 1] & 1;
|
|
141
|
-
return compressedBytes.buffer;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/utils/p256Keygen/p256Keygen.ts
|
|
146
|
-
const p256Keygen = async () => {
|
|
147
|
-
const p256Keypair = await crypto.subtle.generateKey({
|
|
148
|
-
name: "ECDSA",
|
|
149
|
-
namedCurve: "P-256"
|
|
150
|
-
}, true, ["sign", "verify"]);
|
|
151
|
-
const rawPublicKey = await crypto.subtle.exportKey("raw", p256Keypair.publicKey);
|
|
152
|
-
const privateKeyJwk = await crypto.subtle.exportKey("jwk", p256Keypair.privateKey);
|
|
153
|
-
const compressedPublicKeyBuffer = compressRawPublicKey(rawPublicKey);
|
|
154
|
-
return {
|
|
155
|
-
private: bufferToHex(base64UrlDecode(privateKeyJwk.d)),
|
|
156
|
-
privateJwk: privateKeyJwk,
|
|
157
|
-
public: bufferToHex(compressedPublicKeyBuffer)
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
|
|
161
120
|
//#endregion
|
|
162
121
|
//#region src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts
|
|
163
122
|
const generateSessionKeys = async (client) => {
|
|
@@ -1829,7 +1788,7 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
1829
1788
|
const isDeviceRegistrationRequired = (client = getDefaultClient()) => {
|
|
1830
1789
|
const user = client.user;
|
|
1831
1790
|
assertDefined(user, "User not logged in");
|
|
1832
|
-
return Boolean(user.scope?.includes("device:
|
|
1791
|
+
return Boolean(user.scope?.includes("device:register"));
|
|
1833
1792
|
};
|
|
1834
1793
|
|
|
1835
1794
|
//#endregion
|
|
@@ -4084,13 +4043,11 @@ const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
|
4084
4043
|
//#region src/modules/wallets/utils/getSignInMessage/getSignInMessage.ts
|
|
4085
4044
|
const getSignInMessage = async ({ walletAccount }, client) => {
|
|
4086
4045
|
const core = getCore(client);
|
|
4087
|
-
const apiClient = createApiClient({}, client);
|
|
4088
4046
|
const universalLink = core.metadata?.universalLink;
|
|
4089
4047
|
assertDefined(universalLink, "Universal link is not set");
|
|
4090
4048
|
const url = new URL(universalLink);
|
|
4091
4049
|
const domain = url.host;
|
|
4092
|
-
const
|
|
4093
|
-
assertDefined(nonce, "Failed to get nonce");
|
|
4050
|
+
const nonce = await getNonce(client);
|
|
4094
4051
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4095
4052
|
if (walletProvider.chain === "STARK")
|
|
4096
4053
|
/**
|