bitcoinjs / bip38

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.
http://cryptocoinjs.com/modules/currency/bip38/
MIT License
205 stars 100 forks source link

TypeError: Bip38 is not a constructor #28

Closed grio closed 7 years ago

grio commented 7 years ago

bip38 is installed by npm install bip38 └─┬ bip38@2.0.1 └── scryptsy@1.2.1

test.js is

var Bip38 = require('bip38');

var privateKeyWif = '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR';

var bip38 = new Bip38();
bip38.version = {private: 0x80, public: 0x0};
bip38.encrypt(privateKeyWif, "super-secret", "1Jq6MksXQVWzrznvZzxkV6oY57oWXD9TXB");

error is

var bip38 = new Bip38();
            ^

TypeError: Bip38 is not a constructor
dcousens commented 7 years ago

The API changed in V2. Please see API in the README.