Skip to content

Commit

Permalink
Fix conversion from WordArray to byte array
Browse files Browse the repository at this point in the history
Looks like Array::slice() on the buffer isn't always working. Use to_hex() and
convert from that instead.
  • Loading branch information
Nadav Ivgi committed Mar 31, 2014
1 parent 37c1e3e commit 224d4ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/tx/lib/encryption.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
triplesec = require 'triplesec'
{ convert: { bytesToBase64, base64ToBytes } } = require 'bitcoinjs-lib'
{ convert: { bytesToBase64, base64ToBytes, hexToBytes } } = require 'bitcoinjs-lib'
{ iferr } = require '../../../lib/util.coffee'
{ Scrypt } = require 'triplesec/lib/scrypt'
{ prng, HMAC_SHA256 } = triplesec
Expand Down Expand Up @@ -64,7 +64,7 @@ decrypt_jsonba = (secret, enc, cb) ->
gen_key = (cb) ->
prng.generate 32, (key) ->
# Convert from WordArray to a regular byte array
cb null, [ key.to_buffer()... ]
cb null, hexToBytes key.to_hex()

module.exports = {
encrypt, decrypt
Expand Down

0 comments on commit 224d4ec

Please sign in to comment.