From eabb541b9567341eb8c47535438acaef68af162e Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Tue, 6 Jan 2015 02:49:32 +0300 Subject: [PATCH] Do not use assert module --- browser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/browser.js b/browser.js index 7886210..e752ced 100644 --- a/browser.js +++ b/browser.js @@ -5,16 +5,17 @@ "use strict"; require("es6-promise").polyfill(); -var assert = require("assert"); var EC = require("elliptic").ec; var ec = new EC("secp256k1"); exports.getPublic = function(privateKey) { - // `elliptic` doesn't have such checkings so we do it ourself. We + // `elliptic` doesn't have such checkings so we do it by ourself. We // should always ensure that library user doesn't try to do something // dumb. - assert(privateKey.length === 32, "Bad private key"); + if (privateKey.length !== 32) { + throw new Error("Bad private key"); + } // XXX(Kagami): `elliptic.utils.encode` returns array for every // encoding except `hex`. return new Buffer(ec.keyPair(privateKey).getPublic("arr"));