aboutsummaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2016-11-07 17:21:39 +0100
committermanuroe <manu@matrix.org>2016-11-07 17:21:39 +0100
commit5d1b66c350ac017613982f904b896750766654de (patch)
treea290c557e7881f7eb48cbdd568a4f3e43cb749c6 /javascript
parent62f52806702b799b9e25e7cdf07be1c8a31325a2 (diff)
parentf6c05be8c5d35e725a8a2ed5ad661398ac9f8cd2 (diff)
Merge remote-tracking branch 'origin/master' into olmkit
Diffstat (limited to 'javascript')
-rw-r--r--javascript/demo/group_demo.js4
-rw-r--r--javascript/olm_inbound_group_session.js9
-rw-r--r--javascript/package.json2
3 files changed, 10 insertions, 5 deletions
diff --git a/javascript/demo/group_demo.js b/javascript/demo/group_demo.js
index 1b8f7ab..42a3d84 100644
--- a/javascript/demo/group_demo.js
+++ b/javascript/demo/group_demo.js
@@ -403,8 +403,8 @@ DemoUser.prototype.decryptGroup = function(jsonpacket, callback) {
throw new Error("Unknown session id " + session_id);
}
- var plaintext = session.decrypt(packet.body);
- done(plaintext);
+ var result = session.decrypt(packet.body);
+ done(result.plaintext);
}, callback);
};
diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js
index 6058233..1b7fcfe 100644
--- a/javascript/olm_inbound_group_session.js
+++ b/javascript/olm_inbound_group_session.js
@@ -73,10 +73,12 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function(
// So we copy the array to a new buffer
var message_buffer = stack(message_array);
var plaintext_buffer = stack(max_plaintext_length + NULL_BYTE_PADDING_LENGTH);
+ var message_index = stack(4);
var plaintext_length = inbound_group_session_method(Module["_olm_group_decrypt"])(
this.ptr,
message_buffer, message_array.length,
- plaintext_buffer, max_plaintext_length
+ plaintext_buffer, max_plaintext_length,
+ message_index
);
// Pointer_stringify requires a null-terminated argument (the optional
@@ -86,7 +88,10 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function(
0, "i8"
);
- return Pointer_stringify(plaintext_buffer);
+ return {
+ "plaintext": Pointer_stringify(plaintext_buffer),
+ "message_index": Module['getValue'](message_index, "i32")
+ }
});
InboundGroupSession.prototype['session_id'] = restore_stack(function() {
diff --git a/javascript/package.json b/javascript/package.json
index df43ce1..b65fb2e 100644
--- a/javascript/package.json
+++ b/javascript/package.json
@@ -1,6 +1,6 @@
{
"name": "olm",
- "version": "1.3.0",
+ "version": "2.0.0",
"description": "An implementation of the Double Ratchet cryptographic ratchet",
"main": "olm.js",
"files": [