add JavaScript function for getting unpublished fallback key
This commit is contained in:
parent
4127a84b3d
commit
c5eff859cb
2 changed files with 29 additions and 0 deletions
1
javascript/index.d.ts
vendored
1
javascript/index.d.ts
vendored
|
@ -29,6 +29,7 @@ declare class Account {
|
|||
remove_one_time_keys(session: Session);
|
||||
generate_fallback_key();
|
||||
fallback_key(): string;
|
||||
unpublished_fallback_key(): string;
|
||||
pickle(key: string | Uint8Array): string;
|
||||
unpickle(key: string | Uint8Array, pickle: string);
|
||||
}
|
||||
|
|
|
@ -172,6 +172,34 @@ Account.prototype['fallback_key'] = restore_stack(function() {
|
|||
return UTF8ToString(keys, keys_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['unpublished_fallback_key'] = restore_stack(function() {
|
||||
var keys_length = account_method(
|
||||
Module['_olm_account_unpublished_fallback_key_length']
|
||||
)(this.ptr);
|
||||
var keys = stack(keys_length + NULL_BYTE_PADDING_LENGTH);
|
||||
account_method(Module['_olm_account_unpublished_fallback_key'])(
|
||||
this.ptr, keys, keys_length
|
||||
);
|
||||
return UTF8ToString(keys, keys_length);
|
||||
});
|
||||
|
||||
Account.prototype['forget_previous_fallback'] = restore_stack(function() {
|
||||
account_method(Module['_olm_account_forget_previous_fallback_key'])(
|
||||
this.ptr
|
||||
);
|
||||
});
|
||||
|
||||
Account.prototype['pickle'] = restore_stack(function(key) {
|
||||
var key_array = array_from_string(key);
|
||||
var pickle_length = account_method(
|
||||
|
|
Loading…
Reference in a new issue