w3pk 0.10.2 → 0.10.3
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.d.mts +124 -85
- package/dist/index.d.ts +124 -85
- package/dist/index.js +31 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -31
- package/dist/index.mjs.map +1 -1
- package/dist/zk/index.js +1 -1
- package/dist/zk/index.js.map +1 -1
- package/dist/zk/index.mjs.map +1 -1
- package/dist/zk/utils.js +3 -3
- package/dist/zk/utils.js.map +1 -1
- package/dist/zk/utils.mjs +3 -3
- package/dist/zk/utils.mjs.map +1 -1
- package/docs/API_REFERENCE.md +87 -18
- package/docs/ARCHITECTURE.md +14 -13
- package/docs/BROWSER_COMPATIBILITY.md +13 -0
- package/docs/INTEGRATION_GUIDELINES.md +36 -20
- package/docs/POST_QUANTUM.md +236 -1468
- package/docs/QUICK_START.md +4 -4
- package/docs/RECOVERY.md +35 -1
- package/docs/SECURITY.md +65 -58
- package/docs/notes/IFRAME_IMPLEMENTATION_PLAN.md +197 -0
- package/docs/notes/JULY_13_ROADMAP.md +29 -0
- package/docs/notes/NOTES.md +333 -0
- package/docs/notes/SIWE_IMPLEMENTATION.md +129 -0
- package/docs/notes/SYNCING_ACROSS_DEVICES.md +127 -0
- package/docs/notes/ethereum-post-quantum-roadmap.md +213 -0
- package/docs/notes/wulong-building-finding.md +109 -0
- package/package.json +3 -2
- package/dist/inspect/node.d.mts +0 -112
- package/dist/inspect/node.d.ts +0 -112
package/dist/index.d.mts
CHANGED
|
@@ -379,6 +379,23 @@ declare class ApiError extends Web3PasskeyError {
|
|
|
379
379
|
statusCode?: number | undefined;
|
|
380
380
|
constructor(message: string, statusCode?: number | undefined, originalError?: unknown);
|
|
381
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* The passkey authenticated, but this device has no credential metadata.
|
|
384
|
+
* The app should start a sync or restore flow.
|
|
385
|
+
*/
|
|
386
|
+
declare class SyncRequiredError extends Web3PasskeyError {
|
|
387
|
+
credentialId: string;
|
|
388
|
+
constructor(credentialId: string);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* The credential metadata is on this device, but the wallet record is gone.
|
|
392
|
+
* The app should offer a restore from backup.
|
|
393
|
+
*/
|
|
394
|
+
declare class WalletMissingError extends Web3PasskeyError {
|
|
395
|
+
credentialId: string;
|
|
396
|
+
ethereumAddress: string;
|
|
397
|
+
constructor(credentialId: string, ethereumAddress: string);
|
|
398
|
+
}
|
|
382
399
|
|
|
383
400
|
/**
|
|
384
401
|
* Persistent Session Storage
|
|
@@ -391,9 +408,11 @@ declare class ApiError extends Web3PasskeyError {
|
|
|
391
408
|
* user-verified assertion. Nothing stored on disk can re-derive it.
|
|
392
409
|
* - requireReauth: true → the key is NOT stored; every restore re-evaluates
|
|
393
410
|
* the PRF on a live assertion. The blob is hardware-bound at rest.
|
|
394
|
-
* - requireReauth: false → the key is stored
|
|
395
|
-
*
|
|
396
|
-
*
|
|
411
|
+
* - requireReauth: false → the raw key is stored next to the blob so silent
|
|
412
|
+
* restore works without a prompt, and re-imported as non-extractable. Any
|
|
413
|
+
* script on the origin can read it, which adds little: it could already
|
|
414
|
+
* use a stored key to decrypt. It is refreshed at every real (prompted)
|
|
415
|
+
* login.
|
|
397
416
|
* - Authenticators without PRF get no persistent sessions (in-memory only) —
|
|
398
417
|
* there is deliberately no weaker fallback encryption.
|
|
399
418
|
* - Only enabled for STANDARD and YOLO modes (STRICT mode excluded)
|
|
@@ -462,6 +481,89 @@ interface Web3PasskeyConfig {
|
|
|
462
481
|
zkProofs?: ZKProofConfig;
|
|
463
482
|
}
|
|
464
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Backup and Recovery Type Definitions
|
|
486
|
+
*/
|
|
487
|
+
type BackupMethod = 'file' | 'qr' | 'phrase';
|
|
488
|
+
interface BackupStatus {
|
|
489
|
+
hasBackup: boolean;
|
|
490
|
+
lastBackupAt?: string;
|
|
491
|
+
methods: BackupMethod[];
|
|
492
|
+
passkeySync: PasskeySyncStatus;
|
|
493
|
+
recoveryPhrase: RecoveryPhraseStatus;
|
|
494
|
+
socialRecovery?: SocialRecoveryStatus;
|
|
495
|
+
securityScore: SecurityScore;
|
|
496
|
+
}
|
|
497
|
+
interface PasskeySyncStatus {
|
|
498
|
+
enabled: boolean;
|
|
499
|
+
deviceCount: number;
|
|
500
|
+
lastSyncTime?: string;
|
|
501
|
+
platform: 'apple' | 'google' | 'microsoft' | 'unknown';
|
|
502
|
+
}
|
|
503
|
+
interface RecoveryPhraseStatus {
|
|
504
|
+
verified: boolean;
|
|
505
|
+
verificationCount: number;
|
|
506
|
+
lastVerified?: string;
|
|
507
|
+
encryptedBackups: EncryptedBackupInfo[];
|
|
508
|
+
}
|
|
509
|
+
interface EncryptedBackupInfo {
|
|
510
|
+
id: string;
|
|
511
|
+
method: 'qr' | 'file';
|
|
512
|
+
location: string;
|
|
513
|
+
createdAt: string;
|
|
514
|
+
deviceFingerprint?: string;
|
|
515
|
+
}
|
|
516
|
+
interface SocialRecoveryStatus {
|
|
517
|
+
enabled: boolean;
|
|
518
|
+
guardians: Guardian$1[];
|
|
519
|
+
threshold: number;
|
|
520
|
+
sharesDistributed: number;
|
|
521
|
+
verifiedGuardians: number;
|
|
522
|
+
}
|
|
523
|
+
interface Guardian$1 {
|
|
524
|
+
id: string;
|
|
525
|
+
name: string;
|
|
526
|
+
email?: string;
|
|
527
|
+
publicKey?: string;
|
|
528
|
+
shareEncrypted: string;
|
|
529
|
+
status: 'pending' | 'active' | 'revoked';
|
|
530
|
+
addedAt: string;
|
|
531
|
+
lastVerified?: string;
|
|
532
|
+
}
|
|
533
|
+
interface SecurityScore {
|
|
534
|
+
total: number;
|
|
535
|
+
breakdown: {
|
|
536
|
+
passkeyActive: number;
|
|
537
|
+
passkeyMultiDevice: number;
|
|
538
|
+
phraseVerified: number;
|
|
539
|
+
encryptedBackup: number;
|
|
540
|
+
socialRecovery: number;
|
|
541
|
+
};
|
|
542
|
+
level: 'vulnerable' | 'protected' | 'secured' | 'fort-knox';
|
|
543
|
+
nextMilestone: string;
|
|
544
|
+
}
|
|
545
|
+
interface QRBackupOptions {
|
|
546
|
+
password?: string;
|
|
547
|
+
errorCorrection?: 'L' | 'M' | 'Q' | 'H';
|
|
548
|
+
}
|
|
549
|
+
interface RecoveryScenario {
|
|
550
|
+
type: 'lost-device' | 'lost-phrase' | 'lost-both' | 'switch-platform';
|
|
551
|
+
description: string;
|
|
552
|
+
}
|
|
553
|
+
interface SimulationResult {
|
|
554
|
+
scenario: RecoveryScenario;
|
|
555
|
+
success: boolean;
|
|
556
|
+
availableMethods: RecoveryMethod[];
|
|
557
|
+
timeEstimate: string;
|
|
558
|
+
educationalNote: string;
|
|
559
|
+
}
|
|
560
|
+
interface RecoveryMethod {
|
|
561
|
+
method: string;
|
|
562
|
+
success: boolean;
|
|
563
|
+
time: string;
|
|
564
|
+
requirements: string[];
|
|
565
|
+
}
|
|
566
|
+
|
|
465
567
|
/**
|
|
466
568
|
* Main Web3Passkey SDK
|
|
467
569
|
*
|
|
@@ -495,6 +597,7 @@ declare class Web3Passkey {
|
|
|
495
597
|
private walletStorage;
|
|
496
598
|
private currentUser;
|
|
497
599
|
private currentWallet;
|
|
600
|
+
private persisted;
|
|
498
601
|
private sessionManager;
|
|
499
602
|
stealth?: StealthAddressModule;
|
|
500
603
|
private zkModule?;
|
|
@@ -518,6 +621,7 @@ declare class Web3Passkey {
|
|
|
518
621
|
}): Promise<{
|
|
519
622
|
address: string;
|
|
520
623
|
username: string;
|
|
624
|
+
hasBackup: boolean;
|
|
521
625
|
}>;
|
|
522
626
|
/**
|
|
523
627
|
* Login with WebAuthn using resident credentials
|
|
@@ -540,6 +644,14 @@ declare class Web3Passkey {
|
|
|
540
644
|
logout(): Promise<void>;
|
|
541
645
|
get isAuthenticated(): boolean;
|
|
542
646
|
get user(): UserInfo | null;
|
|
647
|
+
/**
|
|
648
|
+
* Whether the browser granted persistent storage (`navigator.storage.persist()`),
|
|
649
|
+
* requested after each register, login and restore: true means the origin's
|
|
650
|
+
* storage is exempt from storage-pressure eviction. null until the browser
|
|
651
|
+
* answers (Firefox asks the user), or where the API is missing.
|
|
652
|
+
*/
|
|
653
|
+
get storagePersisted(): boolean | null;
|
|
654
|
+
private requestPersistentStorage;
|
|
543
655
|
/**
|
|
544
656
|
* List existing credentials (usernames and addresses)
|
|
545
657
|
* Useful for allowing users to select which wallet to login to
|
|
@@ -874,7 +986,12 @@ declare class Web3Passkey {
|
|
|
874
986
|
/**
|
|
875
987
|
* Get backup status
|
|
876
988
|
*/
|
|
877
|
-
getBackupStatus(): Promise<
|
|
989
|
+
getBackupStatus(): Promise<BackupStatus>;
|
|
990
|
+
/**
|
|
991
|
+
* Record that the user wrote down their recovery phrase
|
|
992
|
+
* Call it once the user confirms, so getBackupStatus() reports a backup
|
|
993
|
+
*/
|
|
994
|
+
confirmRecoveryPhraseBackup(): Promise<void>;
|
|
878
995
|
/**
|
|
879
996
|
* Create simplified backup file
|
|
880
997
|
* This backup can be used to:
|
|
@@ -1023,7 +1140,7 @@ declare class Web3Passkey {
|
|
|
1023
1140
|
extendSession(): void;
|
|
1024
1141
|
/**
|
|
1025
1142
|
* Clear active session
|
|
1026
|
-
* Also clears ALL persistent sessions from
|
|
1143
|
+
* Also clears ALL persistent sessions from localStorage
|
|
1027
1144
|
*
|
|
1028
1145
|
* @throws {StorageError} if persistent sessions could not be cleared
|
|
1029
1146
|
*/
|
|
@@ -1417,85 +1534,6 @@ declare function getCurrentOrigin(): string;
|
|
|
1417
1534
|
*/
|
|
1418
1535
|
declare function deriveAddressFromP256PublicKey(publicKeySpki: string): Promise<string>;
|
|
1419
1536
|
|
|
1420
|
-
/**
|
|
1421
|
-
* Backup and Recovery Type Definitions
|
|
1422
|
-
*/
|
|
1423
|
-
interface BackupStatus {
|
|
1424
|
-
passkeySync: PasskeySyncStatus;
|
|
1425
|
-
recoveryPhrase: RecoveryPhraseStatus;
|
|
1426
|
-
socialRecovery?: SocialRecoveryStatus;
|
|
1427
|
-
securityScore: SecurityScore;
|
|
1428
|
-
}
|
|
1429
|
-
interface PasskeySyncStatus {
|
|
1430
|
-
enabled: boolean;
|
|
1431
|
-
deviceCount: number;
|
|
1432
|
-
lastSyncTime?: string;
|
|
1433
|
-
platform: 'apple' | 'google' | 'microsoft' | 'unknown';
|
|
1434
|
-
}
|
|
1435
|
-
interface RecoveryPhraseStatus {
|
|
1436
|
-
verified: boolean;
|
|
1437
|
-
verificationCount: number;
|
|
1438
|
-
lastVerified?: string;
|
|
1439
|
-
encryptedBackups: EncryptedBackupInfo[];
|
|
1440
|
-
}
|
|
1441
|
-
interface EncryptedBackupInfo {
|
|
1442
|
-
id: string;
|
|
1443
|
-
method: 'qr' | 'file';
|
|
1444
|
-
location: string;
|
|
1445
|
-
createdAt: string;
|
|
1446
|
-
deviceFingerprint?: string;
|
|
1447
|
-
}
|
|
1448
|
-
interface SocialRecoveryStatus {
|
|
1449
|
-
enabled: boolean;
|
|
1450
|
-
guardians: Guardian$1[];
|
|
1451
|
-
threshold: number;
|
|
1452
|
-
sharesDistributed: number;
|
|
1453
|
-
verifiedGuardians: number;
|
|
1454
|
-
}
|
|
1455
|
-
interface Guardian$1 {
|
|
1456
|
-
id: string;
|
|
1457
|
-
name: string;
|
|
1458
|
-
email?: string;
|
|
1459
|
-
publicKey?: string;
|
|
1460
|
-
shareEncrypted: string;
|
|
1461
|
-
status: 'pending' | 'active' | 'revoked';
|
|
1462
|
-
addedAt: string;
|
|
1463
|
-
lastVerified?: string;
|
|
1464
|
-
}
|
|
1465
|
-
interface SecurityScore {
|
|
1466
|
-
total: number;
|
|
1467
|
-
breakdown: {
|
|
1468
|
-
passkeyActive: number;
|
|
1469
|
-
passkeyMultiDevice: number;
|
|
1470
|
-
phraseVerified: number;
|
|
1471
|
-
encryptedBackup: number;
|
|
1472
|
-
socialRecovery: number;
|
|
1473
|
-
};
|
|
1474
|
-
level: 'vulnerable' | 'protected' | 'secured' | 'fort-knox';
|
|
1475
|
-
nextMilestone: string;
|
|
1476
|
-
}
|
|
1477
|
-
interface QRBackupOptions {
|
|
1478
|
-
password?: string;
|
|
1479
|
-
errorCorrection?: 'L' | 'M' | 'Q' | 'H';
|
|
1480
|
-
}
|
|
1481
|
-
interface RecoveryScenario {
|
|
1482
|
-
type: 'lost-device' | 'lost-phrase' | 'lost-both' | 'switch-platform';
|
|
1483
|
-
description: string;
|
|
1484
|
-
}
|
|
1485
|
-
interface SimulationResult {
|
|
1486
|
-
scenario: RecoveryScenario;
|
|
1487
|
-
success: boolean;
|
|
1488
|
-
availableMethods: RecoveryMethod[];
|
|
1489
|
-
timeEstimate: string;
|
|
1490
|
-
educationalNote: string;
|
|
1491
|
-
}
|
|
1492
|
-
interface RecoveryMethod {
|
|
1493
|
-
method: string;
|
|
1494
|
-
success: boolean;
|
|
1495
|
-
time: string;
|
|
1496
|
-
requirements: string[];
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
1537
|
/**
|
|
1500
1538
|
* Recovery Scenario Simulator
|
|
1501
1539
|
* Educational tool to help users understand recovery options
|
|
@@ -2217,6 +2255,7 @@ interface MLKemKeypair {
|
|
|
2217
2255
|
privateKey: Uint8Array;
|
|
2218
2256
|
}
|
|
2219
2257
|
interface EncryptedPayload {
|
|
2258
|
+
version?: 2;
|
|
2220
2259
|
recipients: Array<{
|
|
2221
2260
|
publicKey: string;
|
|
2222
2261
|
ciphertext: string;
|
|
@@ -2313,4 +2352,4 @@ declare function mlkemDecryptWithKey(payload: EncryptedPayload, privateKey: stri
|
|
|
2313
2352
|
|
|
2314
2353
|
declare function createWeb3Passkey(config?: Web3PasskeyConfig): Web3Passkey;
|
|
2315
2354
|
|
|
2316
|
-
export { ApiError, AuthenticationError, type BackupStatus, type BrowserInspectOptions, type BrowserInspectResult, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type SyncCapabilities, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, inspect, inspectNow, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|
|
2355
|
+
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus, type BrowserInspectOptions, type BrowserInspectResult, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type SyncCapabilities, SyncRequiredError, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, WalletMissingError, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, inspect, inspectNow, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -379,6 +379,23 @@ declare class ApiError extends Web3PasskeyError {
|
|
|
379
379
|
statusCode?: number | undefined;
|
|
380
380
|
constructor(message: string, statusCode?: number | undefined, originalError?: unknown);
|
|
381
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* The passkey authenticated, but this device has no credential metadata.
|
|
384
|
+
* The app should start a sync or restore flow.
|
|
385
|
+
*/
|
|
386
|
+
declare class SyncRequiredError extends Web3PasskeyError {
|
|
387
|
+
credentialId: string;
|
|
388
|
+
constructor(credentialId: string);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* The credential metadata is on this device, but the wallet record is gone.
|
|
392
|
+
* The app should offer a restore from backup.
|
|
393
|
+
*/
|
|
394
|
+
declare class WalletMissingError extends Web3PasskeyError {
|
|
395
|
+
credentialId: string;
|
|
396
|
+
ethereumAddress: string;
|
|
397
|
+
constructor(credentialId: string, ethereumAddress: string);
|
|
398
|
+
}
|
|
382
399
|
|
|
383
400
|
/**
|
|
384
401
|
* Persistent Session Storage
|
|
@@ -391,9 +408,11 @@ declare class ApiError extends Web3PasskeyError {
|
|
|
391
408
|
* user-verified assertion. Nothing stored on disk can re-derive it.
|
|
392
409
|
* - requireReauth: true → the key is NOT stored; every restore re-evaluates
|
|
393
410
|
* the PRF on a live assertion. The blob is hardware-bound at rest.
|
|
394
|
-
* - requireReauth: false → the key is stored
|
|
395
|
-
*
|
|
396
|
-
*
|
|
411
|
+
* - requireReauth: false → the raw key is stored next to the blob so silent
|
|
412
|
+
* restore works without a prompt, and re-imported as non-extractable. Any
|
|
413
|
+
* script on the origin can read it, which adds little: it could already
|
|
414
|
+
* use a stored key to decrypt. It is refreshed at every real (prompted)
|
|
415
|
+
* login.
|
|
397
416
|
* - Authenticators without PRF get no persistent sessions (in-memory only) —
|
|
398
417
|
* there is deliberately no weaker fallback encryption.
|
|
399
418
|
* - Only enabled for STANDARD and YOLO modes (STRICT mode excluded)
|
|
@@ -462,6 +481,89 @@ interface Web3PasskeyConfig {
|
|
|
462
481
|
zkProofs?: ZKProofConfig;
|
|
463
482
|
}
|
|
464
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Backup and Recovery Type Definitions
|
|
486
|
+
*/
|
|
487
|
+
type BackupMethod = 'file' | 'qr' | 'phrase';
|
|
488
|
+
interface BackupStatus {
|
|
489
|
+
hasBackup: boolean;
|
|
490
|
+
lastBackupAt?: string;
|
|
491
|
+
methods: BackupMethod[];
|
|
492
|
+
passkeySync: PasskeySyncStatus;
|
|
493
|
+
recoveryPhrase: RecoveryPhraseStatus;
|
|
494
|
+
socialRecovery?: SocialRecoveryStatus;
|
|
495
|
+
securityScore: SecurityScore;
|
|
496
|
+
}
|
|
497
|
+
interface PasskeySyncStatus {
|
|
498
|
+
enabled: boolean;
|
|
499
|
+
deviceCount: number;
|
|
500
|
+
lastSyncTime?: string;
|
|
501
|
+
platform: 'apple' | 'google' | 'microsoft' | 'unknown';
|
|
502
|
+
}
|
|
503
|
+
interface RecoveryPhraseStatus {
|
|
504
|
+
verified: boolean;
|
|
505
|
+
verificationCount: number;
|
|
506
|
+
lastVerified?: string;
|
|
507
|
+
encryptedBackups: EncryptedBackupInfo[];
|
|
508
|
+
}
|
|
509
|
+
interface EncryptedBackupInfo {
|
|
510
|
+
id: string;
|
|
511
|
+
method: 'qr' | 'file';
|
|
512
|
+
location: string;
|
|
513
|
+
createdAt: string;
|
|
514
|
+
deviceFingerprint?: string;
|
|
515
|
+
}
|
|
516
|
+
interface SocialRecoveryStatus {
|
|
517
|
+
enabled: boolean;
|
|
518
|
+
guardians: Guardian$1[];
|
|
519
|
+
threshold: number;
|
|
520
|
+
sharesDistributed: number;
|
|
521
|
+
verifiedGuardians: number;
|
|
522
|
+
}
|
|
523
|
+
interface Guardian$1 {
|
|
524
|
+
id: string;
|
|
525
|
+
name: string;
|
|
526
|
+
email?: string;
|
|
527
|
+
publicKey?: string;
|
|
528
|
+
shareEncrypted: string;
|
|
529
|
+
status: 'pending' | 'active' | 'revoked';
|
|
530
|
+
addedAt: string;
|
|
531
|
+
lastVerified?: string;
|
|
532
|
+
}
|
|
533
|
+
interface SecurityScore {
|
|
534
|
+
total: number;
|
|
535
|
+
breakdown: {
|
|
536
|
+
passkeyActive: number;
|
|
537
|
+
passkeyMultiDevice: number;
|
|
538
|
+
phraseVerified: number;
|
|
539
|
+
encryptedBackup: number;
|
|
540
|
+
socialRecovery: number;
|
|
541
|
+
};
|
|
542
|
+
level: 'vulnerable' | 'protected' | 'secured' | 'fort-knox';
|
|
543
|
+
nextMilestone: string;
|
|
544
|
+
}
|
|
545
|
+
interface QRBackupOptions {
|
|
546
|
+
password?: string;
|
|
547
|
+
errorCorrection?: 'L' | 'M' | 'Q' | 'H';
|
|
548
|
+
}
|
|
549
|
+
interface RecoveryScenario {
|
|
550
|
+
type: 'lost-device' | 'lost-phrase' | 'lost-both' | 'switch-platform';
|
|
551
|
+
description: string;
|
|
552
|
+
}
|
|
553
|
+
interface SimulationResult {
|
|
554
|
+
scenario: RecoveryScenario;
|
|
555
|
+
success: boolean;
|
|
556
|
+
availableMethods: RecoveryMethod[];
|
|
557
|
+
timeEstimate: string;
|
|
558
|
+
educationalNote: string;
|
|
559
|
+
}
|
|
560
|
+
interface RecoveryMethod {
|
|
561
|
+
method: string;
|
|
562
|
+
success: boolean;
|
|
563
|
+
time: string;
|
|
564
|
+
requirements: string[];
|
|
565
|
+
}
|
|
566
|
+
|
|
465
567
|
/**
|
|
466
568
|
* Main Web3Passkey SDK
|
|
467
569
|
*
|
|
@@ -495,6 +597,7 @@ declare class Web3Passkey {
|
|
|
495
597
|
private walletStorage;
|
|
496
598
|
private currentUser;
|
|
497
599
|
private currentWallet;
|
|
600
|
+
private persisted;
|
|
498
601
|
private sessionManager;
|
|
499
602
|
stealth?: StealthAddressModule;
|
|
500
603
|
private zkModule?;
|
|
@@ -518,6 +621,7 @@ declare class Web3Passkey {
|
|
|
518
621
|
}): Promise<{
|
|
519
622
|
address: string;
|
|
520
623
|
username: string;
|
|
624
|
+
hasBackup: boolean;
|
|
521
625
|
}>;
|
|
522
626
|
/**
|
|
523
627
|
* Login with WebAuthn using resident credentials
|
|
@@ -540,6 +644,14 @@ declare class Web3Passkey {
|
|
|
540
644
|
logout(): Promise<void>;
|
|
541
645
|
get isAuthenticated(): boolean;
|
|
542
646
|
get user(): UserInfo | null;
|
|
647
|
+
/**
|
|
648
|
+
* Whether the browser granted persistent storage (`navigator.storage.persist()`),
|
|
649
|
+
* requested after each register, login and restore: true means the origin's
|
|
650
|
+
* storage is exempt from storage-pressure eviction. null until the browser
|
|
651
|
+
* answers (Firefox asks the user), or where the API is missing.
|
|
652
|
+
*/
|
|
653
|
+
get storagePersisted(): boolean | null;
|
|
654
|
+
private requestPersistentStorage;
|
|
543
655
|
/**
|
|
544
656
|
* List existing credentials (usernames and addresses)
|
|
545
657
|
* Useful for allowing users to select which wallet to login to
|
|
@@ -874,7 +986,12 @@ declare class Web3Passkey {
|
|
|
874
986
|
/**
|
|
875
987
|
* Get backup status
|
|
876
988
|
*/
|
|
877
|
-
getBackupStatus(): Promise<
|
|
989
|
+
getBackupStatus(): Promise<BackupStatus>;
|
|
990
|
+
/**
|
|
991
|
+
* Record that the user wrote down their recovery phrase
|
|
992
|
+
* Call it once the user confirms, so getBackupStatus() reports a backup
|
|
993
|
+
*/
|
|
994
|
+
confirmRecoveryPhraseBackup(): Promise<void>;
|
|
878
995
|
/**
|
|
879
996
|
* Create simplified backup file
|
|
880
997
|
* This backup can be used to:
|
|
@@ -1023,7 +1140,7 @@ declare class Web3Passkey {
|
|
|
1023
1140
|
extendSession(): void;
|
|
1024
1141
|
/**
|
|
1025
1142
|
* Clear active session
|
|
1026
|
-
* Also clears ALL persistent sessions from
|
|
1143
|
+
* Also clears ALL persistent sessions from localStorage
|
|
1027
1144
|
*
|
|
1028
1145
|
* @throws {StorageError} if persistent sessions could not be cleared
|
|
1029
1146
|
*/
|
|
@@ -1417,85 +1534,6 @@ declare function getCurrentOrigin(): string;
|
|
|
1417
1534
|
*/
|
|
1418
1535
|
declare function deriveAddressFromP256PublicKey(publicKeySpki: string): Promise<string>;
|
|
1419
1536
|
|
|
1420
|
-
/**
|
|
1421
|
-
* Backup and Recovery Type Definitions
|
|
1422
|
-
*/
|
|
1423
|
-
interface BackupStatus {
|
|
1424
|
-
passkeySync: PasskeySyncStatus;
|
|
1425
|
-
recoveryPhrase: RecoveryPhraseStatus;
|
|
1426
|
-
socialRecovery?: SocialRecoveryStatus;
|
|
1427
|
-
securityScore: SecurityScore;
|
|
1428
|
-
}
|
|
1429
|
-
interface PasskeySyncStatus {
|
|
1430
|
-
enabled: boolean;
|
|
1431
|
-
deviceCount: number;
|
|
1432
|
-
lastSyncTime?: string;
|
|
1433
|
-
platform: 'apple' | 'google' | 'microsoft' | 'unknown';
|
|
1434
|
-
}
|
|
1435
|
-
interface RecoveryPhraseStatus {
|
|
1436
|
-
verified: boolean;
|
|
1437
|
-
verificationCount: number;
|
|
1438
|
-
lastVerified?: string;
|
|
1439
|
-
encryptedBackups: EncryptedBackupInfo[];
|
|
1440
|
-
}
|
|
1441
|
-
interface EncryptedBackupInfo {
|
|
1442
|
-
id: string;
|
|
1443
|
-
method: 'qr' | 'file';
|
|
1444
|
-
location: string;
|
|
1445
|
-
createdAt: string;
|
|
1446
|
-
deviceFingerprint?: string;
|
|
1447
|
-
}
|
|
1448
|
-
interface SocialRecoveryStatus {
|
|
1449
|
-
enabled: boolean;
|
|
1450
|
-
guardians: Guardian$1[];
|
|
1451
|
-
threshold: number;
|
|
1452
|
-
sharesDistributed: number;
|
|
1453
|
-
verifiedGuardians: number;
|
|
1454
|
-
}
|
|
1455
|
-
interface Guardian$1 {
|
|
1456
|
-
id: string;
|
|
1457
|
-
name: string;
|
|
1458
|
-
email?: string;
|
|
1459
|
-
publicKey?: string;
|
|
1460
|
-
shareEncrypted: string;
|
|
1461
|
-
status: 'pending' | 'active' | 'revoked';
|
|
1462
|
-
addedAt: string;
|
|
1463
|
-
lastVerified?: string;
|
|
1464
|
-
}
|
|
1465
|
-
interface SecurityScore {
|
|
1466
|
-
total: number;
|
|
1467
|
-
breakdown: {
|
|
1468
|
-
passkeyActive: number;
|
|
1469
|
-
passkeyMultiDevice: number;
|
|
1470
|
-
phraseVerified: number;
|
|
1471
|
-
encryptedBackup: number;
|
|
1472
|
-
socialRecovery: number;
|
|
1473
|
-
};
|
|
1474
|
-
level: 'vulnerable' | 'protected' | 'secured' | 'fort-knox';
|
|
1475
|
-
nextMilestone: string;
|
|
1476
|
-
}
|
|
1477
|
-
interface QRBackupOptions {
|
|
1478
|
-
password?: string;
|
|
1479
|
-
errorCorrection?: 'L' | 'M' | 'Q' | 'H';
|
|
1480
|
-
}
|
|
1481
|
-
interface RecoveryScenario {
|
|
1482
|
-
type: 'lost-device' | 'lost-phrase' | 'lost-both' | 'switch-platform';
|
|
1483
|
-
description: string;
|
|
1484
|
-
}
|
|
1485
|
-
interface SimulationResult {
|
|
1486
|
-
scenario: RecoveryScenario;
|
|
1487
|
-
success: boolean;
|
|
1488
|
-
availableMethods: RecoveryMethod[];
|
|
1489
|
-
timeEstimate: string;
|
|
1490
|
-
educationalNote: string;
|
|
1491
|
-
}
|
|
1492
|
-
interface RecoveryMethod {
|
|
1493
|
-
method: string;
|
|
1494
|
-
success: boolean;
|
|
1495
|
-
time: string;
|
|
1496
|
-
requirements: string[];
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
1537
|
/**
|
|
1500
1538
|
* Recovery Scenario Simulator
|
|
1501
1539
|
* Educational tool to help users understand recovery options
|
|
@@ -2217,6 +2255,7 @@ interface MLKemKeypair {
|
|
|
2217
2255
|
privateKey: Uint8Array;
|
|
2218
2256
|
}
|
|
2219
2257
|
interface EncryptedPayload {
|
|
2258
|
+
version?: 2;
|
|
2220
2259
|
recipients: Array<{
|
|
2221
2260
|
publicKey: string;
|
|
2222
2261
|
ciphertext: string;
|
|
@@ -2313,4 +2352,4 @@ declare function mlkemDecryptWithKey(payload: EncryptedPayload, privateKey: stri
|
|
|
2313
2352
|
|
|
2314
2353
|
declare function createWeb3Passkey(config?: Web3PasskeyConfig): Web3Passkey;
|
|
2315
2354
|
|
|
2316
|
-
export { ApiError, AuthenticationError, type BackupStatus, type BrowserInspectOptions, type BrowserInspectResult, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type SyncCapabilities, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, inspect, inspectNow, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|
|
2355
|
+
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus, type BrowserInspectOptions, type BrowserInspectResult, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type SyncCapabilities, SyncRequiredError, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, WalletMissingError, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, inspect, inspectNow, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|