BlueWallet/blue_modules/bip38
2020-04-10 12:15:33 +01:00
..
scryptsy FIX: BIP38 import support 2020-04-07 15:43:40 +01:00
.npmignore FIX: BIP38 import support 2020-04-07 15:43:40 +01:00
CHANGELOG.md FIX: BIP38 import support 2020-04-07 15:43:40 +01:00
index.js FIX: BIP38 should reject invalid passwords 2020-04-10 12:15:33 +01:00
LICENSE FIX: BIP38 import support 2020-04-07 15:43:40 +01:00
package.json FIX: BIP38 import support 2020-04-07 15:43:40 +01:00
README.md FIX: BIP38 import support 2020-04-07 15:43:40 +01:00

bip38

build status Coverage Status Version

js-standard-style

A JavaScript component that adheres to the BIP38 standard to secure your crypto currency private keys. Fully compliant with Node.js and the browser (via Browserify).

Why?

BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is imprevious to brute force attacks thus protecting the user.

Package Info

Usage

Installation

npm install --save bip38

API

encrypt(buffer, compressed, passphrase[, progressCallback, scryptParams])

var bip38 = require('bip38')
var wif = require('wif')

var myWifString = '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR'
var decoded = wif.decode(myWifString)

var encryptedKey = bip38.encrypt(decoded.privateKey, decoded.compressed, 'TestingOneTwoThree')
console.log(encryptedKey)
// => '6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg'

decrypt(encryptedKey, passhprase[, progressCallback, scryptParams])

var bip38 = require('bip38')
var wif = require('wif')

var encryptedKey = '6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg'
var decryptedKey = bip38.decrypt(encryptedKey, 'TestingOneTwoThree', function (status) {
  console.log(status.percent) // will print the precent every time current increases by 1000
})

console.log(wif.encode(0x80, decryptedKey.privateKey, decryptedKey.compressed))
// => '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR'

References