From f6b5eec84e72405904a2e56097ec90269e681bb5 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 16 Jul 2015 11:06:05 -0700 Subject: [PATCH] Let key verification view use array buffers --- js/views/key_verification_view.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/views/key_verification_view.js b/js/views/key_verification_view.js index 1fbd966d..16fa5443 100644 --- a/js/views/key_verification_view.js +++ b/js/views/key_verification_view.js @@ -27,11 +27,14 @@ this.trigger('back'); }, splitKey: function(key) { - // key is a binary string - return _.map(key, function(chr, i) { - return ('0' + key.charCodeAt(i).toString(16)).slice(-2); + // key is an array buffer + var bytes = new Uint8Array(key); + var octets = []; + for (var i = 0; i < bytes.byteLength; ++i) { + octets.push(('0' + bytes[i].toString(16)).slice(-2)); + } - }); + return octets; }, render_attributes: function() { return {