@volr/react 0.1.90 → 0.1.92
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 +259 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +144 -2
- package/dist/index.d.ts +144 -2
- package/dist/index.js +254 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -96,9 +96,11 @@ declare class APIClient {
|
|
|
96
96
|
/**
|
|
97
97
|
* PRF Input DTO
|
|
98
98
|
* Input parameters for WebAuthn PRF extension
|
|
99
|
+
*
|
|
100
|
+
* Note: origin is NOT included for cross-domain wallet support.
|
|
101
|
+
* WebAuthn's rpId binding provides domain security.
|
|
99
102
|
*/
|
|
100
103
|
interface PrfInputDto {
|
|
101
|
-
origin: string;
|
|
102
104
|
projectId: string;
|
|
103
105
|
credentialId: string;
|
|
104
106
|
salt?: Uint8Array;
|
|
@@ -109,6 +111,8 @@ interface PrfInputDto {
|
|
|
109
111
|
*/
|
|
110
112
|
interface UserDto {
|
|
111
113
|
id: string;
|
|
114
|
+
projectId: string;
|
|
115
|
+
projectName: string;
|
|
112
116
|
email: string;
|
|
113
117
|
accountId?: string;
|
|
114
118
|
evmAddress?: `0x${string}`;
|
|
@@ -198,6 +202,8 @@ interface DepositConfig {
|
|
|
198
202
|
*/
|
|
199
203
|
interface VolrUser {
|
|
200
204
|
id?: string;
|
|
205
|
+
projectId?: string;
|
|
206
|
+
projectName?: string;
|
|
201
207
|
email?: string;
|
|
202
208
|
accountId?: string;
|
|
203
209
|
evmAddress?: `0x${string}`;
|
|
@@ -999,4 +1005,140 @@ declare function getPasskeyAuthGuidance(passkeyPlatform?: string | null): string
|
|
|
999
1005
|
*/
|
|
1000
1006
|
declare function checkPrfExtensionAvailable(): Promise<boolean>;
|
|
1001
1007
|
|
|
1002
|
-
|
|
1008
|
+
/**
|
|
1009
|
+
* Passkey migration (headless)
|
|
1010
|
+
* Cross-domain wallet migration using postMessage
|
|
1011
|
+
*/
|
|
1012
|
+
|
|
1013
|
+
interface MigrationRequestParams {
|
|
1014
|
+
/** APIClient instance */
|
|
1015
|
+
client: APIClient;
|
|
1016
|
+
/** Target domain to migrate to */
|
|
1017
|
+
targetOrigin: string;
|
|
1018
|
+
}
|
|
1019
|
+
interface MigrationRequestResult {
|
|
1020
|
+
/** Migration token from backend */
|
|
1021
|
+
migrationToken: string;
|
|
1022
|
+
/** Target origin confirmed by backend */
|
|
1023
|
+
targetOrigin: string;
|
|
1024
|
+
/** Token expiration timestamp */
|
|
1025
|
+
expiresAt: number;
|
|
1026
|
+
}
|
|
1027
|
+
interface MigrationCompleteParams {
|
|
1028
|
+
/** APIClient instance */
|
|
1029
|
+
client: APIClient;
|
|
1030
|
+
/** Base URL for API calls */
|
|
1031
|
+
baseUrl: string;
|
|
1032
|
+
/** Project API key */
|
|
1033
|
+
apiKey: string;
|
|
1034
|
+
/** User ID */
|
|
1035
|
+
userId: string;
|
|
1036
|
+
/** Project ID */
|
|
1037
|
+
projectId: string;
|
|
1038
|
+
/** Migration token from source domain */
|
|
1039
|
+
migrationToken: string;
|
|
1040
|
+
/** Master seed from source domain (decrypted) */
|
|
1041
|
+
masterSeed: Uint8Array;
|
|
1042
|
+
/**
|
|
1043
|
+
* WebAuthn rpId for this domain
|
|
1044
|
+
* @default window.location.hostname
|
|
1045
|
+
*/
|
|
1046
|
+
rpId?: string;
|
|
1047
|
+
/** Relying Party Name */
|
|
1048
|
+
rpName?: string;
|
|
1049
|
+
/** User email (for WebAuthn displayName) */
|
|
1050
|
+
userEmail?: string | null;
|
|
1051
|
+
}
|
|
1052
|
+
interface MigrationCompleteResult {
|
|
1053
|
+
/** New credential ID */
|
|
1054
|
+
credentialId: string;
|
|
1055
|
+
/** New blob URL */
|
|
1056
|
+
blobUrl: string;
|
|
1057
|
+
/** rpId used for registration */
|
|
1058
|
+
rpId: string;
|
|
1059
|
+
}
|
|
1060
|
+
interface MigrationSeedRequest {
|
|
1061
|
+
type: 'VOLR_MIGRATION_SEED_REQUEST';
|
|
1062
|
+
migrationToken: string;
|
|
1063
|
+
}
|
|
1064
|
+
interface MigrationSeedResponse {
|
|
1065
|
+
type: 'VOLR_MIGRATION_SEED_RESPONSE';
|
|
1066
|
+
masterSeed: number[];
|
|
1067
|
+
userId: string;
|
|
1068
|
+
projectId: string;
|
|
1069
|
+
}
|
|
1070
|
+
interface MigrationError {
|
|
1071
|
+
type: 'VOLR_MIGRATION_ERROR';
|
|
1072
|
+
code: string;
|
|
1073
|
+
message: string;
|
|
1074
|
+
}
|
|
1075
|
+
type MigrationMessage = MigrationSeedRequest | MigrationSeedResponse | MigrationError;
|
|
1076
|
+
/**
|
|
1077
|
+
* Request migration token from backend
|
|
1078
|
+
* Called on the source domain to initiate migration
|
|
1079
|
+
*/
|
|
1080
|
+
declare function requestMigration(params: MigrationRequestParams): Promise<MigrationRequestResult>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Open target domain popup for migration
|
|
1083
|
+
* Called on the source domain after getting migration token
|
|
1084
|
+
*
|
|
1085
|
+
* @param targetOrigin - Target domain URL
|
|
1086
|
+
* @param migrationToken - Token from requestMigration
|
|
1087
|
+
* @param migrationPath - Path on target domain for migration (default: /wallet/migrate)
|
|
1088
|
+
* @returns Window reference to the popup
|
|
1089
|
+
*/
|
|
1090
|
+
declare function openMigrationPopup(targetOrigin: string, migrationToken: string, migrationPath?: string): Window | null;
|
|
1091
|
+
/**
|
|
1092
|
+
* Handle seed request from target domain
|
|
1093
|
+
* Called on source domain when popup requests the master seed
|
|
1094
|
+
*
|
|
1095
|
+
* @param masterSeed - Decrypted master seed
|
|
1096
|
+
* @param userId - User ID
|
|
1097
|
+
* @param projectId - Project ID
|
|
1098
|
+
* @param targetOrigin - Target origin (for postMessage security)
|
|
1099
|
+
* @param popup - Reference to the popup window
|
|
1100
|
+
*/
|
|
1101
|
+
declare function sendSeedToPopup(masterSeed: Uint8Array, userId: string, projectId: string, targetOrigin: string, popup: Window): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Listen for seed requests from target domain
|
|
1104
|
+
* Set up message listener on source domain
|
|
1105
|
+
*
|
|
1106
|
+
* @param allowedOrigins - List of allowed target origins
|
|
1107
|
+
* @param getMasterSeed - Callback to get decrypted master seed (may trigger WebAuthn)
|
|
1108
|
+
* @param getUserInfo - Callback to get user info
|
|
1109
|
+
* @returns Cleanup function to remove listener
|
|
1110
|
+
*/
|
|
1111
|
+
declare function listenForSeedRequests(allowedOrigins: string[], getMasterSeed: () => Promise<Uint8Array>, getUserInfo: () => {
|
|
1112
|
+
userId: string;
|
|
1113
|
+
projectId: string;
|
|
1114
|
+
}): () => void;
|
|
1115
|
+
/**
|
|
1116
|
+
* Request master seed from source domain
|
|
1117
|
+
* Called on target domain (in popup)
|
|
1118
|
+
*
|
|
1119
|
+
* @param sourceOrigin - Source domain origin
|
|
1120
|
+
* @param migrationToken - Migration token
|
|
1121
|
+
* @param timeout - Timeout in milliseconds (default: 60000)
|
|
1122
|
+
* @returns Master seed and user info from source domain
|
|
1123
|
+
*/
|
|
1124
|
+
declare function requestSeedFromOpener(sourceOrigin: string, migrationToken: string, timeout?: number): Promise<{
|
|
1125
|
+
masterSeed: Uint8Array;
|
|
1126
|
+
userId: string;
|
|
1127
|
+
projectId: string;
|
|
1128
|
+
}>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Complete migration on target domain
|
|
1131
|
+
* Creates new passkey, encrypts master seed, and registers with backend
|
|
1132
|
+
*/
|
|
1133
|
+
declare function completeMigration(params: MigrationCompleteParams): Promise<MigrationCompleteResult>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Get all user credentials from backend
|
|
1136
|
+
*/
|
|
1137
|
+
declare function getUserCredentials(client: APIClient): Promise<Array<{
|
|
1138
|
+
rpId: string;
|
|
1139
|
+
credentialId: string;
|
|
1140
|
+
platform: string | null;
|
|
1141
|
+
createdAt: string;
|
|
1142
|
+
}>>;
|
|
1143
|
+
|
|
1144
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmClient, 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 PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PlatformCheckResult, type PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,9 +96,11 @@ declare class APIClient {
|
|
|
96
96
|
/**
|
|
97
97
|
* PRF Input DTO
|
|
98
98
|
* Input parameters for WebAuthn PRF extension
|
|
99
|
+
*
|
|
100
|
+
* Note: origin is NOT included for cross-domain wallet support.
|
|
101
|
+
* WebAuthn's rpId binding provides domain security.
|
|
99
102
|
*/
|
|
100
103
|
interface PrfInputDto {
|
|
101
|
-
origin: string;
|
|
102
104
|
projectId: string;
|
|
103
105
|
credentialId: string;
|
|
104
106
|
salt?: Uint8Array;
|
|
@@ -109,6 +111,8 @@ interface PrfInputDto {
|
|
|
109
111
|
*/
|
|
110
112
|
interface UserDto {
|
|
111
113
|
id: string;
|
|
114
|
+
projectId: string;
|
|
115
|
+
projectName: string;
|
|
112
116
|
email: string;
|
|
113
117
|
accountId?: string;
|
|
114
118
|
evmAddress?: `0x${string}`;
|
|
@@ -198,6 +202,8 @@ interface DepositConfig {
|
|
|
198
202
|
*/
|
|
199
203
|
interface VolrUser {
|
|
200
204
|
id?: string;
|
|
205
|
+
projectId?: string;
|
|
206
|
+
projectName?: string;
|
|
201
207
|
email?: string;
|
|
202
208
|
accountId?: string;
|
|
203
209
|
evmAddress?: `0x${string}`;
|
|
@@ -999,4 +1005,140 @@ declare function getPasskeyAuthGuidance(passkeyPlatform?: string | null): string
|
|
|
999
1005
|
*/
|
|
1000
1006
|
declare function checkPrfExtensionAvailable(): Promise<boolean>;
|
|
1001
1007
|
|
|
1002
|
-
|
|
1008
|
+
/**
|
|
1009
|
+
* Passkey migration (headless)
|
|
1010
|
+
* Cross-domain wallet migration using postMessage
|
|
1011
|
+
*/
|
|
1012
|
+
|
|
1013
|
+
interface MigrationRequestParams {
|
|
1014
|
+
/** APIClient instance */
|
|
1015
|
+
client: APIClient;
|
|
1016
|
+
/** Target domain to migrate to */
|
|
1017
|
+
targetOrigin: string;
|
|
1018
|
+
}
|
|
1019
|
+
interface MigrationRequestResult {
|
|
1020
|
+
/** Migration token from backend */
|
|
1021
|
+
migrationToken: string;
|
|
1022
|
+
/** Target origin confirmed by backend */
|
|
1023
|
+
targetOrigin: string;
|
|
1024
|
+
/** Token expiration timestamp */
|
|
1025
|
+
expiresAt: number;
|
|
1026
|
+
}
|
|
1027
|
+
interface MigrationCompleteParams {
|
|
1028
|
+
/** APIClient instance */
|
|
1029
|
+
client: APIClient;
|
|
1030
|
+
/** Base URL for API calls */
|
|
1031
|
+
baseUrl: string;
|
|
1032
|
+
/** Project API key */
|
|
1033
|
+
apiKey: string;
|
|
1034
|
+
/** User ID */
|
|
1035
|
+
userId: string;
|
|
1036
|
+
/** Project ID */
|
|
1037
|
+
projectId: string;
|
|
1038
|
+
/** Migration token from source domain */
|
|
1039
|
+
migrationToken: string;
|
|
1040
|
+
/** Master seed from source domain (decrypted) */
|
|
1041
|
+
masterSeed: Uint8Array;
|
|
1042
|
+
/**
|
|
1043
|
+
* WebAuthn rpId for this domain
|
|
1044
|
+
* @default window.location.hostname
|
|
1045
|
+
*/
|
|
1046
|
+
rpId?: string;
|
|
1047
|
+
/** Relying Party Name */
|
|
1048
|
+
rpName?: string;
|
|
1049
|
+
/** User email (for WebAuthn displayName) */
|
|
1050
|
+
userEmail?: string | null;
|
|
1051
|
+
}
|
|
1052
|
+
interface MigrationCompleteResult {
|
|
1053
|
+
/** New credential ID */
|
|
1054
|
+
credentialId: string;
|
|
1055
|
+
/** New blob URL */
|
|
1056
|
+
blobUrl: string;
|
|
1057
|
+
/** rpId used for registration */
|
|
1058
|
+
rpId: string;
|
|
1059
|
+
}
|
|
1060
|
+
interface MigrationSeedRequest {
|
|
1061
|
+
type: 'VOLR_MIGRATION_SEED_REQUEST';
|
|
1062
|
+
migrationToken: string;
|
|
1063
|
+
}
|
|
1064
|
+
interface MigrationSeedResponse {
|
|
1065
|
+
type: 'VOLR_MIGRATION_SEED_RESPONSE';
|
|
1066
|
+
masterSeed: number[];
|
|
1067
|
+
userId: string;
|
|
1068
|
+
projectId: string;
|
|
1069
|
+
}
|
|
1070
|
+
interface MigrationError {
|
|
1071
|
+
type: 'VOLR_MIGRATION_ERROR';
|
|
1072
|
+
code: string;
|
|
1073
|
+
message: string;
|
|
1074
|
+
}
|
|
1075
|
+
type MigrationMessage = MigrationSeedRequest | MigrationSeedResponse | MigrationError;
|
|
1076
|
+
/**
|
|
1077
|
+
* Request migration token from backend
|
|
1078
|
+
* Called on the source domain to initiate migration
|
|
1079
|
+
*/
|
|
1080
|
+
declare function requestMigration(params: MigrationRequestParams): Promise<MigrationRequestResult>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Open target domain popup for migration
|
|
1083
|
+
* Called on the source domain after getting migration token
|
|
1084
|
+
*
|
|
1085
|
+
* @param targetOrigin - Target domain URL
|
|
1086
|
+
* @param migrationToken - Token from requestMigration
|
|
1087
|
+
* @param migrationPath - Path on target domain for migration (default: /wallet/migrate)
|
|
1088
|
+
* @returns Window reference to the popup
|
|
1089
|
+
*/
|
|
1090
|
+
declare function openMigrationPopup(targetOrigin: string, migrationToken: string, migrationPath?: string): Window | null;
|
|
1091
|
+
/**
|
|
1092
|
+
* Handle seed request from target domain
|
|
1093
|
+
* Called on source domain when popup requests the master seed
|
|
1094
|
+
*
|
|
1095
|
+
* @param masterSeed - Decrypted master seed
|
|
1096
|
+
* @param userId - User ID
|
|
1097
|
+
* @param projectId - Project ID
|
|
1098
|
+
* @param targetOrigin - Target origin (for postMessage security)
|
|
1099
|
+
* @param popup - Reference to the popup window
|
|
1100
|
+
*/
|
|
1101
|
+
declare function sendSeedToPopup(masterSeed: Uint8Array, userId: string, projectId: string, targetOrigin: string, popup: Window): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Listen for seed requests from target domain
|
|
1104
|
+
* Set up message listener on source domain
|
|
1105
|
+
*
|
|
1106
|
+
* @param allowedOrigins - List of allowed target origins
|
|
1107
|
+
* @param getMasterSeed - Callback to get decrypted master seed (may trigger WebAuthn)
|
|
1108
|
+
* @param getUserInfo - Callback to get user info
|
|
1109
|
+
* @returns Cleanup function to remove listener
|
|
1110
|
+
*/
|
|
1111
|
+
declare function listenForSeedRequests(allowedOrigins: string[], getMasterSeed: () => Promise<Uint8Array>, getUserInfo: () => {
|
|
1112
|
+
userId: string;
|
|
1113
|
+
projectId: string;
|
|
1114
|
+
}): () => void;
|
|
1115
|
+
/**
|
|
1116
|
+
* Request master seed from source domain
|
|
1117
|
+
* Called on target domain (in popup)
|
|
1118
|
+
*
|
|
1119
|
+
* @param sourceOrigin - Source domain origin
|
|
1120
|
+
* @param migrationToken - Migration token
|
|
1121
|
+
* @param timeout - Timeout in milliseconds (default: 60000)
|
|
1122
|
+
* @returns Master seed and user info from source domain
|
|
1123
|
+
*/
|
|
1124
|
+
declare function requestSeedFromOpener(sourceOrigin: string, migrationToken: string, timeout?: number): Promise<{
|
|
1125
|
+
masterSeed: Uint8Array;
|
|
1126
|
+
userId: string;
|
|
1127
|
+
projectId: string;
|
|
1128
|
+
}>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Complete migration on target domain
|
|
1131
|
+
* Creates new passkey, encrypts master seed, and registers with backend
|
|
1132
|
+
*/
|
|
1133
|
+
declare function completeMigration(params: MigrationCompleteParams): Promise<MigrationCompleteResult>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Get all user credentials from backend
|
|
1136
|
+
*/
|
|
1137
|
+
declare function getUserCredentials(client: APIClient): Promise<Array<{
|
|
1138
|
+
rpId: string;
|
|
1139
|
+
credentialId: string;
|
|
1140
|
+
platform: string | null;
|
|
1141
|
+
createdAt: string;
|
|
1142
|
+
}>>;
|
|
1143
|
+
|
|
1144
|
+
export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DepositAsset$1 as DepositAsset, type DepositConfig, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmClient, 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 PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PlatformCheckResult, type PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TransactionDto, type TransactionStatus, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletStateComparison, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getUserCredentials, getWalletState, isEIP7702Delegated, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|