@btc-vision/wallet-sdk 2.0.14 → 2.2.0-beta.0

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.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { AddressTypes } from '@btc-vision/transaction';
2
- import * as bitcoin from '@btc-vision/bitcoin';
3
- import { ECPairInterface } from 'ecpair';
4
2
  import { MLDSASecurityLevel } from '@btc-vision/transaction';
5
3
  import { MnemonicStrength } from '@btc-vision/transaction';
6
4
  import { Network } from '@btc-vision/bitcoin';
5
+ import { NobleBackend } from '@btc-vision/ecpair';
6
+ import { Payment } from '@btc-vision/bitcoin';
7
7
  import { Psbt } from '@btc-vision/bitcoin';
8
8
  import { QuantumBIP32Factory } from '@btc-vision/transaction';
9
9
  import { QuantumBIP32Interface } from '@btc-vision/transaction';
10
+ import { UniversalSigner } from '@btc-vision/ecpair';
10
11
  import { Wallet } from '@btc-vision/transaction';
11
12
  import { WalletNetworks } from '@btc-vision/transaction';
12
13
 
@@ -15,7 +16,7 @@ import { WalletNetworks } from '@btc-vision/transaction';
15
16
  */
16
17
  export declare interface AbstractWallet {
17
18
  signPsbt(psbt: Psbt, opts?: SignPsbtOptions): Promise<Psbt> | Psbt;
18
- signMessage(message: string | Buffer, method: MessageSigningMethod): Promise<string>;
19
+ signMessage(message: string | Uint8Array, method: MessageSigningMethod): Promise<string>;
19
20
  }
20
21
 
21
22
  /**
@@ -48,7 +49,7 @@ export declare interface AddressSignInput extends BaseSignInput {
48
49
  /**
49
50
  * Convert an address to its scriptPubKey
50
51
  */
51
- export declare function addressToScriptPubKey(address: string, network: Network): Buffer;
52
+ export declare function addressToScriptPubKey(address: string, network: Network): Uint8Array;
52
53
 
53
54
  /**
54
55
  * Base interface for inputs to sign in a PSBT
@@ -64,7 +65,7 @@ export declare interface BaseSignInput {
64
65
  */
65
66
  export declare interface Bip322Signature {
66
67
  readonly address: string;
67
- readonly message: string | Buffer;
68
+ readonly message: string | Uint8Array;
68
69
  readonly signature: string;
69
70
  readonly networkType: WalletNetworks;
70
71
  }
