Skip to content

Commit

Permalink
rm comments about using bitcore lib ECDSA instead of secp256k1
Browse files Browse the repository at this point in the history
  • Loading branch information
kajoseph committed Dec 19, 2024
1 parent bb1324f commit 59b66e1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/bitcore-node/src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function verifyRequestSignature(params: VerificationPayload): boolean {
const pub = new bitcoreLib.PublicKey(pubKey).toBuffer();
const messageHash = bitcoreLib.crypto.Hash.sha256sha256(Buffer.from(message));
if (typeof signature === 'string') {
// TODO we should use bitcoreLib.crypto.ECDSA.verify() instead of external dependency.
return secp256k1.ecdsaVerify(Buffer.from(signature, 'hex'), messageHash, pub);
} else {
throw new Error('Signature must exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ export class Client {
const message = this.getMessage(params);
const privateKey = this.authKey.bn.toBuffer({ size: 32 });
const messageHash = bitcoreLib.crypto.Hash.sha256sha256(Buffer.from(message));

// TODO: Should use bitcore-lib instead of an external dependency. Will want to add tests.
// const privateKey = bitcoreLib.PrivateKey.fromBuffer(this.authKey.bn.toBuffer({ size: 32 }));
// const sig = bitcoreLib.crypto.ECDSA.sign(messageHash, privateKey);
// return Buffer.concat([ sig.r.toBuffer(), sig.s.toBuffer() ]);
return Buffer.from(secp256k1.ecdsaSign(messageHash, privateKey).signature).toString('hex');
}

Expand Down

0 comments on commit 59b66e1

Please sign in to comment.