aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_post.js
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-14 16:45:00 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-14 16:45:00 +0100
commitbede3a84998f74d0d4da93bb6017712630c72857 (patch)
tree2157ed6b28851ab04a5e14b3a8e967460863e053 /javascript/olm_post.js
parent36d17d1cb248db595a2318cd6af6fc4a1952cbb2 (diff)
Tweak the javascript bindings so that they will work with Node.js
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r--javascript/olm_post.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index df1c481..60876b1 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -15,7 +15,7 @@ function array_from_string(string) {
function random_stack(size) {
var ptr = stack(size);
var array = new Uint8Array(Module['HEAPU8'].buffer, ptr, size);
- window.crypto.getRandomValues(array);
+ get_random_values(array);
return ptr;
}
@@ -139,7 +139,7 @@ Account.prototype['unpickle'] = restore_stack(function(key, pickle) {
var key_array = array_from_string(key);
var key_buffer = stack(key_array);
var pickle_array = array_from_string(pickle);
- var pickle_buffer = stack(pickle_length);
+ var pickle_buffer = stack(pickle_array);
account_method(Module['_olm_unpickle_account'])(
this.ptr, key_buffer, key_array.length, pickle_buffer,
pickle_array.length
@@ -280,5 +280,7 @@ Session.prototype['decrypt'] = restore_stack(function(
return Pointer_stringify(plaintext_buffer, plaintext_length);
});
-return {"Account": Account, "Session": Session};
+olm_exports["Account"] = Account;
+olm_exports["Session"] = Session;
+
}();