Comparing version
@@ -30,6 +30,8 @@ var bs58check = require('bs58check') | ||
function encodeRaw (version, privateKey, compressed) { | ||
var result = new Buffer(compressed ? 34 : 33) | ||
if (privateKey.length !== 32) throw new TypeError('Invalid privateKey length') | ||
result.writeUInt8(version, 0) | ||
privateKey.copy(result, 1) | ||
var result = new Uint8Array(compressed ? 34 : 33) | ||
var view = new DataView(result.buffer) | ||
view.setUint8(0, version) | ||
result.set(privateKey, 1) | ||
@@ -36,0 +38,0 @@ if (compressed) { |
{ | ||
"name": "wif", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Bitcoin Wallet Import Format (WIF) decoding/encoding module", | ||
@@ -28,2 +28,5 @@ "author": "Daniel Cousens", | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"scripts": { | ||
@@ -37,9 +40,10 @@ "coverage-report": "nyc report --reporter=lcov", | ||
"dependencies": { | ||
"bs58check": "^2.0.1" | ||
"bs58check": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"nyc": "^6.4.0", | ||
"standard": "*", | ||
"tape": "^4.6.2" | ||
"nyc": "^15.0.0", | ||
"standard": "^14.3.3", | ||
"tape": "^4.13.2", | ||
"uint8array-tools": "0.0.7" | ||
} | ||
} |
# WIF | ||
[](http://travis-ci.org/bitcoinjs/wif) | ||
@@ -15,6 +14,4 @@ [](https://www.npmjs.org/package/wif) | ||
var wif = require('wif') | ||
var privateKey = new Buffer('0000000000000000000000000000000000000000000000000000000000000001', 'hex') | ||
var key = wif.encode(128, privateKey, true) | ||
var privateKey = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex') | ||
var key = wif.encode(128, privateKey, true) // for the testnet use: wif.encode(239, ... | ||
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn | ||
@@ -29,2 +26,6 @@ | ||
wif.decode(key, 0x09) | ||
// => Error: Invalid network version | ||
// alternative syntax | ||
wif.encode(obj) | ||
@@ -31,0 +32,0 @@ // => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
34
3.03%4674
-43.75%4
33.33%4
-50%52
-67.7%1
Infinity%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated