Merge branch 'master' into lowR

This commit is contained in:
junderw 2019-05-21 11:14:10 +09:00
commit 6c3e30e948
No known key found for this signature in database
GPG key ID: B256185D3A971908
4 changed files with 316 additions and 152 deletions

452
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "bitcoinjs-lib", "name": "bitcoinjs-lib",
"version": "5.0.2", "version": "5.0.3",
"description": "Client-side Bitcoin JavaScript library", "description": "Client-side Bitcoin JavaScript library",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
@ -15,7 +15,8 @@
"bitcoinjs" "bitcoinjs"
], ],
"scripts": { "scripts": {
"build": "tsc -p ./tsconfig.json", "build": "npm run clean && tsc -p ./tsconfig.json",
"clean": "rimraf src",
"coverage-report": "npm run build && npm run nobuild:coverage-report", "coverage-report": "npm run build && npm run nobuild:coverage-report",
"coverage-html": "npm run build && npm run nobuild:coverage-html", "coverage-html": "npm run build && npm run nobuild:coverage-html",
"coverage": "npm run build && npm run nobuild:coverage", "coverage": "npm run build && npm run nobuild:coverage",
@ -53,7 +54,7 @@
"merkle-lib": "^2.0.10", "merkle-lib": "^2.0.10",
"pushdata-bitcoin": "^1.0.1", "pushdata-bitcoin": "^1.0.1",
"randombytes": "^2.0.1", "randombytes": "^2.0.1",
"tiny-secp256k1": "^1.1.0", "tiny-secp256k1": "^1.1.1",
"typeforce": "^1.11.3", "typeforce": "^1.11.3",
"varuint-bitcoin": "^1.0.4", "varuint-bitcoin": "^1.0.4",
"wif": "^2.0.1" "wif": "^2.0.1"
@ -71,6 +72,7 @@
"nyc": "^13.3.0", "nyc": "^13.3.0",
"prettier": "1.16.4", "prettier": "1.16.4",
"proxyquire": "^2.0.1", "proxyquire": "^2.0.1",
"rimraf": "^2.6.3",
"tslint": "5.13.1", "tslint": "5.13.1",
"typescript": "3.2.2" "typescript": "3.2.2"
}, },

View file

@ -26,7 +26,7 @@ export interface ECPairInterface {
publicKey?: Buffer; publicKey?: Buffer;
toWIF(): string; toWIF(): string;
sign(hash: Buffer, lowR?: boolean): Buffer; sign(hash: Buffer, lowR?: boolean): Buffer;
verify(hash: Buffer, signature: Buffer): Buffer; verify(hash: Buffer, signature: Buffer): boolean;
getPublicKey?(): Buffer; getPublicKey?(): Buffer;
} }
@ -80,7 +80,7 @@ class ECPair implements ECPairInterface {
} }
} }
verify(hash: Buffer, signature: Buffer): Buffer { verify(hash: Buffer, signature: Buffer): boolean {
return ecc.verify(hash, this.publicKey, signature); return ecc.verify(hash, this.publicKey, signature);
} }
} }

4
types/ecpair.d.ts vendored
View file

@ -12,7 +12,7 @@ export interface ECPairInterface {
publicKey?: Buffer; publicKey?: Buffer;
toWIF(): string; toWIF(): string;
sign(hash: Buffer, lowR?: boolean): Buffer; sign(hash: Buffer, lowR?: boolean): Buffer;
verify(hash: Buffer, signature: Buffer): Buffer; verify(hash: Buffer, signature: Buffer): boolean;
getPublicKey?(): Buffer; getPublicKey?(): Buffer;
} }
declare class ECPair implements ECPairInterface { declare class ECPair implements ECPairInterface {
@ -25,7 +25,7 @@ declare class ECPair implements ECPairInterface {
readonly publicKey: Buffer | undefined; readonly publicKey: Buffer | undefined;
toWIF(): string; toWIF(): string;
sign(hash: Buffer, lowR?: boolean): Buffer; sign(hash: Buffer, lowR?: boolean): Buffer;
verify(hash: Buffer, signature: Buffer): Buffer; verify(hash: Buffer, signature: Buffer): boolean;
} }
declare function fromPrivateKey(buffer: Buffer, options?: ECPairOptions): ECPair; declare function fromPrivateKey(buffer: Buffer, options?: ECPairOptions): ECPair;
declare function fromPublicKey(buffer: Buffer, options?: ECPairOptions): ECPair; declare function fromPublicKey(buffer: Buffer, options?: ECPairOptions): ECPair;