w3pk 0.7.0 → 0.7.2
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/README.md +76 -19
- package/dist/index.d.mts +650 -5
- package/dist/index.d.ts +650 -5
- package/dist/index.js +776 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +776 -5
- package/dist/index.mjs.map +1 -1
- package/docs/BUNDLE_SIZES.md +7 -4
- package/docs/MIGRATION.md +15 -15
- package/docs/QR_CODE.md +1887 -0
- package/docs/RECOVERY.md +992 -0
- package/docs/SECURITY.md +631 -0
- package/docs/ZK_INTEGRATION_GUIDE.md +6 -4
- package/docs/index.html +4 -3
- package/package.json +9 -2
package/dist/index.d.ts
CHANGED
|
@@ -320,9 +320,10 @@ declare class Web3Passkey {
|
|
|
320
320
|
private zkModule?;
|
|
321
321
|
constructor(config?: Web3PasskeyConfig);
|
|
322
322
|
/**
|
|
323
|
-
* Lazy-load ZK module
|
|
323
|
+
* Lazy-load ZK module only when accessed
|
|
324
|
+
* This prevents bundlers from including circomlibjs unless ZK features are used
|
|
324
325
|
*/
|
|
325
|
-
private
|
|
326
|
+
private loadZKModule;
|
|
326
327
|
/**
|
|
327
328
|
* Get mnemonic from active session or trigger authentication
|
|
328
329
|
* This is used internally by methods that need the mnemonic
|
|
@@ -334,12 +335,13 @@ declare class Web3Passkey {
|
|
|
334
335
|
* Register a new user with WebAuthn
|
|
335
336
|
* Automatically generates a wallet if none exists
|
|
336
337
|
* Creates a passkey and associates it with the Ethereum address (account #0)
|
|
337
|
-
* Returns the
|
|
338
|
+
* Returns the derived address #0 and username
|
|
338
339
|
*/
|
|
339
340
|
register(options: {
|
|
340
341
|
username: string;
|
|
341
342
|
}): Promise<{
|
|
342
|
-
|
|
343
|
+
address: string;
|
|
344
|
+
username: string;
|
|
343
345
|
}>;
|
|
344
346
|
/**
|
|
345
347
|
* Login with WebAuthn (usernameless)
|
|
@@ -424,6 +426,108 @@ declare class Web3Passkey {
|
|
|
424
426
|
* Access ZK proof module (if available)
|
|
425
427
|
*/
|
|
426
428
|
get zk(): any;
|
|
429
|
+
/**
|
|
430
|
+
* Get comprehensive backup status
|
|
431
|
+
* Shows user exactly what protects their wallet
|
|
432
|
+
*/
|
|
433
|
+
getBackupStatus(): Promise<any>;
|
|
434
|
+
/**
|
|
435
|
+
* Create password-protected ZIP backup
|
|
436
|
+
* @param password - Strong password to encrypt the backup
|
|
437
|
+
* @param options - Optional backup configuration
|
|
438
|
+
*/
|
|
439
|
+
createZipBackup(password: string, options?: {
|
|
440
|
+
includeInstructions?: boolean;
|
|
441
|
+
deviceBinding?: boolean;
|
|
442
|
+
}): Promise<Blob>;
|
|
443
|
+
/**
|
|
444
|
+
* Create QR code backup
|
|
445
|
+
* @param password - Optional password to encrypt QR code
|
|
446
|
+
* @param options - QR code configuration
|
|
447
|
+
*/
|
|
448
|
+
createQRBackup(password?: string, options?: {
|
|
449
|
+
errorCorrection?: "L" | "M" | "Q" | "H";
|
|
450
|
+
}): Promise<{
|
|
451
|
+
qrCodeDataURL: string;
|
|
452
|
+
instructions: string;
|
|
453
|
+
}>;
|
|
454
|
+
/**
|
|
455
|
+
* Set up social recovery
|
|
456
|
+
* Splits mnemonic into M-of-N shares for guardian-based recovery
|
|
457
|
+
*
|
|
458
|
+
* @param guardians - Array of guardian information
|
|
459
|
+
* @param threshold - Number of guardians required to recover (M in M-of-N)
|
|
460
|
+
*/
|
|
461
|
+
setupSocialRecovery(guardians: {
|
|
462
|
+
name: string;
|
|
463
|
+
email?: string;
|
|
464
|
+
phone?: string;
|
|
465
|
+
}[], threshold: number): Promise<any[]>;
|
|
466
|
+
/**
|
|
467
|
+
* Generate guardian invitation
|
|
468
|
+
* Creates QR code and instructions for a guardian
|
|
469
|
+
*/
|
|
470
|
+
generateGuardianInvite(guardianId: string): Promise<any>;
|
|
471
|
+
/**
|
|
472
|
+
* Recover wallet from guardian shares
|
|
473
|
+
* @param shares - Array of share data from guardians (JSON strings)
|
|
474
|
+
*/
|
|
475
|
+
recoverFromGuardians(shares: string[]): Promise<{
|
|
476
|
+
mnemonic: string;
|
|
477
|
+
ethereumAddress: string;
|
|
478
|
+
}>;
|
|
479
|
+
/**
|
|
480
|
+
* Restore wallet from encrypted backup
|
|
481
|
+
* @param backupData - Backup file contents (JSON string)
|
|
482
|
+
* @param password - Password used to encrypt the backup
|
|
483
|
+
*/
|
|
484
|
+
restoreFromBackup(backupData: string, password: string): Promise<{
|
|
485
|
+
mnemonic: string;
|
|
486
|
+
ethereumAddress: string;
|
|
487
|
+
}>;
|
|
488
|
+
/**
|
|
489
|
+
* Restore wallet from QR code
|
|
490
|
+
* @param qrData - Scanned QR code data (JSON string)
|
|
491
|
+
* @param password - Optional password if QR was encrypted
|
|
492
|
+
*/
|
|
493
|
+
restoreFromQR(qrData: string, password?: string): Promise<{
|
|
494
|
+
mnemonic: string;
|
|
495
|
+
ethereumAddress: string;
|
|
496
|
+
}>;
|
|
497
|
+
/**
|
|
498
|
+
* Get cross-device sync status
|
|
499
|
+
* Shows which devices have access and sync capabilities
|
|
500
|
+
*/
|
|
501
|
+
getSyncStatus(): Promise<any>;
|
|
502
|
+
/**
|
|
503
|
+
* Detect sync capabilities
|
|
504
|
+
* Shows what platform sync is available (iCloud, Google, etc.)
|
|
505
|
+
*/
|
|
506
|
+
detectSyncCapabilities(): Promise<any>;
|
|
507
|
+
/**
|
|
508
|
+
* Simulate recovery scenario (educational)
|
|
509
|
+
* Tests what happens in various loss scenarios
|
|
510
|
+
*
|
|
511
|
+
* @param scenario - Type of scenario to simulate
|
|
512
|
+
*/
|
|
513
|
+
simulateRecoveryScenario(scenario: {
|
|
514
|
+
type: "lost-device" | "lost-phrase" | "lost-both" | "switch-platform";
|
|
515
|
+
description: string;
|
|
516
|
+
}): Promise<any>;
|
|
517
|
+
/**
|
|
518
|
+
* Run interactive recovery test
|
|
519
|
+
* Tests all recovery scenarios and provides feedback
|
|
520
|
+
*/
|
|
521
|
+
runRecoveryTest(): Promise<{
|
|
522
|
+
scenarios: any[];
|
|
523
|
+
overallScore: number;
|
|
524
|
+
feedback: string;
|
|
525
|
+
}>;
|
|
526
|
+
/**
|
|
527
|
+
* Get educational content
|
|
528
|
+
* @param topic - Topic to explain (e.g., 'whatIsPasskey', 'socialRecoveryExplained')
|
|
529
|
+
*/
|
|
530
|
+
getEducation(topic: string): Promise<any>;
|
|
427
531
|
/**
|
|
428
532
|
* Check if there's an active session
|
|
429
533
|
*/
|
|
@@ -485,6 +589,547 @@ declare function deriveWalletFromMnemonic(mnemonic: string, index?: number): {
|
|
|
485
589
|
privateKey: string;
|
|
486
590
|
};
|
|
487
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Backup and Recovery Type Definitions
|
|
594
|
+
*/
|
|
595
|
+
interface BackupStatus {
|
|
596
|
+
passkeySync: PasskeySyncStatus;
|
|
597
|
+
recoveryPhrase: RecoveryPhraseStatus;
|
|
598
|
+
socialRecovery?: SocialRecoveryStatus;
|
|
599
|
+
securityScore: SecurityScore;
|
|
600
|
+
}
|
|
601
|
+
interface PasskeySyncStatus {
|
|
602
|
+
enabled: boolean;
|
|
603
|
+
deviceCount: number;
|
|
604
|
+
lastSyncTime?: number;
|
|
605
|
+
platform: 'apple' | 'google' | 'microsoft' | 'unknown';
|
|
606
|
+
}
|
|
607
|
+
interface RecoveryPhraseStatus {
|
|
608
|
+
verified: boolean;
|
|
609
|
+
verificationCount: number;
|
|
610
|
+
lastVerified?: number;
|
|
611
|
+
encryptedBackups: EncryptedBackupInfo[];
|
|
612
|
+
}
|
|
613
|
+
interface EncryptedBackupInfo {
|
|
614
|
+
id: string;
|
|
615
|
+
method: 'zip' | 'qr' | 'file';
|
|
616
|
+
location: string;
|
|
617
|
+
createdAt: number;
|
|
618
|
+
deviceFingerprint?: string;
|
|
619
|
+
}
|
|
620
|
+
interface SocialRecoveryStatus {
|
|
621
|
+
enabled: boolean;
|
|
622
|
+
guardians: Guardian$1[];
|
|
623
|
+
threshold: number;
|
|
624
|
+
sharesDistributed: number;
|
|
625
|
+
verifiedGuardians: number;
|
|
626
|
+
}
|
|
627
|
+
interface Guardian$1 {
|
|
628
|
+
id: string;
|
|
629
|
+
name: string;
|
|
630
|
+
email?: string;
|
|
631
|
+
publicKey?: string;
|
|
632
|
+
shareEncrypted: string;
|
|
633
|
+
status: 'pending' | 'active' | 'revoked';
|
|
634
|
+
addedAt: number;
|
|
635
|
+
lastVerified?: number;
|
|
636
|
+
}
|
|
637
|
+
interface SecurityScore {
|
|
638
|
+
total: number;
|
|
639
|
+
breakdown: {
|
|
640
|
+
passkeyActive: number;
|
|
641
|
+
passkeyMultiDevice: number;
|
|
642
|
+
phraseVerified: number;
|
|
643
|
+
encryptedBackup: number;
|
|
644
|
+
socialRecovery: number;
|
|
645
|
+
};
|
|
646
|
+
level: 'vulnerable' | 'protected' | 'secured' | 'fort-knox';
|
|
647
|
+
nextMilestone: string;
|
|
648
|
+
}
|
|
649
|
+
interface BackupMetadata {
|
|
650
|
+
id: string;
|
|
651
|
+
ethereumAddress: string;
|
|
652
|
+
method: 'zip' | 'qr' | 'file';
|
|
653
|
+
createdAt: number;
|
|
654
|
+
deviceFingerprint?: string;
|
|
655
|
+
addressChecksum: string;
|
|
656
|
+
}
|
|
657
|
+
interface ZipBackupOptions {
|
|
658
|
+
password: string;
|
|
659
|
+
includeInstructions?: boolean;
|
|
660
|
+
deviceBinding?: boolean;
|
|
661
|
+
}
|
|
662
|
+
interface QRBackupOptions {
|
|
663
|
+
password?: string;
|
|
664
|
+
errorCorrection?: 'L' | 'M' | 'Q' | 'H';
|
|
665
|
+
}
|
|
666
|
+
interface RecoveryScenario {
|
|
667
|
+
type: 'lost-device' | 'lost-phrase' | 'lost-both' | 'switch-platform';
|
|
668
|
+
description: string;
|
|
669
|
+
}
|
|
670
|
+
interface SimulationResult {
|
|
671
|
+
scenario: RecoveryScenario;
|
|
672
|
+
success: boolean;
|
|
673
|
+
availableMethods: RecoveryMethod[];
|
|
674
|
+
timeEstimate: string;
|
|
675
|
+
educationalNote: string;
|
|
676
|
+
}
|
|
677
|
+
interface RecoveryMethod {
|
|
678
|
+
method: string;
|
|
679
|
+
success: boolean;
|
|
680
|
+
time: string;
|
|
681
|
+
requirements: string[];
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Main Backup Manager
|
|
686
|
+
* Orchestrates all backup and recovery operations
|
|
687
|
+
*/
|
|
688
|
+
|
|
689
|
+
declare class BackupManager {
|
|
690
|
+
private storage;
|
|
691
|
+
private zipCreator;
|
|
692
|
+
private qrCreator;
|
|
693
|
+
constructor();
|
|
694
|
+
/**
|
|
695
|
+
* Get comprehensive backup status
|
|
696
|
+
* Shows user exactly what protects their wallet
|
|
697
|
+
*/
|
|
698
|
+
getBackupStatus(ethereumAddress: string): Promise<BackupStatus>;
|
|
699
|
+
/**
|
|
700
|
+
* Detect passkey sync capabilities
|
|
701
|
+
*/
|
|
702
|
+
private detectPasskeySync;
|
|
703
|
+
/**
|
|
704
|
+
* Check if platform supports resident keys (required for passkey sync)
|
|
705
|
+
*/
|
|
706
|
+
private checkResidentKeySupport;
|
|
707
|
+
/**
|
|
708
|
+
* Calculate security score
|
|
709
|
+
*/
|
|
710
|
+
private calculateSecurityScore;
|
|
711
|
+
/**
|
|
712
|
+
* Create password-protected ZIP backup
|
|
713
|
+
*/
|
|
714
|
+
createZipBackup(mnemonic: string, ethereumAddress: string, options: ZipBackupOptions): Promise<Blob>;
|
|
715
|
+
/**
|
|
716
|
+
* Create QR code backup
|
|
717
|
+
*/
|
|
718
|
+
createQRBackup(mnemonic: string, ethereumAddress: string, options?: QRBackupOptions): Promise<{
|
|
719
|
+
qrCodeDataURL: string;
|
|
720
|
+
instructions: string;
|
|
721
|
+
}>;
|
|
722
|
+
/**
|
|
723
|
+
* Restore from ZIP backup
|
|
724
|
+
*/
|
|
725
|
+
restoreFromZipBackup(backupData: string, password: string): Promise<{
|
|
726
|
+
mnemonic: string;
|
|
727
|
+
ethereumAddress: string;
|
|
728
|
+
}>;
|
|
729
|
+
/**
|
|
730
|
+
* Restore from QR backup
|
|
731
|
+
*/
|
|
732
|
+
restoreFromQR(qrData: string, password?: string): Promise<{
|
|
733
|
+
mnemonic: string;
|
|
734
|
+
ethereumAddress: string;
|
|
735
|
+
}>;
|
|
736
|
+
/**
|
|
737
|
+
* Simulate recovery scenario (educational)
|
|
738
|
+
*/
|
|
739
|
+
simulateRecoveryScenario(scenario: RecoveryScenario, currentStatus: BackupStatus): Promise<SimulationResult>;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* IndexedDB Storage for Backup Metadata
|
|
744
|
+
*/
|
|
745
|
+
|
|
746
|
+
declare class BackupStorage {
|
|
747
|
+
private dbName;
|
|
748
|
+
private version;
|
|
749
|
+
private db;
|
|
750
|
+
/**
|
|
751
|
+
* Initialize the database
|
|
752
|
+
*/
|
|
753
|
+
init(): Promise<void>;
|
|
754
|
+
/**
|
|
755
|
+
* Store backup metadata
|
|
756
|
+
*/
|
|
757
|
+
storeBackupMetadata(metadata: BackupMetadata): Promise<void>;
|
|
758
|
+
/**
|
|
759
|
+
* Get all backups for an address
|
|
760
|
+
*/
|
|
761
|
+
getBackupsByAddress(ethereumAddress: string): Promise<BackupMetadata[]>;
|
|
762
|
+
/**
|
|
763
|
+
* Get backup by ID
|
|
764
|
+
*/
|
|
765
|
+
getBackupById(id: string): Promise<BackupMetadata | null>;
|
|
766
|
+
/**
|
|
767
|
+
* Delete backup metadata
|
|
768
|
+
*/
|
|
769
|
+
deleteBackup(id: string): Promise<void>;
|
|
770
|
+
/**
|
|
771
|
+
* Get count of backups by method
|
|
772
|
+
*/
|
|
773
|
+
getBackupCountByMethod(method: 'zip' | 'qr' | 'file'): Promise<number>;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Social Recovery Type Definitions
|
|
778
|
+
*/
|
|
779
|
+
interface Guardian {
|
|
780
|
+
id: string;
|
|
781
|
+
name: string;
|
|
782
|
+
email?: string;
|
|
783
|
+
phone?: string;
|
|
784
|
+
publicKey?: string;
|
|
785
|
+
shareEncrypted: string;
|
|
786
|
+
status: 'pending' | 'active' | 'revoked';
|
|
787
|
+
addedAt: number;
|
|
788
|
+
lastVerified?: number;
|
|
789
|
+
}
|
|
790
|
+
interface GuardianInvite {
|
|
791
|
+
guardianId: string;
|
|
792
|
+
qrCode: string;
|
|
793
|
+
shareCode: string;
|
|
794
|
+
explainer: string;
|
|
795
|
+
link?: string;
|
|
796
|
+
}
|
|
797
|
+
interface SocialRecoveryConfig {
|
|
798
|
+
threshold: number;
|
|
799
|
+
totalGuardians: number;
|
|
800
|
+
guardians: Guardian[];
|
|
801
|
+
createdAt: number;
|
|
802
|
+
ethereumAddress: string;
|
|
803
|
+
}
|
|
804
|
+
interface RecoveryShare {
|
|
805
|
+
guardianId: string;
|
|
806
|
+
share: string;
|
|
807
|
+
index: number;
|
|
808
|
+
}
|
|
809
|
+
interface RecoveryProgress {
|
|
810
|
+
collected: number;
|
|
811
|
+
required: number;
|
|
812
|
+
guardians: {
|
|
813
|
+
id: string;
|
|
814
|
+
name: string;
|
|
815
|
+
hasProvided: boolean;
|
|
816
|
+
}[];
|
|
817
|
+
canRecover: boolean;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Social Recovery Manager
|
|
822
|
+
* Manages guardian-based wallet recovery using Shamir Secret Sharing
|
|
823
|
+
*/
|
|
824
|
+
|
|
825
|
+
declare class SocialRecoveryManager {
|
|
826
|
+
private storageKey;
|
|
827
|
+
/**
|
|
828
|
+
* Get storage (localStorage or in-memory fallback)
|
|
829
|
+
*/
|
|
830
|
+
private getItem;
|
|
831
|
+
/**
|
|
832
|
+
* Set storage (localStorage or in-memory fallback)
|
|
833
|
+
*/
|
|
834
|
+
private setItem;
|
|
835
|
+
/**
|
|
836
|
+
* Set up social recovery
|
|
837
|
+
* Splits mnemonic into M-of-N shares and distributes to guardians
|
|
838
|
+
*/
|
|
839
|
+
setupSocialRecovery(mnemonic: string, ethereumAddress: string, guardians: {
|
|
840
|
+
name: string;
|
|
841
|
+
email?: string;
|
|
842
|
+
phone?: string;
|
|
843
|
+
}[], threshold: number): Promise<Guardian[]>;
|
|
844
|
+
/**
|
|
845
|
+
* Get current social recovery configuration
|
|
846
|
+
*/
|
|
847
|
+
getSocialRecoveryConfig(): SocialRecoveryConfig | null;
|
|
848
|
+
/**
|
|
849
|
+
* Generate guardian invitation
|
|
850
|
+
* Creates QR code and educational materials for guardian
|
|
851
|
+
*/
|
|
852
|
+
generateGuardianInvite(guardian: Guardian): Promise<GuardianInvite>;
|
|
853
|
+
/**
|
|
854
|
+
* Generate QR code from share data
|
|
855
|
+
*/
|
|
856
|
+
private generateQRCode;
|
|
857
|
+
/**
|
|
858
|
+
* Create placeholder QR code
|
|
859
|
+
*/
|
|
860
|
+
private createPlaceholderQR;
|
|
861
|
+
/**
|
|
862
|
+
* Wrap text for display
|
|
863
|
+
*/
|
|
864
|
+
private wrapText;
|
|
865
|
+
/**
|
|
866
|
+
* Get guardian explainer text
|
|
867
|
+
*/
|
|
868
|
+
private getGuardianExplainer;
|
|
869
|
+
/**
|
|
870
|
+
* Recover mnemonic from guardian shares
|
|
871
|
+
*/
|
|
872
|
+
recoverFromGuardians(shareData: string[]): Promise<{
|
|
873
|
+
mnemonic: string;
|
|
874
|
+
ethereumAddress: string;
|
|
875
|
+
}>;
|
|
876
|
+
/**
|
|
877
|
+
* Get recovery progress
|
|
878
|
+
*/
|
|
879
|
+
getRecoveryProgress(collectedShares: string[]): RecoveryProgress;
|
|
880
|
+
/**
|
|
881
|
+
* Mark guardian as verified
|
|
882
|
+
*/
|
|
883
|
+
markGuardianVerified(guardianId: string): void;
|
|
884
|
+
/**
|
|
885
|
+
* Revoke a guardian
|
|
886
|
+
*/
|
|
887
|
+
revokeGuardian(guardianId: string): void;
|
|
888
|
+
/**
|
|
889
|
+
* Add new guardian (requires re-sharing)
|
|
890
|
+
*/
|
|
891
|
+
addGuardian(mnemonic: string, newGuardian: {
|
|
892
|
+
name: string;
|
|
893
|
+
email?: string;
|
|
894
|
+
phone?: string;
|
|
895
|
+
}): Promise<Guardian>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Cross-Device Sync Type Definitions
|
|
900
|
+
*/
|
|
901
|
+
interface SyncVault {
|
|
902
|
+
id: string;
|
|
903
|
+
encryptedData: string;
|
|
904
|
+
deviceFingerprints: string[];
|
|
905
|
+
syncMethod: 'icloud' | 'google' | 'microsoft' | 'custom';
|
|
906
|
+
version: number;
|
|
907
|
+
updatedAt: number;
|
|
908
|
+
}
|
|
909
|
+
interface DeviceInfo {
|
|
910
|
+
id: string;
|
|
911
|
+
name: string;
|
|
912
|
+
platform: 'ios' | 'android' | 'macos' | 'windows' | 'linux' | 'unknown';
|
|
913
|
+
lastActive: number;
|
|
914
|
+
trusted: boolean;
|
|
915
|
+
canRevoke: boolean;
|
|
916
|
+
}
|
|
917
|
+
interface SyncCapabilities {
|
|
918
|
+
passkeysSync: boolean;
|
|
919
|
+
platform: 'apple' | 'google' | 'microsoft' | 'none';
|
|
920
|
+
estimatedDevices: number;
|
|
921
|
+
syncEnabled: boolean;
|
|
922
|
+
}
|
|
923
|
+
interface SyncStatus {
|
|
924
|
+
enabled: boolean;
|
|
925
|
+
devices: DeviceInfo[];
|
|
926
|
+
lastSyncTime?: number;
|
|
927
|
+
platform: string;
|
|
928
|
+
}
|
|
929
|
+
interface SyncResult {
|
|
930
|
+
success: boolean;
|
|
931
|
+
steps: SyncStep[];
|
|
932
|
+
}
|
|
933
|
+
interface SyncStep {
|
|
934
|
+
title: string;
|
|
935
|
+
action: string;
|
|
936
|
+
educational: string;
|
|
937
|
+
status: 'waiting' | 'in-progress' | 'completed' | 'failed';
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Encrypted Sync Vault
|
|
942
|
+
* Manages encrypted wallet data for cross-device sync
|
|
943
|
+
*/
|
|
944
|
+
|
|
945
|
+
declare class VaultSync {
|
|
946
|
+
/**
|
|
947
|
+
* Create encrypted sync package
|
|
948
|
+
* Uses passkey + device fingerprint for encryption
|
|
949
|
+
*/
|
|
950
|
+
createSyncPackage(mnemonic: string, credentialId: string, publicKey: string): Promise<SyncVault>;
|
|
951
|
+
/**
|
|
952
|
+
* Detect available sync method
|
|
953
|
+
*/
|
|
954
|
+
private detectSyncMethod;
|
|
955
|
+
/**
|
|
956
|
+
* Restore from sync vault
|
|
957
|
+
* Interactive guide for multi-device setup
|
|
958
|
+
*/
|
|
959
|
+
restoreFromSync(vault: SyncVault, credentialId: string, publicKey: string): Promise<string>;
|
|
960
|
+
/**
|
|
961
|
+
* Get setup flow for new device
|
|
962
|
+
* Educational flow with step-by-step instructions
|
|
963
|
+
*/
|
|
964
|
+
getSetupFlow(): Promise<SyncResult>;
|
|
965
|
+
/**
|
|
966
|
+
* Educational message about how sync works
|
|
967
|
+
*/
|
|
968
|
+
getSyncExplainer(): string;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Device Manager
|
|
973
|
+
* Track and manage trusted devices with wallet access
|
|
974
|
+
*/
|
|
975
|
+
|
|
976
|
+
declare class DeviceManager {
|
|
977
|
+
private storageKey;
|
|
978
|
+
/**
|
|
979
|
+
* Register current device
|
|
980
|
+
*/
|
|
981
|
+
registerDevice(): Promise<DeviceInfo>;
|
|
982
|
+
/**
|
|
983
|
+
* Get all registered devices
|
|
984
|
+
*/
|
|
985
|
+
getDevices(): Promise<DeviceInfo[]>;
|
|
986
|
+
/**
|
|
987
|
+
* Get sync status with device list
|
|
988
|
+
*/
|
|
989
|
+
getSyncStatus(): Promise<SyncStatus>;
|
|
990
|
+
/**
|
|
991
|
+
* Revoke a device
|
|
992
|
+
*/
|
|
993
|
+
revokeDevice(deviceId: string): Promise<void>;
|
|
994
|
+
/**
|
|
995
|
+
* Update device last active timestamp
|
|
996
|
+
*/
|
|
997
|
+
updateLastActive(): Promise<void>;
|
|
998
|
+
/**
|
|
999
|
+
* Get device name
|
|
1000
|
+
*/
|
|
1001
|
+
private getDeviceName;
|
|
1002
|
+
/**
|
|
1003
|
+
* Detect device platform
|
|
1004
|
+
*/
|
|
1005
|
+
private detectPlatform;
|
|
1006
|
+
/**
|
|
1007
|
+
* Get platform display name
|
|
1008
|
+
*/
|
|
1009
|
+
private getPlatformName;
|
|
1010
|
+
/**
|
|
1011
|
+
* Get formatted device list for display
|
|
1012
|
+
*/
|
|
1013
|
+
getDeviceListFormatted(): Promise<string>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Format time difference for display
|
|
1016
|
+
*/
|
|
1017
|
+
private formatTimeDiff;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Platform Detection for Passkey Sync
|
|
1022
|
+
* Detects available sync platforms (iCloud, Google, Microsoft)
|
|
1023
|
+
*/
|
|
1024
|
+
|
|
1025
|
+
declare class PlatformDetector {
|
|
1026
|
+
/**
|
|
1027
|
+
* Detect available sync capabilities
|
|
1028
|
+
* Shows what's automatically protecting the user
|
|
1029
|
+
*/
|
|
1030
|
+
detectSyncCapabilities(): Promise<SyncCapabilities>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Detect user's platform
|
|
1033
|
+
*/
|
|
1034
|
+
private detectPlatform;
|
|
1035
|
+
/**
|
|
1036
|
+
* Check if passkey sync is supported
|
|
1037
|
+
*/
|
|
1038
|
+
private checkPasskeySync;
|
|
1039
|
+
/**
|
|
1040
|
+
* Estimate number of synced devices
|
|
1041
|
+
* Note: This is a rough estimate, actual count requires server-side tracking
|
|
1042
|
+
*/
|
|
1043
|
+
private estimateDeviceCount;
|
|
1044
|
+
/**
|
|
1045
|
+
* Get platform-specific educational message
|
|
1046
|
+
*/
|
|
1047
|
+
getPlatformEducation(platform: 'apple' | 'google' | 'microsoft' | 'none'): string;
|
|
1048
|
+
/**
|
|
1049
|
+
* Get sync setup instructions
|
|
1050
|
+
*/
|
|
1051
|
+
getSyncInstructions(platform: 'apple' | 'google' | 'microsoft' | 'none'): string[];
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Recovery Scenario Simulator
|
|
1056
|
+
* Educational tool to help users understand recovery options
|
|
1057
|
+
*/
|
|
1058
|
+
|
|
1059
|
+
declare class RecoverySimulator {
|
|
1060
|
+
/**
|
|
1061
|
+
* Predefined recovery scenarios
|
|
1062
|
+
*/
|
|
1063
|
+
getScenarios(): RecoveryScenario[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Simulate a recovery scenario
|
|
1066
|
+
*/
|
|
1067
|
+
simulateScenario(scenario: RecoveryScenario, currentStatus: BackupStatus): Promise<SimulationResult>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Estimate fastest recovery time
|
|
1070
|
+
*/
|
|
1071
|
+
private estimateFastestRecovery;
|
|
1072
|
+
/**
|
|
1073
|
+
* Get educational note for scenario
|
|
1074
|
+
*/
|
|
1075
|
+
private getEducationalNote;
|
|
1076
|
+
/**
|
|
1077
|
+
* Run interactive test
|
|
1078
|
+
*/
|
|
1079
|
+
runInteractiveTest(currentStatus: BackupStatus): Promise<{
|
|
1080
|
+
scenarios: SimulationResult[];
|
|
1081
|
+
overallScore: number;
|
|
1082
|
+
feedback: string;
|
|
1083
|
+
}>;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Educational Content
|
|
1088
|
+
* Explainers for users to understand security concepts
|
|
1089
|
+
*/
|
|
1090
|
+
interface EducationalModule {
|
|
1091
|
+
title: string;
|
|
1092
|
+
content: string;
|
|
1093
|
+
visual?: string;
|
|
1094
|
+
interactive?: string;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Get explainer by topic
|
|
1098
|
+
*/
|
|
1099
|
+
declare function getExplainer(topic: string): EducationalModule | null;
|
|
1100
|
+
/**
|
|
1101
|
+
* Get all explainer topics
|
|
1102
|
+
*/
|
|
1103
|
+
declare function getAllTopics(): string[];
|
|
1104
|
+
/**
|
|
1105
|
+
* Search explainers
|
|
1106
|
+
*/
|
|
1107
|
+
declare function searchExplainers(query: string): EducationalModule[];
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Input validation utilities
|
|
1111
|
+
*/
|
|
1112
|
+
declare function validateEthereumAddress(address: string): boolean;
|
|
1113
|
+
declare function validateUsername(username: string): boolean;
|
|
1114
|
+
declare function validateMnemonic(mnemonic: string): boolean;
|
|
1115
|
+
declare function assertEthereumAddress(address: string): void;
|
|
1116
|
+
declare function assertUsername(username: string): void;
|
|
1117
|
+
declare function assertMnemonic(mnemonic: string): void;
|
|
1118
|
+
/**
|
|
1119
|
+
* Validates password strength based on security best practices
|
|
1120
|
+
* @param password - The password to validate
|
|
1121
|
+
* @returns true if password meets strength requirements, false otherwise
|
|
1122
|
+
*
|
|
1123
|
+
* Requirements:
|
|
1124
|
+
* - At least 12 characters long
|
|
1125
|
+
* - Contains at least one uppercase letter
|
|
1126
|
+
* - Contains at least one lowercase letter
|
|
1127
|
+
* - Contains at least one number
|
|
1128
|
+
* - Contains at least one special character
|
|
1129
|
+
* - Not a common password
|
|
1130
|
+
*/
|
|
1131
|
+
declare function isStrongPassword(password: string): boolean;
|
|
1132
|
+
|
|
488
1133
|
/**
|
|
489
1134
|
* Web3 Passkey SDK
|
|
490
1135
|
* Passwordless authentication with encrypted wallets
|
|
@@ -492,4 +1137,4 @@ declare function deriveWalletFromMnemonic(mnemonic: string, index?: number): {
|
|
|
492
1137
|
|
|
493
1138
|
declare function createWeb3Passkey(config?: Web3PasskeyConfig): Web3Passkey;
|
|
494
1139
|
|
|
495
|
-
export { ApiError, AuthenticationError, CryptoError, RegistrationError, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type UserInfo, WalletError, type WalletInfo, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, canControlStealthAddress, checkStealthAddress, computeStealthPrivateKey, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveStealthKeys, deriveWalletFromMnemonic, generateBIP39Wallet, generateStealthAddress };
|
|
1140
|
+
export { ApiError, AuthenticationError, BackupManager, type BackupStatus, BackupStorage, CryptoError, type DeviceInfo, DeviceManager, type EncryptedBackupInfo, type Guardian, type GuardianInvite, PlatformDetector, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SimulationResult, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, type SyncCapabilities, type SyncStatus, type SyncVault, type UserInfo, VaultSync, WalletError, type WalletInfo, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, type ZipBackupOptions, assertEthereumAddress, assertMnemonic, assertUsername, canControlStealthAddress, checkStealthAddress, computeStealthPrivateKey, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveStealthKeys, deriveWalletFromMnemonic, generateBIP39Wallet, generateStealthAddress, getAllTopics, getExplainer, isStrongPassword, searchExplainers, validateEthereumAddress, validateMnemonic, validateUsername };
|