BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is less susceptible to brute force attacks thus protecting the user.
Branch: master
Clone or download
Latest commit ebf7064 Feb 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test tests: increase timeout to ridiculous Dec 3, 2016
.gitignore Small fix to gitignore Nov 3, 2015
.min-wd makefile for testing Feb 28, 2014
.npmignore rm non-existent files Aug 13, 2015
.travis.yml travis: add Node8 Aug 21, 2017
CHANGELOG.md 2.0.0 Dec 20, 2016
LICENSE LICENSE: adds MIT license Sep 2, 2014
README.md sp Feb 15, 2019
index.js use safe-buffer, xor/inplace Aug 21, 2017
package.json 2.0.2 Dec 13, 2017

README.md

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 impervious 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, passphrase[, 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 percent every time current increases by 1000
})

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

References