From 2ad422afc871f5de02a00d498cb42cbc3ba42769 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 16 Jul 2015 12:10:11 -0700 Subject: [PATCH] Convert to array buffer --- js/axolotl_store.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/axolotl_store.js b/js/axolotl_store.js index b3686573e..90f3706db 100644 --- a/js/axolotl_store.js +++ b/js/axolotl_store.js @@ -33,7 +33,6 @@ if (thing instanceof Array) { // Assuming Uint16Array from curve25519 - //TODO: Move to convertToArrayBuffer var res = new ArrayBuffer(thing.length * 2); var uint = new Uint16Array(res); for (var i = 0; i < thing.length; i++) @@ -256,6 +255,9 @@ putIdentityKey: function(identifier, publicKey) { if (identifier === null || identifier === undefined) throw new Error("Tried to put identity key for undefined/null key"); + if (!(publicKey instanceof ArrayBuffer)) { + publicKey = convertToArrayBuffer(publicKey); + } var number = textsecure.utils.unencodeNumber(identifier)[0]; return new Promise(function(resolve) { var identityKey = new IdentityKey({id: number});