change encryption to work on hex strings

..instead of binary, to work around an issue with bitcore/sjcl. I'm not sure
what the issue is exactly, except that encryption of binary data isn't working
correctly due to some kind of string stuff involving decodeURIComponent inside
sjcl. I haven't fully figured it out. For now I am changing the network
protocol to hex to workaround the issue.

See this: https://github.com/bitpay/bitcore/pull/416
This commit is contained in:
Ryan X. Charles 2014-07-09 01:13:42 -07:00
commit 643cad3a39
2 changed files with 6 additions and 3 deletions

View file

@ -100,7 +100,8 @@ describe('Message model', function() {
var version2 = new Buffer([0]);
var nonce = new Buffer([0, 0, 0, 0, 0, 0, 0, 0]);
var toencrypt = Buffer.concat([version1, version2, nonce, payload]);
var encrypted = Message._encrypt(topubkey, toencrypt);
var toencrypt_workaround = new Buffer(toencrypt.toString('hex'));
var encrypted = Message._encrypt(topubkey, toencrypt_workaround);
var sig = Message._sign(fromkey, encrypted);
var encoded = {
pubkey: fromkey.public.toString('hex'),