pull/213/head
sachaaaaa 6 years ago
parent 16b96f3d21
commit ad5efc9ba3

@ -74,7 +74,7 @@ const fetch = async (url, options = {}) => {
}
try {
result = JSON.parse(result);
} catch(e) {
} catch (e) {
log.warn(`Could not parse string to json ${result}`, e);
}
}

@ -98,8 +98,14 @@ describe('Snode Channel', () => {
senderPubKey,
snodePrivKey
);
const encryptedArrayBuffer = dcodeIO.ByteBuffer.wrap(encrypted, 'base64').toArrayBuffer();
const decrypted = await libloki.crypto.DHDecrypt(symmetricKey, encryptedArrayBuffer);
const encryptedArrayBuffer = dcodeIO.ByteBuffer.wrap(
encrypted,
'base64'
).toArrayBuffer();
const decrypted = await libloki.crypto.DHDecrypt(
symmetricKey,
encryptedArrayBuffer
);
const textDecoder = new TextDecoder();
const messageReceived = textDecoder.decode(decrypted);
assert.strictEqual(messageSent, messageReceived);
@ -124,7 +130,9 @@ describe('Snode Channel', () => {
snodePrivKey
);
const encrypted = await libloki.crypto.DHEncrypt(symmetricKey, data);
const encryptedBase64 = dcodeIO.ByteBuffer.wrap(encrypted).toString('base64');
const encryptedBase64 = dcodeIO.ByteBuffer.wrap(encrypted).toString(
'base64'
);
// message received by Loki Messenger
const decrypted = await channel.decrypt(snode.address, encryptedBase64);
assert.strictEqual(messageSent, decrypted);

Loading…
Cancel
Save