aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_post.js
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2020-08-14 17:29:25 -0400
committerHubert Chathi <hubert@uhoreg.ca>2020-08-14 17:29:41 -0400
commit171044f3fca084bd1c5c1f8f4bfe146434b07f0b (patch)
treee0d81cc51b02e46bfae638203744f846ec41e380 /javascript/olm_post.js
parenta0284c2ba36ac8433ea752e93b4a0a331a3f0c0b (diff)
add support for fallback keys
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r--javascript/olm_post.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index e204f30..aed4b69 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -141,11 +141,32 @@ Account.prototype['generate_one_time_keys'] = restore_stack(function(
});
Account.prototype['remove_one_time_keys'] = restore_stack(function(session) {
- account_method(Module['_olm_remove_one_time_keys'])(
+ account_method(Module['_olm_remove_one_time_keys'])(
this.ptr, session.ptr
);
});
+Account.prototype['generate_fallback_key'] = restore_stack(function() {
+ var random_length = account_method(
+ Module['_olm_account_generate_fallback_key_random_length']
+ )(this.ptr);
+ var random = random_stack(random_length);
+ account_method(Module['_olm_account_generate_fallback_key'])(
+ this.ptr, random, random_length
+ );
+});
+
+Account.prototype['fallback_key'] = restore_stack(function() {
+ var keys_length = account_method(
+ Module['_olm_account_fallback_key_length']
+ )(this.ptr);
+ var keys = stack(keys_length + NULL_BYTE_PADDING_LENGTH);
+ account_method(Module['_olm_account_fallback_key'])(
+ this.ptr, keys, keys_length
+ );
+ return UTF8ToString(keys, keys_length);
+});
+
Account.prototype['pickle'] = restore_stack(function(key) {
var key_array = array_from_string(key);
var pickle_length = account_method(