Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 95 additions & 96 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"bech32": "^1.1.4",
"bip174": "^2.1.0",
"bip32": "^2.0.6",
"bip32": "^5.0.0",
"bip66": "^1.1.0",
"bs58check": "^2.0.0",
"create-hash": "^1.1.0",
Expand All @@ -59,7 +59,7 @@
"pushdata-bitcoin": "^1.0.1",
"randombytes": "^2.0.1",
"tapyrus-ops": "^0.1.0",
"tiny-secp256k1": "^1.1.6",
"tiny-secp256k1": "^2.2.4",
"typeforce": "^1.11.3",
"varuint-bitcoin": "^1.1.2",
"wif": "^2.0.1"
Expand Down
12 changes: 7 additions & 5 deletions src/ecpair.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ class ECPair {
this.compressed =
options.compressed === undefined ? true : options.compressed;
this.network = options.network || NETWORKS.prod;
if (__Q !== undefined) this.__Q = ecc.pointCompress(__Q, this.compressed);
if (__Q !== undefined)
this.__Q = Buffer.from(ecc.pointCompress(__Q, this.compressed));
}
get privateKey() {
return this.__D;
}
get publicKey() {
if (!this.__Q) this.__Q = ecc.pointFromScalar(this.__D, this.compressed);
if (!this.__Q)
this.__Q = Buffer.from(ecc.pointFromScalar(this.__D, this.compressed));
return this.__Q;
}
toWIF() {
Expand All @@ -42,7 +44,7 @@ class ECPair {
if (!this.__D) throw new Error('Missing private key');
if (lowR === undefined) lowR = this.lowR;
if (lowR === false) {
return ecc.sign(hash, this.__D);
return Buffer.from(ecc.sign(hash, this.__D));
} else {
let sig = ecc.sign(hash, this.__D);
const extraData = Buffer.alloc(32, 0);
Expand All @@ -52,9 +54,9 @@ class ECPair {
while (sig[0] > 0x7f) {
counter++;
extraData.writeUIntLE(counter, 0, 6);
sig = ecc.signWithEntropy(hash, this.__D, extraData);
sig = ecc.sign(hash, this.__D, extraData);
}
return sig;
return Buffer.from(sig);
}
}
verify(hash, signature) {
Expand Down
Loading