Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "wif", | ||
"version": "2.0.1", | ||
"description": "Bitcoin Wallet Import Format (WIF) encoding module", | ||
"version": "2.0.2", | ||
"description": "Bitcoin Wallet Import Format (WIF) decoding/encoding module", | ||
"author": "Daniel Cousens", | ||
@@ -19,3 +19,8 @@ "license": "MIT", | ||
"base58check", | ||
"decode", | ||
"decoding", | ||
"encoding", | ||
"encode", | ||
"key", | ||
"private", | ||
"wif" | ||
@@ -25,22 +30,8 @@ ], | ||
"scripts": { | ||
"coverage": "mocha --require blanket -R travis-cov", | ||
"coverage-local": "mocha --require blanket -R html-cov", | ||
"coverage-report": "nyc report --reporter=lcov", | ||
"coverage": "nyc --check-coverage --branches 90 --functions 90 npm run unit", | ||
"standard": "standard", | ||
"test": "npm run standard && npm run unit", | ||
"unit": "mocha" | ||
"test": "npm run standard && npm run coverage", | ||
"unit": "tape test/*.js" | ||
}, | ||
"config": { | ||
"blanket": { | ||
"pattern": [ | ||
"" | ||
], | ||
"data-cover-never": [ | ||
"node_modules", | ||
"test" | ||
] | ||
}, | ||
"travis-cov": { | ||
"threshold": 100 | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -50,7 +41,6 @@ "bs58check": "^1.0.6" | ||
"devDependencies": { | ||
"blanket": "*", | ||
"mocha": "*", | ||
"nyc": "^6.4.0", | ||
"standard": "*", | ||
"travis-cov": "*" | ||
"tape": "^4.6.2" | ||
} | ||
} |
@@ -1,47 +0,42 @@ | ||
/* global describe, it */ | ||
var assert = require('assert') | ||
var wif = require('../') | ||
var fixtures = require('./fixtures') | ||
var tape = require('tape') | ||
describe('WIF', function () { | ||
describe('encode/encodeRaw', function () { | ||
fixtures.valid.forEach(function (f) { | ||
it('returns ' + f.WIF + ' for ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')', function () { | ||
var privateKey = new Buffer(f.privateKeyHex, 'hex') | ||
var actual = wif.encode(f.version, privateKey, f.compressed) | ||
fixtures.valid.forEach(function (f) { | ||
tape('encode/encodeRaw returns ' + f.WIF + ' for ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')', function (t) { | ||
t.plan(1) | ||
assert.strictEqual(actual, f.WIF) | ||
}) | ||
}) | ||
var privateKey = new Buffer(f.privateKeyHex, 'hex') | ||
var actual = wif.encode(f.version, privateKey, f.compressed) | ||
t.equal(actual, f.WIF) | ||
}) | ||
}) | ||
describe('decode/decodeRaw', function () { | ||
fixtures.valid.forEach(function (f) { | ||
it('returns ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')' + ' for ' + f.WIF, function () { | ||
var actual = wif.decode(f.WIF, f.version) | ||
fixtures.valid.forEach(function (f) { | ||
tape('decode/decodeRaw returns ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')' + ' for ' + f.WIF, function (t) { | ||
t.plan(3) | ||
assert.strictEqual(actual.version, f.version) | ||
assert.strictEqual(actual.privateKey.toString('hex'), f.privateKeyHex) | ||
assert.strictEqual(actual.compressed, f.compressed) | ||
}) | ||
}) | ||
var actual = wif.decode(f.WIF, f.version) | ||
t.equal(actual.version, f.version) | ||
t.equal(actual.privateKey.toString('hex'), f.privateKeyHex) | ||
t.equal(actual.compressed, f.compressed) | ||
}) | ||
}) | ||
fixtures.invalid.decode.forEach(function (f) { | ||
it('throws ' + f.exception + ' for ' + f.WIF, function () { | ||
assert.throws(function () { | ||
wif.decode(f.WIF, f.version) | ||
}, new RegExp(f.exception)) | ||
}) | ||
}) | ||
fixtures.invalid.decode.forEach(function (f) { | ||
tape('throws ' + f.exception + ' for ' + f.WIF, function (t) { | ||
t.plan(1) | ||
t.throws(function () { | ||
wif.decode(f.WIF, f.version) | ||
}, new RegExp(f.exception)) | ||
}) | ||
}) | ||
describe('decode/encode', function () { | ||
fixtures.valid.forEach(function (f) { | ||
it(f.WIF, function () { | ||
var actual = wif.encode(wif.decode(f.WIF, f.version)) | ||
assert.strictEqual(actual, f.WIF) | ||
}) | ||
}) | ||
fixtures.valid.forEach(function (f) { | ||
tape('decode/encode for ' + f.WIF, function (t) { | ||
t.plan(1) | ||
var actual = wif.encode(wif.decode(f.WIF, f.version)) | ||
t.equal(actual, f.WIF) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12257
3
9
161