From bfd1692cfd8e038abd985824b595ef202bab1068 Mon Sep 17 00:00:00 2001 From: Nodar Chkuaselidze Date: Tue, 25 Jun 2019 22:29:38 +0400 Subject: [PATCH] pkg: update bcrypto. --- .circleci/config.yml | 2 +- lib/http.js | 2 +- lib/utils/sig.js | 4 ++-- package-lock.json | 29 ++++++----------------------- package.json | 3 +-- test/cosigner-test.js | 2 +- 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f1fd86..38a41ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: # fallback to using the latest cache if no exact match is found - v2-dependencies- - run: npm install - - run: npm install eslint nyc codecov + - run: npm install bslint nyc codecov - save_cache: paths: - node_modules diff --git a/lib/http.js b/lib/http.js index 580fb4b..624d6af 100644 --- a/lib/http.js +++ b/lib/http.js @@ -12,7 +12,7 @@ const {Script, Address, Network} = bcoin; const HDPublicKey = bcoin.hd.HDPublicKey; const Validator = require('bval'); const Logger = require('blgr'); -const {base58} = require('bstring'); +const base58 = require('bcrypto/lib/encoding/base58'); const sha256 = require('bcrypto/lib/sha256'); const random = require('bcrypto/lib/random'); const {safeEqual} = require('bcrypto/lib/safe'); diff --git a/lib/utils/sig.js b/lib/utils/sig.js index 397b0e8..47a139c 100644 --- a/lib/utils/sig.js +++ b/lib/utils/sig.js @@ -97,10 +97,10 @@ sigutils.verifyMessage = function verifyMessage(message, signature, publicKey) { */ sigutils.signHash = function signHash(hash, privateKey) { - const { + const [ signature, recovery - } = secp256k1.signRecoverable(hash, privateKey); + ] = secp256k1.signRecoverable(hash, privateKey); return sigutils.encodeSignature(signature, recovery); }; diff --git a/package-lock.json b/package-lock.json index fcd9028..159f774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -132,9 +132,9 @@ } }, "bcrypto": { - "version": "3.1.9", - "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-3.1.9.tgz", - "integrity": "sha512-/uer3D8sJe3OgqfvKvMaqmKnOwmf8UoDQHapBK2DACHGvo/kBSCxHYWd5JFnvViu1BRpgNxbMv/TCuIZLxW9Zg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-4.0.1.tgz", + "integrity": "sha512-aLH/BmVyasy9iQkrmQTg+9MRU+77zOpEBiBflaXFC4YQJNICG/NjkEEluinnvAOQWGiM4HsGcfrVFJNJQz8jxQ==", "requires": { "bsert": "~0.0.10", "bufio": "~1.0.6", @@ -143,9 +143,9 @@ }, "dependencies": { "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, @@ -378,23 +378,6 @@ "bsert": "~0.0.5" } }, - "bstring": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/bstring/-/bstring-0.3.9.tgz", - "integrity": "sha512-D95flI7SXL+UsQi9mW+hH+AK2AFfafIJi+3GbbyTAWMe2FqwR9keBxsjGiGd/JM+77Y9WsC+M4EhZVNVcym9jw==", - "requires": { - "bsert": "~0.0.10", - "loady": "~0.0.1", - "nan": "^2.13.1" - }, - "dependencies": { - "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" - } - } - }, "btcp": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/btcp/-/btcp-0.1.3.tgz", diff --git a/package.json b/package.json index 925f2c0..e4ff143 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,12 @@ "dependencies": { "bclient": "^0.1.7", "bcoin": "~1.0.2", - "bcrypto": "~3.1.9", + "bcrypto": "~4.0.1", "bdb": "~1.1.7", "bevent": "~0.1.5", "blgr": "~0.1.7", "bmutex": "~0.1.6", "bsert": "0.0.10", - "bstring": "^0.3.9", "buffer-map": "0.0.7", "bufio": "^1.0.6", "bval": "^0.1.6", diff --git a/test/cosigner-test.js b/test/cosigner-test.js index 0dc414f..28a56c9 100644 --- a/test/cosigner-test.js +++ b/test/cosigner-test.js @@ -10,7 +10,7 @@ const {hd} = require('bcoin'); const secp256k1 = require('bcrypto/lib/secp256k1'); const sigUtils = require('../lib/utils/sig'); -const privKey = secp256k1.generatePrivateKey(); +const privKey = secp256k1.privateKeyGenerate(); // commonly used test case const NETWORK = 'main';