60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
/** Network-specific versioning. */
|
|
export interface Versions {
|
|
private: number;
|
|
public: number;
|
|
}
|
|
/** Hardened offset from Bitcoin, default */
|
|
export declare const HARDENED_OFFSET: number;
|
|
interface HDKeyOpt {
|
|
versions?: Versions;
|
|
depth?: number;
|
|
index?: number;
|
|
parentFingerprint?: number;
|
|
chainCode?: Uint8Array;
|
|
publicKey?: Uint8Array;
|
|
privateKey?: Uint8Array;
|
|
}
|
|
/**
|
|
* HDKey from BIP32
|
|
* @example
|
|
```js
|
|
const hdkey1 = HDKey.fromMasterSeed(seed);
|
|
const hdkey2 = HDKey.fromExtendedKey(base58key);
|
|
const hdkey3 = HDKey.fromJSON({ xpriv: string });
|
|
```
|
|
*/
|
|
export declare class HDKey {
|
|
get fingerprint(): number;
|
|
get identifier(): Uint8Array | undefined;
|
|
get pubKeyHash(): Uint8Array | undefined;
|
|
get privateKey(): Uint8Array | null;
|
|
get publicKey(): Uint8Array | null;
|
|
get privateExtendedKey(): string;
|
|
get publicExtendedKey(): string;
|
|
static fromMasterSeed(seed: Uint8Array, versions?: Versions): HDKey;
|
|
static fromExtendedKey(base58key: string, versions?: Versions): HDKey;
|
|
static fromJSON(json: {
|
|
xpriv: string;
|
|
}): HDKey;
|
|
readonly versions: Versions;
|
|
readonly depth: number;
|
|
readonly index: number;
|
|
readonly chainCode: Uint8Array | null;
|
|
readonly parentFingerprint: number;
|
|
private _privateKey?;
|
|
private _publicKey?;
|
|
private pubHash;
|
|
constructor(opt: HDKeyOpt);
|
|
derive(path: string): HDKey;
|
|
deriveChild(index: number): HDKey;
|
|
sign(hash: Uint8Array): Uint8Array;
|
|
verify(hash: Uint8Array, signature: Uint8Array): boolean;
|
|
wipePrivateData(): this;
|
|
toJSON(): {
|
|
xpriv: string;
|
|
xpub: string;
|
|
};
|
|
private serialize;
|
|
}
|
|
export {};
|
|
//# sourceMappingURL=index.d.ts.map
|