From 705f8ce818369428159f2a60d3fec249a071e8d0 Mon Sep 17 00:00:00 2001 From: Matt Corallo <git@bluematt.me> Date: Fri, 2 May 2014 17:41:42 -0400 Subject: [PATCH] generic-ize --- js/test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/test.js b/js/test.js index 70d6d068a..66dcc886c 100644 --- a/js/test.js +++ b/js/test.js @@ -332,11 +332,8 @@ encryptedMessage: hexToArrayBuffer("415a326e6f457937756a6c5355785876342f6b585634 }], ]; - TEST(function(callback) { - var v = axolotlTwoPartyTestVectorsAlice; + var axolotlTestVectors = function(v, remoteDevice, callback) { var origCreateNewKeyPair = crypto_tests.createNewKeyPair; - var remoteDevice = { encodedNumber: "BOB" }; - var doStep; var stepDone = function(res) { @@ -377,7 +374,7 @@ encryptedMessage: hexToArrayBuffer("415a326e6f457937756a6c5355785876342f6b585634 var message = new IncomingPushMessageProtobuf(); message.type = 1; - message.source = "BOB"; + message.source = remoteDevice.encodedNumber; message.message = data.message; crypto.handleIncomingPushMessageProto(decodeIncomingPushMessageProtobuf(getString(message.encode())), function(res) { stepDone(res.message.body == data.expectedSmsText); @@ -430,6 +427,10 @@ encryptedMessage: hexToArrayBuffer("415a326e6f457937756a6c5355785876342f6b585634 } } doStep(); + } + + TEST(function(callback) { + axolotlTestVectors(axolotlTwoPartyTestVectorsAlice, { encodedNumber: "BOB" }, callback); }, "Standard Axolotl Test Vectors as Alice", true); // Setup test timeouts (note that this will only work if things are actually