-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathbip32.d.ts
More file actions
62 lines (62 loc) · 2.29 KB
/
bip32.d.ts
File metadata and controls
62 lines (62 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// <reference types="node" />
interface Network {
wif: number;
bip32: {
public: number;
private: number;
};
messagePrefix?: string;
bech32?: string;
pubKeyHash?: number;
scriptHash?: number;
}
export interface Signer {
publicKey: Buffer;
lowR: boolean;
sign(hash: Buffer, lowR?: boolean): Buffer;
verify(hash: Buffer, signature: Buffer): boolean;
signSchnorr(hash: Buffer): Buffer;
verifySchnorr(hash: Buffer, signature: Buffer): boolean;
}
export interface BIP32Interface extends Signer {
chainCode: Buffer;
network: Network;
depth: number;
index: number;
parentFingerprint: number;
privateKey?: Buffer;
identifier: Buffer;
fingerprint: Buffer;
isNeutered(): boolean;
neutered(): BIP32Interface;
toBase58(): string;
derive(index: number): BIP32Interface;
deriveHardened(index: number): BIP32Interface;
derivePath(path: string): BIP32Interface;
tweak(t: Buffer): Signer;
}
export interface BIP32API {
fromSeed(seed: Buffer, network?: Network): BIP32Interface;
fromBase58(inString: string, network?: Network): BIP32Interface;
fromPublicKey(publicKey: Buffer, chainCode: Buffer, network?: Network): BIP32Interface;
fromPrivateKey(privateKey: Buffer, chainCode: Buffer, network?: Network): BIP32Interface;
}
interface XOnlyPointAddTweakResult {
parity: 1 | 0;
xOnlyPubkey: Uint8Array;
}
export interface TinySecp256k1Interface {
isPoint(p: Uint8Array): boolean;
isPrivate(d: Uint8Array): boolean;
pointFromScalar(d: Uint8Array, compressed?: boolean): Uint8Array | null;
pointAddScalar(p: Uint8Array, tweak: Uint8Array, compressed?: boolean): Uint8Array | null;
privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
sign(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
signSchnorr?(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
verify(h: Uint8Array, Q: Uint8Array, signature: Uint8Array, strict?: boolean): boolean;
verifySchnorr?(h: Uint8Array, Q: Uint8Array, signature: Uint8Array): boolean;
xOnlyPointAddTweak?(p: Uint8Array, tweak: Uint8Array): XOnlyPointAddTweakResult | null;
privateNegate?(d: Uint8Array): Uint8Array;
}
export declare function BIP32Factory(ecc: TinySecp256k1Interface): BIP32API;
export {};