diff --git a/lib/bip38.js b/lib/bip38.js index 21c3626..44f0a3b 100644 --- a/lib/bip38.js +++ b/lib/bip38.js @@ -1,7 +1,7 @@ var AES = require('aes') var assert = require('assert') -var base58check = require('bs58check') var crypto = require('crypto') +var cs = require('coinstring') var scrypt = require('scryptsy') var ecurve = require('ecurve') @@ -58,7 +58,7 @@ Bip38.prototype.encryptRaw = function(buffer, compressed, passphrase, saltAddres } Bip38.prototype.encrypt = function(wif, passphrase, saltAddress) { - var d = base58check.decode(wif).slice(1) + var d = cs.decode(wif).slice(1) var compressed = (d.length === 33) && (d[32] === 0x01) // truncate the compression flag @@ -66,7 +66,7 @@ Bip38.prototype.encrypt = function(wif, passphrase, saltAddress) { d = d.slice(0, -1) } - return base58check.encode(this.encryptRaw(d, compressed, passphrase, saltAddress)) + return cs.encode(this.encryptRaw(d, compressed, passphrase, saltAddress)) } //some of the techniques borrowed from: https://github.com/pointbiz/bitaddress.org @@ -122,7 +122,7 @@ Bip38.prototype.decryptRaw = function(encData, passphrase) { } Bip38.prototype.decrypt = function(encryptedBase58, passphrase) { - var encBuffer = base58check.decode(encryptedBase58) + var encBuffer = cs.decode(encryptedBase58) var decrypt = this.decryptRaw(encBuffer, passphrase) // Convert to WIF @@ -136,7 +136,7 @@ Bip38.prototype.decrypt = function(encryptedBase58, passphrase) { buffer.writeUInt8(0x01, 33) } - return base58check.encode(buffer) + return cs.encode(buffer) } Bip38.prototype.decryptECMult = function(encData, passphrase) { diff --git a/package.json b/package.json index f30a8fa..2497e94 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dependencies": { "aes": "~0.1.0", "bigi": "^1.2.0", - "bs58check": "^1.0.0", + "coinstring": "^2.0.0", "ecurve": "^1.0.0", "scryptsy": "^1.0.0" },