[BREAKGLASS] Append-only mirror of github.com/bluewallet/bip38
Go to file
Daniel Cousens 367a7d3bed 2.0.2
2017-12-14 08:42:22 +11:00
test tests: increase timeout to ridiculous 2016-12-03 18:47:02 +11:00
.gitignore Small fix to gitignore 2015-11-03 12:37:10 +02:00
.min-wd makefile for testing 2014-02-28 02:29:00 -06:00
.npmignore rm non-existent files 2015-08-13 17:24:02 +10:00
.travis.yml travis: add Node8 2017-08-21 11:47:09 +10:00
CHANGELOG.md 2.0.0 2016-12-20 08:50:18 -06:00
index.js use safe-buffer, xor/inplace 2017-08-21 11:51:08 +10:00
LICENSE LICENSE: adds MIT license 2014-09-02 17:39:05 +10:00
package.json 2.0.2 2017-12-14 08:42:22 +11:00
README.md README: add missing version for wif encoding 2017-08-10 14:16:36 +10: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