bitcoinjs-lib/types/ecpair.d.ts
jolestar 67aa87e28d
fix bug:ECPair.verify should return boolean
fECPair.verify should return boolean, and js implements indeed return boolean.
2019-04-23 13:55:51 +08:00

34 lines
1.2 KiB
TypeScript

/// <reference types="node" />
import { Network } from './networks';
interface ECPairOptions {
compressed?: boolean;
network?: Network;
rng?(arg0: number): Buffer;
}
export interface ECPairInterface {
compressed: boolean;
network: Network;
privateKey?: Buffer;
publicKey?: Buffer;
toWIF(): string;
sign(hash: Buffer): Buffer;
verify(hash: Buffer, signature: Buffer): boolean;
getPublicKey?(): Buffer;
}
declare class ECPair implements ECPairInterface {
private __D?;
private __Q?;
compressed: boolean;
network: Network;
constructor(__D?: Buffer | undefined, __Q?: Buffer | undefined, options?: ECPairOptions);
readonly privateKey: Buffer | undefined;
readonly publicKey: Buffer | undefined;
toWIF(): string;
sign(hash: Buffer): Buffer;
verify(hash: Buffer, signature: Buffer): boolean;
}
declare function fromPrivateKey(buffer: Buffer, options?: ECPairOptions): ECPair;
declare function fromPublicKey(buffer: Buffer, options?: ECPairOptions): ECPair;
declare function fromWIF(wifString: string, network?: Network | Network[]): ECPair;
declare function makeRandom(options?: ECPairOptions): ECPair;
export { makeRandom, fromPrivateKey, fromPublicKey, fromWIF };