2019-01-04 10:33:02 +01:00
|
|
|
/// <reference types="node" />
|
|
|
|
import { Network } from './networks';
|
|
|
|
interface ECPairOptions {
|
|
|
|
compressed?: boolean;
|
|
|
|
network?: Network;
|
2019-04-11 08:55:33 +02:00
|
|
|
rng?(arg0: number): Buffer;
|
2019-01-04 10:33:02 +01:00
|
|
|
}
|
2019-06-14 08:25:07 +02:00
|
|
|
export interface Signer {
|
|
|
|
publicKey: Buffer;
|
|
|
|
network?: Network;
|
|
|
|
sign(hash: Buffer, lowR?: boolean): Buffer;
|
|
|
|
getPublicKey?(): Buffer;
|
|
|
|
}
|
|
|
|
export interface SignerAsync {
|
|
|
|
publicKey: Buffer;
|
|
|
|
network?: Network;
|
|
|
|
sign(hash: Buffer, lowR?: boolean): Promise<Buffer>;
|
|
|
|
getPublicKey?(): Buffer;
|
|
|
|
}
|
|
|
|
export interface ECPairInterface extends Signer {
|
2019-01-04 10:33:02 +01:00
|
|
|
compressed: boolean;
|
|
|
|
network: Network;
|
|
|
|
privateKey?: Buffer;
|
|
|
|
toWIF(): string;
|
2019-04-23 07:55:51 +02:00
|
|
|
verify(hash: Buffer, signature: Buffer): boolean;
|
2019-01-04 10:33:02 +01:00
|
|
|
}
|
|
|
|
declare class ECPair implements ECPairInterface {
|
2019-03-07 04:06:12 +01:00
|
|
|
private __D?;
|
2019-01-04 10:33:02 +01:00
|
|
|
private __Q?;
|
2019-03-20 07:25:48 +01:00
|
|
|
compressed: boolean;
|
|
|
|
network: Network;
|
|
|
|
constructor(__D?: Buffer | undefined, __Q?: Buffer | undefined, options?: ECPairOptions);
|
2019-01-04 10:33:02 +01:00
|
|
|
readonly privateKey: Buffer | undefined;
|
2019-05-16 09:29:23 +02:00
|
|
|
readonly publicKey: Buffer;
|
2019-01-04 10:33:02 +01:00
|
|
|
toWIF(): string;
|
2019-04-12 10:44:55 +02:00
|
|
|
sign(hash: Buffer, lowR?: boolean): Buffer;
|
2019-04-23 07:55:51 +02:00
|
|
|
verify(hash: Buffer, signature: Buffer): boolean;
|
2019-01-04 10:33:02 +01:00
|
|
|
}
|
|
|
|
declare function fromPrivateKey(buffer: Buffer, options?: ECPairOptions): ECPair;
|
|
|
|
declare function fromPublicKey(buffer: Buffer, options?: ECPairOptions): ECPair;
|
2019-03-07 04:06:12 +01:00
|
|
|
declare function fromWIF(wifString: string, network?: Network | Network[]): ECPair;
|
2019-01-04 10:33:02 +01:00
|
|
|
declare function makeRandom(options?: ECPairOptions): ECPair;
|
|
|
|
export { makeRandom, fromPrivateKey, fromPublicKey, fromWIF };
|