From 61c511b1cc6d9ed178fd917f8c7265f186a587d2 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 19 Oct 2017 11:21:19 +1100 Subject: [PATCH] add HDKey.sign/HDKey.verify methods --- lib/hdkey.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/hdkey.js b/lib/hdkey.js index 77e1a44..3c28932 100644 --- a/lib/hdkey.js +++ b/lib/hdkey.js @@ -152,6 +152,14 @@ HDKey.prototype.deriveChild = function (index) { return hd } +HDKey.prototype.sign = function (hash) { + return secp256k1.sign(hash, this.privateKey).signature +} + +HDKey.prototype.verify = function (hash, signature) { + return secp256k1.verify(hash, signature, this.publicKey) +} + HDKey.prototype.toJSON = function () { return { xpriv: this.privateExtendedKey,