@volr/react 0.1.67 → 0.1.68
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 +243 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +237 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -823,4 +823,83 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
823
823
|
analysis: string[];
|
|
824
824
|
}>;
|
|
825
825
|
|
|
826
|
-
|
|
826
|
+
/**
|
|
827
|
+
* Passkey-specific error classes
|
|
828
|
+
*/
|
|
829
|
+
/**
|
|
830
|
+
* Error thrown when user cancels the passkey prompt
|
|
831
|
+
* This error should NOT trigger a retry
|
|
832
|
+
*/
|
|
833
|
+
declare class UserCancelledError extends Error {
|
|
834
|
+
readonly code = "USER_CANCELLED";
|
|
835
|
+
readonly isUserCancelled = true;
|
|
836
|
+
constructor(message?: string);
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Error thrown when passkey is not found
|
|
840
|
+
*/
|
|
841
|
+
declare class PasskeyNotFoundError extends Error {
|
|
842
|
+
readonly code = "PASSKEY_NOT_FOUND";
|
|
843
|
+
constructor(message?: string);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Error thrown when PRF extension is not supported
|
|
847
|
+
*/
|
|
848
|
+
declare class PrfNotSupportedError extends Error {
|
|
849
|
+
readonly code = "PRF_NOT_SUPPORTED";
|
|
850
|
+
constructor(message?: string);
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Check if an error is a user cancellation (should not retry)
|
|
854
|
+
*/
|
|
855
|
+
declare function isUserCancelledError(error: unknown): boolean;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Platform compatibility check utilities
|
|
859
|
+
* Detects PRF extension support and provides guidance for cross-device authentication
|
|
860
|
+
*/
|
|
861
|
+
interface PlatformCheckResult {
|
|
862
|
+
/** Whether the current browser supports WebAuthn PRF extension */
|
|
863
|
+
prfSupported: boolean;
|
|
864
|
+
/** Whether cross-device authentication is available (QR code scanning) */
|
|
865
|
+
crossDeviceAvailable: boolean;
|
|
866
|
+
/** Human-readable message for users */
|
|
867
|
+
message?: string;
|
|
868
|
+
/** Platform name */
|
|
869
|
+
platform: string;
|
|
870
|
+
/** Browser name */
|
|
871
|
+
browser: string;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Check if the current browser/platform supports WebAuthn PRF extension
|
|
875
|
+
*
|
|
876
|
+
* PRF support matrix (as of 2024):
|
|
877
|
+
* - Chrome 109+: Supported on macOS, Windows, ChromeOS, Android
|
|
878
|
+
* - Safari 17.4+: Supported on macOS, iOS
|
|
879
|
+
* - Firefox 135+: Partial support
|
|
880
|
+
* - Edge: Follows Chrome
|
|
881
|
+
*
|
|
882
|
+
* Known issues:
|
|
883
|
+
* - iOS 17.0-18.3: PRF sync issues (recommended to use iOS 18.4+)
|
|
884
|
+
* - Windows Hello: May not support PRF (uses platform authenticator without hmac-secret)
|
|
885
|
+
* - Firefox Android: Not supported
|
|
886
|
+
*/
|
|
887
|
+
declare function checkPrfSupport(): PlatformCheckResult;
|
|
888
|
+
/**
|
|
889
|
+
* Get a user-friendly message for passkey authentication guidance
|
|
890
|
+
*
|
|
891
|
+
* @param passkeyPlatform - The platform where the passkey was originally registered
|
|
892
|
+
* @returns User-friendly guidance message
|
|
893
|
+
*/
|
|
894
|
+
declare function getPasskeyAuthGuidance(passkeyPlatform?: string | null): string;
|
|
895
|
+
/**
|
|
896
|
+
* Check if the browser supports the WebAuthn PRF extension
|
|
897
|
+
* This is a runtime check that attempts to detect actual PRF support
|
|
898
|
+
*
|
|
899
|
+
* Note: This function doesn't guarantee PRF will work - it only checks
|
|
900
|
+
* if the browser API supports the extension. The authenticator itself
|
|
901
|
+
* must also support the hmac-secret extension.
|
|
902
|
+
*/
|
|
903
|
+
declare function checkPrfExtensionAvailable(): Promise<boolean>;
|
|
904
|
+
|
|
905
|
+
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PlatformCheckResult, type PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, 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, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getWalletState, isEIP7702Delegated, isUserCancelledError, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
package/dist/index.d.ts
CHANGED
|
@@ -823,4 +823,83 @@ declare function debugTransactionFailure(publicClient: PublicClient, failingWall
|
|
|
823
823
|
analysis: string[];
|
|
824
824
|
}>;
|
|
825
825
|
|
|
826
|
-
|
|
826
|
+
/**
|
|
827
|
+
* Passkey-specific error classes
|
|
828
|
+
*/
|
|
829
|
+
/**
|
|
830
|
+
* Error thrown when user cancels the passkey prompt
|
|
831
|
+
* This error should NOT trigger a retry
|
|
832
|
+
*/
|
|
833
|
+
declare class UserCancelledError extends Error {
|
|
834
|
+
readonly code = "USER_CANCELLED";
|
|
835
|
+
readonly isUserCancelled = true;
|
|
836
|
+
constructor(message?: string);
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Error thrown when passkey is not found
|
|
840
|
+
*/
|
|
841
|
+
declare class PasskeyNotFoundError extends Error {
|
|
842
|
+
readonly code = "PASSKEY_NOT_FOUND";
|
|
843
|
+
constructor(message?: string);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Error thrown when PRF extension is not supported
|
|
847
|
+
*/
|
|
848
|
+
declare class PrfNotSupportedError extends Error {
|
|
849
|
+
readonly code = "PRF_NOT_SUPPORTED";
|
|
850
|
+
constructor(message?: string);
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Check if an error is a user cancellation (should not retry)
|
|
854
|
+
*/
|
|
855
|
+
declare function isUserCancelledError(error: unknown): boolean;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Platform compatibility check utilities
|
|
859
|
+
* Detects PRF extension support and provides guidance for cross-device authentication
|
|
860
|
+
*/
|
|
861
|
+
interface PlatformCheckResult {
|
|
862
|
+
/** Whether the current browser supports WebAuthn PRF extension */
|
|
863
|
+
prfSupported: boolean;
|
|
864
|
+
/** Whether cross-device authentication is available (QR code scanning) */
|
|
865
|
+
crossDeviceAvailable: boolean;
|
|
866
|
+
/** Human-readable message for users */
|
|
867
|
+
message?: string;
|
|
868
|
+
/** Platform name */
|
|
869
|
+
platform: string;
|
|
870
|
+
/** Browser name */
|
|
871
|
+
browser: string;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Check if the current browser/platform supports WebAuthn PRF extension
|
|
875
|
+
*
|
|
876
|
+
* PRF support matrix (as of 2024):
|
|
877
|
+
* - Chrome 109+: Supported on macOS, Windows, ChromeOS, Android
|
|
878
|
+
* - Safari 17.4+: Supported on macOS, iOS
|
|
879
|
+
* - Firefox 135+: Partial support
|
|
880
|
+
* - Edge: Follows Chrome
|
|
881
|
+
*
|
|
882
|
+
* Known issues:
|
|
883
|
+
* - iOS 17.0-18.3: PRF sync issues (recommended to use iOS 18.4+)
|
|
884
|
+
* - Windows Hello: May not support PRF (uses platform authenticator without hmac-secret)
|
|
885
|
+
* - Firefox Android: Not supported
|
|
886
|
+
*/
|
|
887
|
+
declare function checkPrfSupport(): PlatformCheckResult;
|
|
888
|
+
/**
|
|
889
|
+
* Get a user-friendly message for passkey authentication guidance
|
|
890
|
+
*
|
|
891
|
+
* @param passkeyPlatform - The platform where the passkey was originally registered
|
|
892
|
+
* @returns User-friendly guidance message
|
|
893
|
+
*/
|
|
894
|
+
declare function getPasskeyAuthGuidance(passkeyPlatform?: string | null): string;
|
|
895
|
+
/**
|
|
896
|
+
* Check if the browser supports the WebAuthn PRF extension
|
|
897
|
+
* This is a runtime check that attempts to detect actual PRF support
|
|
898
|
+
*
|
|
899
|
+
* Note: This function doesn't guarantee PRF will work - it only checks
|
|
900
|
+
* if the browser API supports the extension. The authenticator itself
|
|
901
|
+
* must also support the hmac-secret extension.
|
|
902
|
+
*/
|
|
903
|
+
declare function checkPrfExtensionAvailable(): Promise<boolean>;
|
|
904
|
+
|
|
905
|
+
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 MpcConnectionStep, type NetworkDto, type NetworkInfo, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PlatformCheckResult, type PrfInputDto, PrfNotSupportedError, type SendBatchOverloads, type SendTxOptions, type SignerType, 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, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getWalletState, isEIP7702Delegated, isUserCancelledError, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
package/dist/index.js
CHANGED
|
@@ -9478,6 +9478,52 @@ var PUBKEY_CRED_PARAMS = [
|
|
|
9478
9478
|
];
|
|
9479
9479
|
var ATTESTATION = "direct";
|
|
9480
9480
|
|
|
9481
|
+
// src/errors/passkey-errors.ts
|
|
9482
|
+
var UserCancelledError = class _UserCancelledError extends Error {
|
|
9483
|
+
constructor(message) {
|
|
9484
|
+
super(message || "User cancelled the passkey authentication");
|
|
9485
|
+
this.code = "USER_CANCELLED";
|
|
9486
|
+
this.isUserCancelled = true;
|
|
9487
|
+
this.name = "UserCancelledError";
|
|
9488
|
+
Object.setPrototypeOf(this, _UserCancelledError.prototype);
|
|
9489
|
+
}
|
|
9490
|
+
};
|
|
9491
|
+
var PasskeyNotFoundError = class _PasskeyNotFoundError extends Error {
|
|
9492
|
+
constructor(message) {
|
|
9493
|
+
super(message || "Passkey not found. Please re-enroll your passkey.");
|
|
9494
|
+
this.code = "PASSKEY_NOT_FOUND";
|
|
9495
|
+
this.name = "PasskeyNotFoundError";
|
|
9496
|
+
Object.setPrototypeOf(this, _PasskeyNotFoundError.prototype);
|
|
9497
|
+
}
|
|
9498
|
+
};
|
|
9499
|
+
var PrfNotSupportedError = class _PrfNotSupportedError extends Error {
|
|
9500
|
+
constructor(message) {
|
|
9501
|
+
super(
|
|
9502
|
+
message || "WebAuthn PRF extension is not supported by this browser or device. Please use a browser that supports WebAuthn PRF extension."
|
|
9503
|
+
);
|
|
9504
|
+
this.code = "PRF_NOT_SUPPORTED";
|
|
9505
|
+
this.name = "PrfNotSupportedError";
|
|
9506
|
+
Object.setPrototypeOf(this, _PrfNotSupportedError.prototype);
|
|
9507
|
+
}
|
|
9508
|
+
};
|
|
9509
|
+
function isUserCancelledError(error) {
|
|
9510
|
+
if (error instanceof UserCancelledError) {
|
|
9511
|
+
return true;
|
|
9512
|
+
}
|
|
9513
|
+
if (error instanceof Error) {
|
|
9514
|
+
if (error.name === "NotAllowedError") {
|
|
9515
|
+
return true;
|
|
9516
|
+
}
|
|
9517
|
+
if (error.isUserCancelled === true) {
|
|
9518
|
+
return true;
|
|
9519
|
+
}
|
|
9520
|
+
if (error.message.includes("cancelled") || error.message.includes("denied")) {
|
|
9521
|
+
return true;
|
|
9522
|
+
}
|
|
9523
|
+
}
|
|
9524
|
+
return false;
|
|
9525
|
+
}
|
|
9526
|
+
|
|
9481
9527
|
// src/adapters/passkey.ts
|
|
9482
9528
|
function createPasskeyAdapter(options = {}) {
|
|
9483
9529
|
const rpId = options.rpId || (typeof window !== "undefined" ? window.location.hostname : "localhost");
|
|
@@ -9606,16 +9652,18 @@ function createPasskeyAdapter(options = {}) {
|
|
|
9606
9652
|
console.error("[PasskeyAdapter] Error name:", error?.name);
|
|
9607
9653
|
console.error("[PasskeyAdapter] Error message:", error?.message);
|
|
9608
9654
|
if (error?.name === "NotAllowedError") {
|
|
9609
|
-
throw new
|
|
9610
|
-
"
|
|
9655
|
+
throw new UserCancelledError(
|
|
9656
|
+
"User cancelled the passkey prompt or authentication was denied."
|
|
9611
9657
|
);
|
|
9612
|
-
}
|
|
9613
|
-
|
|
9614
|
-
|
|
9658
|
+
}
|
|
9659
|
+
if (error?.name === "NotFoundError" || error?.name === "InvalidStateError") {
|
|
9660
|
+
throw new PasskeyNotFoundError(
|
|
9661
|
+
"No passkey found matching the provided credentialId. This may happen if the passkey was deleted or the credentialId is incorrect."
|
|
9615
9662
|
);
|
|
9616
|
-
}
|
|
9617
|
-
|
|
9618
|
-
|
|
9663
|
+
}
|
|
9664
|
+
if (error?.name === "NotSupportedError") {
|
|
9665
|
+
throw new PrfNotSupportedError(
|
|
9666
|
+
"WebAuthn PRF extension is not supported by this browser or device. Please use a browser that supports WebAuthn PRF extension (Chrome 108+, Edge 108+, Safari 16.4+)."
|
|
9619
9667
|
);
|
|
9620
9668
|
}
|
|
9621
9669
|
throw new Error(
|
|
@@ -18069,7 +18117,14 @@ async function resolveSigner(input) {
|
|
|
18069
18117
|
return { signer: explicitSigner, activeProvider: null };
|
|
18070
18118
|
}
|
|
18071
18119
|
if (provider) {
|
|
18072
|
-
|
|
18120
|
+
try {
|
|
18121
|
+
await provider.ensureSession({ interactive: true });
|
|
18122
|
+
} catch (error) {
|
|
18123
|
+
if (isUserCancelledError(error)) {
|
|
18124
|
+
throw error;
|
|
18125
|
+
}
|
|
18126
|
+
throw error;
|
|
18127
|
+
}
|
|
18073
18128
|
const signerContext = {
|
|
18074
18129
|
provider,
|
|
18075
18130
|
chainId,
|
|
@@ -18088,7 +18143,14 @@ async function resolveSigner(input) {
|
|
|
18088
18143
|
credentialId: user.credentialId
|
|
18089
18144
|
});
|
|
18090
18145
|
await setProvider(restoredProvider);
|
|
18091
|
-
|
|
18146
|
+
try {
|
|
18147
|
+
await restoredProvider.ensureSession({ interactive: true });
|
|
18148
|
+
} catch (error) {
|
|
18149
|
+
if (isUserCancelledError(error)) {
|
|
18150
|
+
throw error;
|
|
18151
|
+
}
|
|
18152
|
+
throw error;
|
|
18153
|
+
}
|
|
18092
18154
|
const signerContext = {
|
|
18093
18155
|
provider: restoredProvider,
|
|
18094
18156
|
chainId,
|
|
@@ -18893,6 +18955,16 @@ function detectPlatform() {
|
|
|
18893
18955
|
}
|
|
18894
18956
|
return "Unknown";
|
|
18895
18957
|
}
|
|
18958
|
+
function buildDisplayName(userEmail, userEvmAddress, userId) {
|
|
18959
|
+
if (userEmail) {
|
|
18960
|
+
return userEmail;
|
|
18961
|
+
}
|
|
18962
|
+
if (userEvmAddress) {
|
|
18963
|
+
const short = `${userEvmAddress.slice(0, 6)}...${userEvmAddress.slice(-4)}`;
|
|
18964
|
+
return `Volr (${short})`;
|
|
18965
|
+
}
|
|
18966
|
+
return userId || "Volr Wallet";
|
|
18967
|
+
}
|
|
18896
18968
|
async function enrollPasskey(params) {
|
|
18897
18969
|
const {
|
|
18898
18970
|
client,
|
|
@@ -18931,7 +19003,7 @@ async function enrollPasskey(params) {
|
|
|
18931
19003
|
credentialId: tempCredentialId
|
|
18932
19004
|
};
|
|
18933
19005
|
const prfSalt = deriveWrapKey(tempPrfInput);
|
|
18934
|
-
const displayName = userEmail
|
|
19006
|
+
const displayName = buildDisplayName(userEmail, userEvmAddress, userId);
|
|
18935
19007
|
const publicKeyCredentialCreationOptions = {
|
|
18936
19008
|
challenge: challenge2,
|
|
18937
19009
|
rp: {
|
|
@@ -19509,6 +19581,159 @@ async function debugTransactionFailure(publicClient, failingWallet, workingWalle
|
|
|
19509
19581
|
analysis
|
|
19510
19582
|
};
|
|
19511
19583
|
}
|
|
19584
|
+
|
|
19585
|
+
// src/utils/platform-check.ts
|
|
19586
|
+
function detectPlatform2() {
|
|
19587
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
19588
|
+
const ua = navigator.userAgent;
|
|
19589
|
+
const platform = navigator.platform || "";
|
|
19590
|
+
if (/iPhone|iPad|iPod/.test(ua) || platform === "MacIntel" && navigator.maxTouchPoints > 1) {
|
|
19591
|
+
return "iOS";
|
|
19592
|
+
}
|
|
19593
|
+
if (/Android/.test(ua)) {
|
|
19594
|
+
return "Android";
|
|
19595
|
+
}
|
|
19596
|
+
if (/Mac/.test(platform)) {
|
|
19597
|
+
return "macOS";
|
|
19598
|
+
}
|
|
19599
|
+
if (/Win/.test(platform)) {
|
|
19600
|
+
return "Windows";
|
|
19601
|
+
}
|
|
19602
|
+
if (/CrOS/.test(ua)) {
|
|
19603
|
+
return "ChromeOS";
|
|
19604
|
+
}
|
|
19605
|
+
if (/Linux/.test(platform)) {
|
|
19606
|
+
return "Linux";
|
|
19607
|
+
}
|
|
19608
|
+
return "Unknown";
|
|
19609
|
+
}
|
|
19610
|
+
function detectBrowser() {
|
|
19611
|
+
if (typeof navigator === "undefined") return "Unknown";
|
|
19612
|
+
const ua = navigator.userAgent;
|
|
19613
|
+
if (/Edg/.test(ua)) return "Edge";
|
|
19614
|
+
if (/Chrome/.test(ua) && !/Chromium/.test(ua)) return "Chrome";
|
|
19615
|
+
if (/Safari/.test(ua) && !/Chrome/.test(ua)) return "Safari";
|
|
19616
|
+
if (/Firefox/.test(ua)) return "Firefox";
|
|
19617
|
+
if (/Opera|OPR/.test(ua)) return "Opera";
|
|
19618
|
+
return "Unknown";
|
|
19619
|
+
}
|
|
19620
|
+
function checkPrfSupport() {
|
|
19621
|
+
const platform = detectPlatform2();
|
|
19622
|
+
const browser = detectBrowser();
|
|
19623
|
+
if (typeof navigator === "undefined" || !navigator.credentials) {
|
|
19624
|
+
return {
|
|
19625
|
+
prfSupported: false,
|
|
19626
|
+
crossDeviceAvailable: false,
|
|
19627
|
+
message: "WebAuthn is not supported in this environment.",
|
|
19628
|
+
platform,
|
|
19629
|
+
browser
|
|
19630
|
+
};
|
|
19631
|
+
}
|
|
19632
|
+
let prfSupported = false;
|
|
19633
|
+
let message;
|
|
19634
|
+
switch (platform) {
|
|
19635
|
+
case "iOS":
|
|
19636
|
+
if (browser === "Safari") {
|
|
19637
|
+
prfSupported = true;
|
|
19638
|
+
} else {
|
|
19639
|
+
prfSupported = true;
|
|
19640
|
+
}
|
|
19641
|
+
break;
|
|
19642
|
+
case "Android":
|
|
19643
|
+
if (browser === "Chrome" || browser === "Edge") {
|
|
19644
|
+
prfSupported = true;
|
|
19645
|
+
} else if (browser === "Firefox") {
|
|
19646
|
+
prfSupported = false;
|
|
19647
|
+
message = "Firefox on Android does not support passkey encryption. Please use Chrome.";
|
|
19648
|
+
} else {
|
|
19649
|
+
prfSupported = true;
|
|
19650
|
+
}
|
|
19651
|
+
break;
|
|
19652
|
+
case "macOS":
|
|
19653
|
+
if (browser === "Safari" || browser === "Chrome" || browser === "Edge") {
|
|
19654
|
+
prfSupported = true;
|
|
19655
|
+
} else if (browser === "Firefox") {
|
|
19656
|
+
prfSupported = false;
|
|
19657
|
+
message = "Firefox may not support passkey encryption. Please use Safari or Chrome.";
|
|
19658
|
+
} else {
|
|
19659
|
+
prfSupported = true;
|
|
19660
|
+
}
|
|
19661
|
+
break;
|
|
19662
|
+
case "Windows":
|
|
19663
|
+
if (browser === "Chrome" || browser === "Edge") {
|
|
19664
|
+
prfSupported = true;
|
|
19665
|
+
message = "If your device does not support passkey encryption, you can use your mobile device by scanning a QR code.";
|
|
19666
|
+
} else {
|
|
19667
|
+
prfSupported = false;
|
|
19668
|
+
message = "Please use Chrome or Edge for passkey encryption support.";
|
|
19669
|
+
}
|
|
19670
|
+
break;
|
|
19671
|
+
case "ChromeOS":
|
|
19672
|
+
prfSupported = true;
|
|
19673
|
+
break;
|
|
19674
|
+
case "Linux":
|
|
19675
|
+
if (browser === "Chrome" || browser === "Edge") {
|
|
19676
|
+
prfSupported = true;
|
|
19677
|
+
message = "If your device does not support passkey encryption, you can use your mobile device by scanning a QR code.";
|
|
19678
|
+
} else {
|
|
19679
|
+
prfSupported = false;
|
|
19680
|
+
message = "Please use Chrome for passkey encryption support.";
|
|
19681
|
+
}
|
|
19682
|
+
break;
|
|
19683
|
+
default:
|
|
19684
|
+
prfSupported = false;
|
|
19685
|
+
message = "Unknown platform. Passkey encryption may not be supported.";
|
|
19686
|
+
}
|
|
19687
|
+
const crossDeviceAvailable = true;
|
|
19688
|
+
return {
|
|
19689
|
+
prfSupported,
|
|
19690
|
+
crossDeviceAvailable,
|
|
19691
|
+
message,
|
|
19692
|
+
platform,
|
|
19693
|
+
browser
|
|
19694
|
+
};
|
|
19695
|
+
}
|
|
19696
|
+
function getPasskeyAuthGuidance(passkeyPlatform) {
|
|
19697
|
+
const { platform: currentPlatform, prfSupported } = checkPrfSupport();
|
|
19698
|
+
if (prfSupported && (!passkeyPlatform || passkeyPlatform === currentPlatform)) {
|
|
19699
|
+
return "";
|
|
19700
|
+
}
|
|
19701
|
+
if (passkeyPlatform && passkeyPlatform !== currentPlatform) {
|
|
19702
|
+
const platformDisplayName = getPlatformDisplayName(passkeyPlatform);
|
|
19703
|
+
return `Your passkey was registered on ${platformDisplayName}. You can use your ${platformDisplayName} device to authenticate by scanning a QR code.`;
|
|
19704
|
+
}
|
|
19705
|
+
if (!prfSupported) {
|
|
19706
|
+
return "This device may not support passkey encryption. You can use your mobile device by scanning a QR code.";
|
|
19707
|
+
}
|
|
19708
|
+
return "";
|
|
19709
|
+
}
|
|
19710
|
+
function getPlatformDisplayName(platform) {
|
|
19711
|
+
const displayNames = {
|
|
19712
|
+
iOS: "iPhone/iPad",
|
|
19713
|
+
Android: "Android",
|
|
19714
|
+
macOS: "Mac",
|
|
19715
|
+
Windows: "Windows PC",
|
|
19716
|
+
ChromeOS: "Chromebook",
|
|
19717
|
+
Linux: "Linux"
|
|
19718
|
+
};
|
|
19719
|
+
return displayNames[platform] || platform;
|
|
19720
|
+
}
|
|
19721
|
+
async function checkPrfExtensionAvailable() {
|
|
19722
|
+
if (typeof PublicKeyCredential === "undefined") {
|
|
19723
|
+
return false;
|
|
19724
|
+
}
|
|
19725
|
+
if ("getClientCapabilities" in PublicKeyCredential) {
|
|
19726
|
+
try {
|
|
19727
|
+
const capabilities = await PublicKeyCredential.getClientCapabilities();
|
|
19728
|
+
if (capabilities && typeof capabilities.extensions?.prf === "boolean") {
|
|
19729
|
+
return capabilities.extensions.prf;
|
|
19730
|
+
}
|
|
19731
|
+
} catch {
|
|
19732
|
+
}
|
|
19733
|
+
}
|
|
19734
|
+
const { prfSupported } = checkPrfSupport();
|
|
19735
|
+
return prfSupported;
|
|
19736
|
+
}
|
|
19512
19737
|
/*! Bundled license information:
|
|
19513
19738
|
|
|
19514
19739
|
@noble/hashes/esm/utils.js:
|
|
@@ -19523,6 +19748,6 @@ async function debugTransactionFailure(publicClient, failingWallet, workingWalle
|
|
|
19523
19748
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
19524
19749
|
*/
|
|
19525
19750
|
|
|
19526
|
-
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getWalletState, isEIP7702Delegated, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
|
19751
|
+
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, defaultIdempotencyKey, diagnoseTransactionFailure, getERC20Balance, getPasskeyAuthGuidance, getWalletState, isEIP7702Delegated, isUserCancelledError, normalizeHex, normalizeHexArray, uploadBlobViaPresign, useDepositListener, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin };
|
|
19527
19752
|
//# sourceMappingURL=index.js.map
|
|
19528
19753
|
//# sourceMappingURL=index.js.map
|