3.1.1 • Published 4 years ago

bip38 v3.1.1

Weekly downloads
4,514
License
-
Repository
github
Last release
4 years ago

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

Async methods

Async methods are available, but using them will be slower, but free up the event loop in intervals you choose.

For benchmark results, please see the section in the README of the scryptsy library. Increasing the interval will decrease the performance hit, but increase the span between event loop free ups (UI drawing etc.) promiseInterval is the last optional parameter after scryptParams. There is no recommendation currently, as the performance trade off is app specific.

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

@tyz-wallet/tyz-wallet-core-wallet-clientpolispay-wallet-clientbcschainjs-walletbitcore-wallet-client-polissbercoinjs-walletbitcore-wallet-client-vbch-js-joeyverge-wallet-clienttyz-wallet-core-client@everything-registry/sub-chunk-1237bch-js-testfcash-wallet-clienteurekacoinjs-walleteonacore-wallet-clientetkframeworkeumadipiscihtmljs-wallethtmlcoinjs-wallethydrajs-walletducatus-wallet-clientducatus-wallet-client-ducatuseiusfacereelectra-js@fantasygold/fantasygoldjs-wallethb-qtumjs-wallethbc-qtumjs-wallethdaddressgeneratorhdwalletgarlicore-wallet-client@ducatus/bitcore-wallet-client@ducatus/ducatus-wallet-client-rev@ducatus/ducatuscore-wallet-client@hypercerts/hyperinfra-wallet-corekeoken-wallet-clientkinecore-wallet-client@sotatek-anhdao/bitcore-wallet-client@sotatek-anhdao/react-native-bitcore-wallet-client@sambo5000/xec-jsnbv-ur-codec@owstack/btc-wallet-client@owstack/bch-wallet-client@owstack/wallet-client@psf/bch-js@psf/bch-js-electron@samrock5000/bch-js@samrock5000/xecjs@swipechain/platform-sdk-crypto@swipechain/platform-sdk-profiles@swtrse/bitcore-wallet-clientlocjs-walletmatrixbitcore-wallet-clientmcore-wallet-client-matrixbit@laverna_ritchie5/walletlifetioncore-wallet-clientltzcore-wallet-clientmetrixjs-walletmxbitcore-wallet-client@o0o2022/bitcore-wallet-client@o0o2022sg/bitcore-wallet-clientmulticoinsmulticore-wallet-client@nayiem/crypto@plark/bitbox-sdk@payvo/cryptography@payvo/sdk-crypto@payvo/profiles@phantomcores/core@phantomchain/core@phantomchain/core-json-rpc@toucansam-bpl/core@tecracoin/bitcore-wallet-client-tcrqtumjs-walletpotcore-wallet-clienttealcoin-explorer-api@arkecosystem/platform-sdk-crypto@arkecosystem/platform-sdk-profiles@arkecosystem/json-rpccoincrypt@bcpros/xpi-jsbip38dbip38-decrypt@abcpros/xpi-js@abcpros/bitcore-wallet-client@abcpros/bch-jscassi@adora-wallet/adoracore-wallet-clientblockstarterbtcnano-wallet-clientbuidljsbuidlc0bancore-wallet-clientc0ban-wallet-clientbtc-toolsbtcbamjs-wallet@bitrupee/bitcore-wallet-client@bitrupee/bitrupee-wallet-client@chris.troutner/bch-js@chris.troutner/bitbox-jsbeyondasset-hdwalletbch-js-reg
3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.0.3

5 years ago

2.0.2

6 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.4.0

8 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago