From 01014270245ffff6f14c6d7a2cb501422643f109 Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Tue, 10 Feb 2015 16:52:38 +0300 Subject: [PATCH] Pass `null` instead of `undefined` on `.verify` --- README.md | 2 +- browser.js | 2 +- index.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aaea823..7694193 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ eccrypto.encrypt(publicKeyA, Buffer("msg to a")).then(function(encrypted) { eccrypto - JavaScript Elliptic curve cryptography library -Written in 2014 by Kagami Hiiragi +Written in 2014-2015 by Kagami Hiiragi To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. diff --git a/browser.js b/browser.js index 302b6be..045d523 100644 --- a/browser.js +++ b/browser.js @@ -91,7 +91,7 @@ exports.verify = function(publicKey, msg, sig) { assert(msg.length > 0, "Message should not be empty"); assert(msg.length <= 32, "Message is too long"); if (ec.verify(msg, sig, publicKey)) { - resolve(); + resolve(null); } else { reject(new Error("Bad signature")); } diff --git a/index.js b/index.js index cb128d8..fa0f728 100644 --- a/index.js +++ b/index.js @@ -82,15 +82,15 @@ exports.sign = function(privateKey, msg) { * @param {Buffer} publicKey - A 65-byte public key * @param {Buffer} msg - The message being verified * @param {Buffer} sig - The signature - * @return {Promise.} A promise that resolves on correct - * signature and rejects on bad key or signature. + * @return {Promise.} A promise that resolves on correct signature + * and rejects on bad key or signature. */ exports.verify = function(publicKey, msg, sig) { return new promise(function(resolve, reject) { assert(msg.length > 0, "Message should not be empty"); assert(msg.length <= 32, "Message is too long"); if (secp256k1.verify(publicKey, msg, sig) === 1) { - resolve(); + resolve(null); } else { reject(new Error("Bad signature")); }