aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_post.js
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-08 11:16:00 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-08 11:16:00 +0100
commit974e0984bd0d618093669780a75739d4b02fd3b2 (patch)
tree637841d1bb9cf3fc4e3f76af0253022afc29c4e6 /javascript/olm_post.js
parent3a382aec59937b086c37f039f1b011f253e80e97 (diff)
Update the javascript bindings and demo to match the format of the identity key JSON
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r--javascript/olm_post.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index 6ebd198..0494460 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -63,13 +63,28 @@ Account.prototype['create'] = restore_stack(function() {
);
});
-Account.prototype['identity_keys'] = restore_stack(function() {
+Account.prototype['identity_keys'] = restore_stack(function(
+ user_id, device_id, valid_after, valid_until
+) {
+ var user_id_array = array_from_string(user_id);
+ var device_id_array = array_from_string(device_id);
var keys_length = account_method(
Module['_olm_account_identity_keys_length']
- )(this.ptr);
+ )(
+ this.ptr, user_id_array.length, device_id_array.length,
+ valid_after, valid_after / Math.pow(2, 32),
+ valid_until, valid_until / Math.pow(2, 32)
+ );
+ var user_id_buffer = stack(user_id_array);
+ var device_id_buffer = stack(device_id_array);
var keys = stack(keys_length);
account_method(Module['_olm_account_identity_keys'])(
- this.ptr, keys, keys_length
+ this.ptr,
+ user_id_buffer, user_id_array.length,
+ device_id_buffer, device_id_array.length,
+ valid_after, valid_after / Math.pow(2, 32),
+ valid_until, valid_until / Math.pow(2, 32),
+ keys, keys_length
);
return Pointer_stringify(keys, keys_length);
});