diff options
author | Hubert Chathi <hubertc@matrix.org> | 2020-09-17 21:42:25 +0000 |
---|---|---|
committer | Hubert Chathi <hubertc@matrix.org> | 2020-09-17 21:42:25 +0000 |
commit | 3cd6b15853923fff512138ebb5e8ba390cfb38e2 (patch) | |
tree | 6830d4d13f7c1106f8e4e772e16f9204d523fcd5 /javascript/olm_post.js | |
parent | 89050dc0b68f0d5f1bf9f9f386f7c2f4ac043f4f (diff) | |
parent | c47c6ca3992c74489700cda44443ec29c3cb3b13 (diff) |
Merge branch 'uhoreg/fallback' into 'master'
add support for fallback keys
See merge request matrix-org/olm!13
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r-- | javascript/olm_post.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js index 439041a..82dd803 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( |