@@ -73,8 +74,8 @@ export declare interface Bip322Signature {
73
74
  * Classical key pair information
74
75
  */
75
76
  export declare interface ClassicalKeyInfo {
76
- readonly publicKey: Buffer;
77
- readonly privateKey?: Buffer;
77
+ readonly publicKey: Uint8Array;
78
+ readonly privateKey?: Uint8Array;
78
79
  }
79
80
 
80
81
  /**
@@ -88,7 +89,7 @@ export declare function decodeAddress(address: string): DecodedAddress | null;
88
89
  export declare interface DecodedAddress {
89
90
  readonly networkType: WalletNetworks;
90
91
  readonly addressType: AddressTypes;
91
- readonly scriptPubKey: Buffer;
92
+ readonly scriptPubKey: Uint8Array;
92
93
  }
93
94
 
94
95
  /**
@@ -131,12 +132,12 @@ export declare interface ExportedWallet {
131
132
  /**
132
133
  * Export wallet keys to unified format
133
134
  */
134
- export declare function exportWallet(classicalPrivateKey: Buffer, classicalPublicKey: Buffer, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Buffer, securityLevel: MLDSASecurityLevel, network: Network): UnifiedWalletExport;
135
+ export declare function exportWallet(classicalPrivateKey: Uint8Array, classicalPublicKey: Uint8Array, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Uint8Array, securityLevel: MLDSASecurityLevel, network: Network): UnifiedWalletExport;
135
136
 
136
137
  /**
137
138
  * Export wallet to portable string format
138
139
  */
139
- export declare function exportWalletToString(classicalPrivateKey: Buffer, classicalPublicKey: Buffer, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Buffer, securityLevel: MLDSASecurityLevel, network: Network): string;
140
+ export declare function exportWalletToString(classicalPrivateKey: Uint8Array, classicalPublicKey: Uint8Array, quantumPrivateKey: Uint8Array, quantumPublicKey: Uint8Array, chainCode: Uint8Array, securityLevel: MLDSASecurityLevel, network: Network): string;
140
141
 
141
142
  /**
142
143
  * Extract signature from a signed BIP322 PSBT
@@ -151,7 +152,7 @@ export declare function fromLegacyExport(legacy: ExportedWallet, network: Networ
151
152
  /**
152
153
  * Generate a PSBT for BIP322 simple message signing
153
154
  */
154
- export declare function generateBip322Psbt(message: string | Buffer, address: string, network: Network): Psbt;
155
+ export declare function generateBip322Psbt(message: string | Uint8Array, address: string, network: Network): Psbt;
155
156
 
156
157
  /**
157
158
  * Get address type with WalletNetworks parameter
@@ -163,6 +164,8 @@ export declare function getAddressType(address: string, networkType: WalletNetwo
163
164
  */
164
165
  export declare function getBech32Prefix(networkType: WalletNetworks): string;
165
166
 
167
+ export declare function getNobleBackend(): NobleBackend;
168
+
166
169
  /**
167
170
  * HD Keyring with quantum-resistant cryptography support.
168
171
  * Supports BIP39 mnemonic phrases with BIP360 quantum key derivation.
@@ -294,7 +297,7 @@ export declare class HdKeyring {
294
297
  /**
295
298
  * Get the chain code for a wallet
296
299
  */
297
- getChainCode(publicKey: string): Buffer;
300
+ getChainCode(publicKey: string): Uint8Array;
298
301
  /**
299
302
  * Get ML-DSA keypair for quantum operations
300
303
  */
@@ -324,22 +327,22 @@ export declare interface HdKeyringOptions {
324
327
  * Import wallet keys from unified format
325
328
  */
326
329
  export declare function importWallet(exportData: UnifiedWalletExport): {
327
- keypair: ECPairInterface;
330
+ keypair: UniversalSigner;
328
331
  quantumKeypair: ReturnType<typeof QuantumBIP32Factory.fromPrivateKey>;
329
332
  network: Network;
330
333
  securityLevel: MLDSASecurityLevel;
331
- chainCode: Buffer;
334
+ chainCode: Uint8Array;
332
335
  };
333
336
 
334
337
  /**
335
338
  * Import wallet from portable string format
336
339
  */
337
340
  export declare function importWalletFromString(serialized: string): {
338
- keypair: ECPairInterface;
341
+ keypair: UniversalSigner;
339
342
  quantumKeypair: ReturnType<typeof QuantumBIP32Factory.fromPrivateKey>;
340
343
  network: Network;
341
344
  securityLevel: MLDSASecurityLevel;
342
- chainCode: Buffer;
345
+ chainCode: Uint8Array;
343
346
  };
344
347
 
345
348
  /**
@@ -380,7 +383,7 @@ export declare function isValidP2TRAddress(address: string, network: Network): b
380
383
  /**
381
384
  * Validate a public key using AddressVerificator
382
385
  */
383
- export declare function isValidPublicKey(publicKey: Buffer | string, network: Network): boolean;
386
+ export declare function isValidPublicKey(publicKey: Uint8Array | string, network: Network): boolean;
384
387
 
385
388
  /**
386
389
  * Keyring serialization options
@@ -461,7 +464,7 @@ export declare class LocalWallet implements AbstractWallet {
461
464
  /**
462
465
  * Sign a message
463
466
  */
464
- signMessage(message: string | Buffer, method: MessageSigningMethod): Promise<string>;
467
+ signMessage(message: string | Uint8Array, method: MessageSigningMethod): Promise<string>;
465
468
  /**
466
469
  * Sign raw data
467
470
  */
@@ -481,7 +484,7 @@ export declare class LocalWallet implements AbstractWallet {
481
484
  /**
482
485
  * Export the chain code
483
486
  */
484
- exportChainCode(): Buffer;
487
+ exportChainCode(): Uint8Array;
485
488
  /**
486
489
  * Export WIF
487
490
  */
@@ -492,9 +495,9 @@ export declare class LocalWallet implements AbstractWallet {
492
495
  }
493
496
 
494
497
  /**
495
- * Message input type - can be string, Buffer, or Uint8Array
498
+ * Message input type - can be string or Uint8Array
496
499
  */
497
- export declare type MessageInput = string | Buffer | Uint8Array;
500
+ export declare type MessageInput = string | Uint8Array;
498
501
 
499
502
  /**
500
503
  * Message signing method types
@@ -531,22 +534,22 @@ export declare interface PublicKeySignInput extends BaseSignInput {
531
534
  /**
532
535
  * Generate a Bitcoin address from a public key
533
536
  */
534
- export declare function publicKeyToAddress(publicKey: Buffer | string, addressType: AddressTypes, network: Network): string;
537
+ export declare function publicKeyToAddress(publicKey: Uint8Array | string, addressType: AddressTypes, network: Network): string;
535
538
 
536
539
  /**
537
540
  * Convert WalletNetworks-based operations to Network-based
538
541
  */
539
- export declare function publicKeyToAddressWithNetworkType(publicKey: Buffer | string, addressType: AddressTypes, networkType: WalletNetworks): string;
542
+ export declare function publicKeyToAddressWithNetworkType(publicKey: Uint8Array | string, addressType: AddressTypes, networkType: WalletNetworks): string;
540
543
 
541
544
  /**
542
545
  * Generate a payment object from a public key
543
546
  */
544
- export declare function publicKeyToPayment(publicKey: Buffer | string, addressType: AddressTypes, network: Network): bitcoin.Payment;
547
+ export declare function publicKeyToPayment(publicKey: Uint8Array | string, addressType: AddressTypes, network: Network): Payment;
545
548
 
546
549
  /**
547
550
  * Generate scriptPubKey from a public key
548
551
  */
549
- export declare function publicKeyToScriptPubKey(publicKey: Buffer | string, addressType: AddressTypes, network: Network): Buffer;
552
+ export declare function publicKeyToScriptPubKey(publicKey: Uint8Array | string, addressType: AddressTypes, network: Network): Uint8Array;
550
553
 
551
554
  /**
552
555
  * Quantum key pair information
@@ -568,7 +571,7 @@ export declare interface SchnorrSignatureResult {
568
571
  /**
569
572
  * Convert scriptPubKey to an address
570
573
  */
571
- export declare function scriptPubKeyToAddress(scriptPubKey: Buffer | string, network: Network): string;
574
+ export declare function scriptPubKeyToAddress(scriptPubKey: Uint8Array | string, network: Network): string;
572
575
 
573
576
  /**
574
577
  * Serialize unified export to string (base64 encoded JSON)
@@ -583,18 +586,18 @@ export declare type SignatureType = 'ecdsa' | 'schnorr' | 'mldsa';
583
586
  /**
584
587
  * Sign a message using BIP322 simple format
585
588
  */
586
- export declare function signBip322Message(message: string | Buffer, address: string, network: Network, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<string>;
589
+ export declare function signBip322Message(message: string | Uint8Array, address: string, network: Network, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<string>;
587
590
 
588
591
  /**
589
592
  * Sign a message using BIP322 with WalletNetworks parameter
590
593
  */
591
- export declare function signBip322MessageWithNetworkType(message: string | Buffer, address: string, networkType: WalletNetworks, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<Bip322Signature>;
594
+ export declare function signBip322MessageWithNetworkType(message: string | Uint8Array, address: string, networkType: WalletNetworks, signPsbt: (psbt: Psbt) => Promise<Psbt>): Promise<Bip322Signature>;
592
595
 
593
596
  /**
594
597
  * Message signature result
595
598
  */
596
599
  export declare interface SignedMessage {
597
- readonly message: string | Buffer;
600
+ readonly message: string | Uint8Array;
598
601
  readonly signature: Uint8Array;
599
602
  readonly publicKey: Uint8Array;
600
603
  readonly signatureType: SignatureType;
@@ -609,7 +612,7 @@ export declare type SignInput = AddressSignInput | PublicKeySignInput;
609
612
  /**
610
613
  * Sign message with automatic type selection
611
614
  */
612
- export declare function signMessage(keypair: ECPairInterface | QuantumBIP32Interface, message: MessageInput, signatureType: SignatureType): SignedMessage;
615
+ export declare function signMessage(keypair: UniversalSigner | QuantumBIP32Interface, message: MessageInput, signatureType: SignatureType): SignedMessage;
613
616
 
614
617
  /**
615
618
  * Sign a message with ML-DSA (quantum-resistant)
@@ -627,12 +630,12 @@ export declare interface SignPsbtOptions {
627
630
  /**
628
631
  * Sign a message with Schnorr (classical)
629
632
  */
630
- export declare function signSchnorr(keypair: ECPairInterface, message: MessageInput): SchnorrSignatureResult;
633
+ export declare function signSchnorr(keypair: UniversalSigner, message: MessageInput): SchnorrSignatureResult;
631
634
 
632
635
  /**
633
636
  * Sign a message with tweaked key for Taproot
634
637
  */
635
- export declare function signTweakedSchnorr(keypair: ECPairInterface, message: MessageInput, network?: Network): SchnorrSignatureResult;
638
+ export declare function signTweakedSchnorr(keypair: UniversalSigner, message: MessageInput, network?: Network): SchnorrSignatureResult;
636
639
 
637
640
  /**
638
641
  * Simple Keyring for single key pair management with quantum support.
@@ -744,7 +747,7 @@ export declare class SimpleKeyring {
744
747
  /**
745
748
  * Export the chain code (for use with Wallet.fromWif separately)
746
749
  */
747
- exportChainCode(): Buffer;
750
+ exportChainCode(): Uint8Array;
748
751
  /**
749
752
  * Export WIF format
750
753
  */
@@ -764,7 +767,7 @@ export declare class SimpleKeyring {
764
767
  /**
765
768
  * Get the keypair
766
769
  */
767
- getKeypair(): ECPairInterface;
770
+ getKeypair(): UniversalSigner;
768
771
  /**
769
772
  * Get the quantum keypair
770
773
  */
@@ -772,7 +775,7 @@ export declare class SimpleKeyring {
772
775
  /**
773
776
  * Get the chain code
774
777
  */
775
- getChainCode(): Buffer;
778
+ getChainCode(): Uint8Array;
776
779
  /**
777
780
  * Get the security level
778
781
  */
@@ -854,22 +857,22 @@ export declare function validateExport(exportData: UnifiedWalletExport): boolean
854
857
  /**
855
858
  * Verify a BIP322 simple message signature
856
859
  */
857
- export declare function verifyBip322Message(address: string, message: string | Buffer, signature: string, network: Network): boolean;
860
+ export declare function verifyBip322Message(address: string, message: string | Uint8Array, signature: string, network: Network): boolean;
858
861
 
859
862
  /**
860
863
  * Verify a BIP322 signature with WalletNetworks parameter
861
864
  */
862
- export declare function verifyBip322MessageWithNetworkType(address: string, message: string | Buffer, signature: string, networkType: WalletNetworks): boolean;
865
+ export declare function verifyBip322MessageWithNetworkType(address: string, message: string | Uint8Array, signature: string, networkType: WalletNetworks): boolean;
863
866
 
864
867
  /**
865
868
  * Verify message with automatic type detection
866
869
  */
867
- export declare function verifyMessage(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array, signatureType: SignatureType, chainCode?: Buffer, network?: Network, securityLevel?: MLDSASecurityLevel): boolean;
870
+ export declare function verifyMessage(publicKey: Uint8Array, message: MessageInput, signature: Uint8Array, signatureType: SignatureType, chainCode?: Uint8Array, network?: Network, securityLevel?: MLDSASecurityLevel): boolean;
868
871
 
869
872
  /**
870
873
  * Verify an ML-DSA signature
871
874
  */
872
- export declare function verifyMLDSA(publicKey: Uint8Array, chainCode: Buffer, network: Network, securityLevel: MLDSASecurityLevel, message: MessageInput, signature: Uint8Array): boolean;
875
+ export declare function verifyMLDSA(publicKey: Uint8Array, chainCode: Uint8Array, network: Network, securityLevel: MLDSASecurityLevel, message: MessageInput, signature: Uint8Array): boolean;
873
876
 
874
877
  /**
875
878
  * Verify an ML-DSA signature using an existing keypair
@@ -879,12 +882,12 @@ export declare function verifyMLDSAWithKeypair(keypair: QuantumBIP32Interface, m
879
882
  /**
880
883
  * Verify a Schnorr signature
881
884
  */
882
- export declare function verifySchnorr(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
885
+ export declare function verifySchnorr(publicKey: Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
883
886
 
884
887
  /**
885
888
  * Verify a tweaked Schnorr signature
886
889
  */
887
- export declare function verifyTweakedSchnorr(publicKey: Buffer | Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
890
+ export declare function verifyTweakedSchnorr(publicKey: Uint8Array, message: MessageInput, signature: Uint8Array): boolean;
888
891
 
889
892
  /**
890
893
  * Combined wallet key information (classical + quantum)
@@ -892,7 +895,7 @@ export declare function verifyTweakedSchnorr(publicKey: Buffer | Uint8Array, mes
892
895
  export declare interface WalletKeyInfo {
893
896
  readonly classical: ClassicalKeyInfo;
894
897
  readonly quantum: QuantumKeyInfo;
895
- readonly chainCode: Buffer;
898
+ readonly chainCode: Uint8Array;
896
899
  }
897
900
 
898
901
  export { }