@volr/react 0.1.125 → 0.1.127
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/index.cjs +57 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +58 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort, PrfInput } from '@volr/sdk-core';
|
|
4
4
|
export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import { Address, Abi, PublicClient } from 'viem';
|
|
6
6
|
|
|
@@ -1421,6 +1421,34 @@ interface MigrationRequestResult {
|
|
|
1421
1421
|
/** Token expiration timestamp */
|
|
1422
1422
|
expiresAt: number;
|
|
1423
1423
|
}
|
|
1424
|
+
interface DecryptEntropyParams {
|
|
1425
|
+
/** APIClient instance */
|
|
1426
|
+
client: APIClient;
|
|
1427
|
+
/** User ID */
|
|
1428
|
+
userId: string;
|
|
1429
|
+
/** Blob URL (S3 key) */
|
|
1430
|
+
blobUrl: string;
|
|
1431
|
+
/** PRF input (projectId + credentialId) */
|
|
1432
|
+
prfInput: PrfInput;
|
|
1433
|
+
/** Credential ID (hex string) for allowCredentials */
|
|
1434
|
+
credentialId: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* WebAuthn rpId for the SOURCE domain
|
|
1437
|
+
* @default window.location.hostname
|
|
1438
|
+
*/
|
|
1439
|
+
rpId?: string;
|
|
1440
|
+
/** Relying Party Name (for UX) */
|
|
1441
|
+
rpName?: string;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Decrypt the stored blob (entropy) on the SOURCE domain using the existing passkey.
|
|
1445
|
+
* This is used for cross-domain migration: the plaintext entropy is re-encrypted
|
|
1446
|
+
* with a new passkey on the TARGET domain.
|
|
1447
|
+
*
|
|
1448
|
+
* Note: The Volr blob stores ENTROPY (not the derived seed). Keeping entropy stable
|
|
1449
|
+
* ensures the derived wallet address remains the same across domains.
|
|
1450
|
+
*/
|
|
1451
|
+
declare function decryptEntropyForMigration(params: DecryptEntropyParams): Promise<Uint8Array>;
|
|
1424
1452
|
interface MigrationCompleteParams {
|
|
1425
1453
|
/** APIClient instance */
|
|
1426
1454
|
client: APIClient;
|
|
@@ -1434,7 +1462,10 @@ interface MigrationCompleteParams {
|
|
|
1434
1462
|
projectId: string;
|
|
1435
1463
|
/** Migration token from source domain */
|
|
1436
1464
|
migrationToken: string;
|
|
1437
|
-
/**
|
|
1465
|
+
/**
|
|
1466
|
+
* Decrypted entropy from source domain.
|
|
1467
|
+
* (Name kept for backward compatibility; it is entropy, not a derived seed.)
|
|
1468
|
+
*/
|
|
1438
1469
|
masterSeed: Uint8Array;
|
|
1439
1470
|
/**
|
|
1440
1471
|
* WebAuthn rpId for this domain
|
|
@@ -1599,4 +1630,4 @@ declare function useEIP6963(): UseEIP6963Return;
|
|
|
1599
1630
|
*/
|
|
1600
1631
|
declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
|
|
1601
1632
|
|
|
1602
|
-
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
1633
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, TypedDataInput, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort, PrfInput } from '@volr/sdk-core';
|
|
4
4
|
export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import { Address, Abi, PublicClient } from 'viem';
|
|
6
6
|
|
|
@@ -1421,6 +1421,34 @@ interface MigrationRequestResult {
|
|
|
1421
1421
|
/** Token expiration timestamp */
|
|
1422
1422
|
expiresAt: number;
|
|
1423
1423
|
}
|
|
1424
|
+
interface DecryptEntropyParams {
|
|
1425
|
+
/** APIClient instance */
|
|
1426
|
+
client: APIClient;
|
|
1427
|
+
/** User ID */
|
|
1428
|
+
userId: string;
|
|
1429
|
+
/** Blob URL (S3 key) */
|
|
1430
|
+
blobUrl: string;
|
|
1431
|
+
/** PRF input (projectId + credentialId) */
|
|
1432
|
+
prfInput: PrfInput;
|
|
1433
|
+
/** Credential ID (hex string) for allowCredentials */
|
|
1434
|
+
credentialId: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* WebAuthn rpId for the SOURCE domain
|
|
1437
|
+
* @default window.location.hostname
|
|
1438
|
+
*/
|
|
1439
|
+
rpId?: string;
|
|
1440
|
+
/** Relying Party Name (for UX) */
|
|
1441
|
+
rpName?: string;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Decrypt the stored blob (entropy) on the SOURCE domain using the existing passkey.
|
|
1445
|
+
* This is used for cross-domain migration: the plaintext entropy is re-encrypted
|
|
1446
|
+
* with a new passkey on the TARGET domain.
|
|
1447
|
+
*
|
|
1448
|
+
* Note: The Volr blob stores ENTROPY (not the derived seed). Keeping entropy stable
|
|
1449
|
+
* ensures the derived wallet address remains the same across domains.
|
|
1450
|
+
*/
|
|
1451
|
+
declare function decryptEntropyForMigration(params: DecryptEntropyParams): Promise<Uint8Array>;
|
|
1424
1452
|
interface MigrationCompleteParams {
|
|
1425
1453
|
/** APIClient instance */
|
|
1426
1454
|
client: APIClient;
|
|
@@ -1434,7 +1462,10 @@ interface MigrationCompleteParams {
|
|
|
1434
1462
|
projectId: string;
|
|
1435
1463
|
/** Migration token from source domain */
|
|
1436
1464
|
migrationToken: string;
|
|
1437
|
-
/**
|
|
1465
|
+
/**
|
|
1466
|
+
* Decrypted entropy from source domain.
|
|
1467
|
+
* (Name kept for backward compatibility; it is entropy, not a derived seed.)
|
|
1468
|
+
*/
|
|
1438
1469
|
masterSeed: Uint8Array;
|
|
1439
1470
|
/**
|
|
1440
1471
|
* WebAuthn rpId for this domain
|
|
@@ -1599,4 +1630,4 @@ declare function useEIP6963(): UseEIP6963Return;
|
|
|
1599
1630
|
*/
|
|
1600
1631
|
declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
|
|
1601
1632
|
|
|
1602
|
-
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
1633
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OnSignRequest, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletStateComparison, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as nc from 'crypto';
|
|
2
2
|
import { createContext, useRef, useEffect, useMemo, useState, useCallback, useContext } from 'react';
|
|
3
|
-
import { createPasskeyProvider, createMpcProvider, deriveWrapKey, sealMasterSeed, signSession, getAuthNonce, signAuthorization, createMasterKeyProvider, deriveEvmKey, ZERO_HASH, selectSigner, VolrError } from '@volr/sdk-core';
|
|
3
|
+
import { createPasskeyProvider, createMpcProvider, deriveWrapKey, unsealMasterSeed, sealMasterSeed, signSession, getAuthNonce, signAuthorization, createMasterKeyProvider, deriveEvmKey, ZERO_HASH, selectSigner, VolrError } from '@volr/sdk-core';
|
|
4
4
|
export { createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -10029,6 +10029,19 @@ function useAutoRecover({
|
|
|
10029
10029
|
setAccessTokenState(client.getAccessToken());
|
|
10030
10030
|
setRefreshTokenState(client.getRefreshToken());
|
|
10031
10031
|
if (refreshedUser) {
|
|
10032
|
+
if (refreshedUser.keyStorageType === "passkey" && !refreshedUser.evmAddress) {
|
|
10033
|
+
console.error("[Provider] Invalid state: passkey user without evmAddress - clearing session");
|
|
10034
|
+
client.setAccessToken(null);
|
|
10035
|
+
client.setRefreshToken(null);
|
|
10036
|
+
setAccessTokenState(null);
|
|
10037
|
+
setRefreshTokenState(null);
|
|
10038
|
+
setUser(null);
|
|
10039
|
+
setProviderState(null);
|
|
10040
|
+
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
10041
|
+
safeStorage.removeItem(STORAGE_KEYS.provider);
|
|
10042
|
+
setIsLoading(false);
|
|
10043
|
+
return;
|
|
10044
|
+
}
|
|
10032
10045
|
setUser(refreshedUser);
|
|
10033
10046
|
if (!REQUIRE_USER_GESTURE_TO_RESTORE) ; else if (refreshedUser.keyStorageType === "passkey") {
|
|
10034
10047
|
console.log("[Provider] TTL=0 mode: Provider restoration deferred");
|
|
@@ -10040,12 +10053,20 @@ function useAutoRecover({
|
|
|
10040
10053
|
const userStr = safeStorage.getItem(STORAGE_KEYS.user);
|
|
10041
10054
|
if (userStr) {
|
|
10042
10055
|
try {
|
|
10043
|
-
|
|
10056
|
+
const storedUser = JSON.parse(userStr);
|
|
10057
|
+
if (storedUser.keyStorageType === "passkey" && !storedUser.evmAddress) {
|
|
10058
|
+
console.error("[Provider] Invalid stored user: passkey user without evmAddress - clearing");
|
|
10059
|
+
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
10060
|
+
safeStorage.removeItem(STORAGE_KEYS.provider);
|
|
10061
|
+
} else {
|
|
10062
|
+
setUser(storedUser);
|
|
10063
|
+
}
|
|
10044
10064
|
} catch {
|
|
10045
10065
|
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
10046
10066
|
}
|
|
10047
10067
|
}
|
|
10048
10068
|
}
|
|
10069
|
+
setIsLoading(false);
|
|
10049
10070
|
} catch {
|
|
10050
10071
|
client.setAccessToken(null);
|
|
10051
10072
|
client.setRefreshToken(null);
|
|
@@ -10055,7 +10076,6 @@ function useAutoRecover({
|
|
|
10055
10076
|
setProviderState(null);
|
|
10056
10077
|
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
10057
10078
|
safeStorage.removeItem(STORAGE_KEYS.provider);
|
|
10058
|
-
} finally {
|
|
10059
10079
|
setIsLoading(false);
|
|
10060
10080
|
}
|
|
10061
10081
|
};
|
|
@@ -20744,6 +20764,40 @@ function blobToBase642(blob) {
|
|
|
20744
20764
|
reader.readAsDataURL(blob);
|
|
20745
20765
|
});
|
|
20746
20766
|
}
|
|
20767
|
+
async function decryptEntropyForMigration(params) {
|
|
20768
|
+
const {
|
|
20769
|
+
client,
|
|
20770
|
+
userId,
|
|
20771
|
+
blobUrl,
|
|
20772
|
+
prfInput,
|
|
20773
|
+
credentialId,
|
|
20774
|
+
rpId = typeof window !== "undefined" ? window.location.hostname : "localhost",
|
|
20775
|
+
rpName = "Volr"
|
|
20776
|
+
} = params;
|
|
20777
|
+
const arrayBuffer = await client.postBinary("/blob/download", { key: blobUrl });
|
|
20778
|
+
const blobBytes = new Uint8Array(arrayBuffer);
|
|
20779
|
+
const nonceLength = 12;
|
|
20780
|
+
const cipherLength = blobBytes.length - nonceLength;
|
|
20781
|
+
if (cipherLength <= 0) {
|
|
20782
|
+
throw new Error("Invalid blob format: blob too small");
|
|
20783
|
+
}
|
|
20784
|
+
const cipher = blobBytes.slice(0, cipherLength);
|
|
20785
|
+
const nonce = blobBytes.slice(cipherLength);
|
|
20786
|
+
const keyStorageType = "passkey";
|
|
20787
|
+
const version5 = "v1";
|
|
20788
|
+
const aadBytes = new TextEncoder().encode(
|
|
20789
|
+
`volr/master-seed/v1|${userId}|${keyStorageType}|${version5}`
|
|
20790
|
+
);
|
|
20791
|
+
const prfSalt = deriveWrapKey(prfInput);
|
|
20792
|
+
const passkeyAdapter = createPasskeyAdapter({ rpId});
|
|
20793
|
+
const { prfOutput } = await passkeyAdapter.authenticate({
|
|
20794
|
+
salt: prfSalt,
|
|
20795
|
+
credentialId
|
|
20796
|
+
});
|
|
20797
|
+
const wrapKey = prfOutput;
|
|
20798
|
+
const entropy = await unsealMasterSeed(cipher, wrapKey, aadBytes, nonce);
|
|
20799
|
+
return entropy;
|
|
20800
|
+
}
|
|
20747
20801
|
async function requestMigration(params) {
|
|
20748
20802
|
const { client, targetOrigin } = params;
|
|
20749
20803
|
const response = await client.post("/wallet/migration/request", { targetOrigin });
|
|
@@ -21072,6 +21126,6 @@ function detectWalletConnector(provider, providerInfo) {
|
|
|
21072
21126
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
21073
21127
|
*/
|
|
21074
21128
|
|
|
21075
|
-
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
21129
|
+
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
21076
21130
|
//# sourceMappingURL=index.js.map
|
|
21077
21131
|
//# sourceMappingURL=index.js.map
|