Merge pull request #1388 from jolestar/patch-1
fix bug:ECPair.verify should return boolean
This commit is contained in:
commit
4e7e364092
2 changed files with 4 additions and 4 deletions
|
@ -26,7 +26,7 @@ export interface ECPairInterface {
|
|||
publicKey?: Buffer;
|
||||
toWIF(): string;
|
||||
sign(hash: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): boolean;
|
||||
getPublicKey?(): Buffer;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class ECPair implements ECPairInterface {
|
|||
return ecc.sign(hash, this.__D);
|
||||
}
|
||||
|
||||
verify(hash: Buffer, signature: Buffer): Buffer {
|
||||
verify(hash: Buffer, signature: Buffer): boolean {
|
||||
return ecc.verify(hash, this.publicKey, signature);
|
||||
}
|
||||
}
|
||||
|
|
4
types/ecpair.d.ts
vendored
4
types/ecpair.d.ts
vendored
|
@ -12,7 +12,7 @@ export interface ECPairInterface {
|
|||
publicKey?: Buffer;
|
||||
toWIF(): string;
|
||||
sign(hash: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): boolean;
|
||||
getPublicKey?(): Buffer;
|
||||
}
|
||||
declare class ECPair implements ECPairInterface {
|
||||
|
@ -25,7 +25,7 @@ declare class ECPair implements ECPairInterface {
|
|||
readonly publicKey: Buffer | undefined;
|
||||
toWIF(): string;
|
||||
sign(hash: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): boolean;
|
||||
}
|
||||
declare function fromPrivateKey(buffer: Buffer, options?: ECPairOptions): ECPair;
|
||||
declare function fromPublicKey(buffer: Buffer, options?: ECPairOptions): ECPair;
|
||||
|
|
Loading…
Add table
Reference in a new issue