aboutsummaryrefslogtreecommitdiff
path: root/javascript
AgeCommit message (Collapse)Author
2018-09-25Return same promise if init() called many timesDavid Baker
So we only init the library once.
2018-09-25Another day, another interfaceDavid Baker
Change the interface again, hopefully this time a bit more normal. Now we wrap the emscripten module completely and just expose the high level objects. The olm library export is now imported as normal (ie. returns a module rather than a function returning a module) but has an `init` method which *must* be called. This returns a promise which resolves when the module is ready. It also rejects if the module failed to set up, unlike before (and unlike the promise-not-a-promise that emscripten returns). Generally catch failures to init the module.
2018-09-21Also ship the wasm fileDavid Baker
2018-09-21Make OLM_OPTIONS work againDavid Baker
The closure compiler was just renaming the variable so it never would have picked them up. Make it an extern so it knows what to do.
2018-09-21WebAssembly support!David Baker
Quite a lot going on in this PR: * Updates to support recent emscripten, switching to WASM which is now the default * Use emscripten's MODULARIZE option rather than wrapping it ourself, since doing so in pre-post js doesn't work anymore. * Most changes are moving the emscripten runtime functions to top-level calls rather than in the Module object. * Get rid of duplicated NULL_BYTE_PADDING_LENGTH * Fix ciphertext_length used without being declared * Fix things that caused the closure compiler to error, eg. using OLM_OPTIONS without a declaration. * Wait until module is inited to do OLM_ERROR = olm_error() The main BREAKING CHANGE here is that the module now needs to initialise asyncronously (because it has to load the wasm file). require()ing olm now gives a function which needs to be called to create an instance. The resulting object has a promise-like then() method that can be used to detect when the module is ready. (We could use MODULARIZE_INSTANCE to return the module directly as before, rather than the function, but then we don't get the .then() method).
2018-07-04prepare 2.3.02.3.0Hubert Chathi
2018-06-28add functions for pickling/unpickling a decryption objectHubert Chathi
2018-06-28add terminationHubert Chathi
2018-06-27use the correct method to get the random lengthHubert Chathi
2018-06-27add initial implementation of basic private key encryption functionalityHubert Chathi
2018-01-09patch for libolm: fix some typos in JavaScript libraryHubert Chathi
From 4a82d31e8cb808a04956fc847ed0ec0ff322b956 Mon Sep 17 00:00:00 2001 From: Hubert Chathi <hubert@uhoreg.ca> Date: Wed, 3 Jan 2018 21:37:43 -0500 Subject: [PATCH] fix some typos in JavaScript library Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
2017-03-01prepare v2.2.22.2.2Richard van der Hoff
2017-01-18Prep v2.2.12.2.1Richard van der Hoff
2017-01-18Bump version numbers to 2.2.02.2.0Richard van der Hoff
2017-01-09Implement importing group session dataRichard van der Hoff
olm_import_inbound_group_session, which reads the format written by olm_export_inbound_group_session to initialise a group session.
2017-01-06Enable exporting inbound group session keysRichard van der Hoff
A pair of functions which allow you to export the megolm keys for an inbound group session, so that an application can save/restore them.
2016-12-22Bump version numbers throughout2.1.0Richard van der Hoff
2016-12-19Add some tests for the Javascript wrappersRichard van der Hoff
These would have helped avoid the recent FRV.
2016-12-16Avoid buffer overrun on encryptionRichard van der Hoff
Make sure we null-terminate encrypted strings before passing them to UTF8ToString. This used to work when we allocated the buffer on the stack, because it turns out that allocate() zeroinits the returned memory. malloc(), of course, does not.
2016-12-15Merge pull request #39 from matrix-org/rav/messages_on_heapRichard van der Hoff
Allocate memory for message blobs on the heap
2016-12-15typoRichard van der Hoff
2016-12-15zero out plaintext buffersRichard van der Hoff
Avoid leaving copies of the plaintext sitting around in the emscripten heap.
2016-12-14Allocate memory for message blobs on the heapRichard van der Hoff
Messages can be very large, so we don't really want to allocate them on the stack. Switch to using the heap for them, and try to clean up some of the string handling while we're at it.
2016-12-14Let apps override emscripten settingsRichard van der Hoff
Read settings from OLM_OPTIONS to allow apps to configure some options. In particular, this is useful for setting the heap size.
2016-12-12Better handling of exceptions during loadingRichard van der Hoff
If we get an exception during load, don't define half of window.Olm (which confuses apps). This is a partial fix to https://github.com/vector-im/riot-web/issues/2726.
2016-10-25Version bump for 2.0.02.0.0Richard van der Hoff
2016-10-20Return the message index when decrypting group messages.Mark Haines
Applications can use the index to detect replays of the same message.
2016-09-14Changelog and version bump for 1.3.01.3.0Mark Haines
2016-09-14Fix the group javascript demoMark Haines
2016-09-13Merge remote-tracking branch 'matrix/master'Mark Haines
2016-09-13Merge pull request #23 from matrix-org/markjh/remove_message_indexMark Haines
Remove the messsage index from olm_init_inbound_group_session
2016-09-13Remove the messsage index from olm_init_inbound_group_session since it is ↵Mark Haines
read from the session_key
2016-09-13Add a olm_inbound_group_session_id methodMark Haines
2016-09-06call double ratchet what it isMatthew Hodgson
2016-09-06Bump version numbers to 1.2.01.2.0Richard van der Hoff
2016-09-06Clean up some typosRichard van der Hoff
Remove redundant args from some js funcs, and fix a comment typo
2016-09-05Fix error handling for group sessionsRichard van der Hoff
Fix a couple of places where we were using the wrong method to get the last error.
2016-09-05Merge pull request #15 from matrix-org/rav/has_received_messageRichard van der Hoff
OlmSession.has_received_message
2016-09-05Fix megolm decryption of UTF-8Richard van der Hoff
Repeat the fix from b10f90d for megolm messages. It turns out that the 'length' argument to 'Pointer_stringify' doesn't work if the input includes characters >= 128. Rather than try to figure out which methods can return UTF-8, and which always return plain ascii, replace all uses of Pointer_stringify with a 'length' argument with the version that expects a NULL-terminated input, and extend the buffer by a byte to allow space for a null-terminator. In the case of decrypt, we need to add the null ourself. Fixes https://github.com/vector-im/vector-web/issues/2078.
2016-09-04OlmSession.has_received_messageRichard van der Hoff
I find myself wanting to know if an OlmSession is in the pre-key state or not, to help debugging at the application level.
2016-09-01Bump version in package.json1.1.0Richard van der Hoff
... to match the Makefile
2016-09-01Fix Ed25519 keypair generationRichard van der Hoff
Ed25519 private keys, it turns out, have 64 bytes, not 32. We were previously generating only 32 bytes (which is all that is required to generate the public key), and then using the public key as the upper 32 bytes when generating the per-message session key. This meant that everything appeared to work, but the security of the private key was severely compromised. By way of fixes: * Use the correct algorithm for generating the Ed25519 private key, and store all 512 bits of it. * Update the account pickle format and refuse to load the old format (since we should consider it compromised). * Bump the library version, and add a function to retrieve the library version, so that applications can verify that they are linked against a fixed version of the library. * Remove the curve25519_{sign, verify} functions which were unused and of dubious quality.
2016-07-11Prepare 1.0.0 release1.0.0Richard van der Hoff
2016-07-06JS: make sure returned strings are null-terminatedRichard van der Hoff
It turns out that the 'length' argument to 'Pointer_stringify' doesn't work if the input includes characters >= 128. Rather than try to figure out which methods can return UTF-8, and which always return plain ascii, replace all uses of Pointer_stringify with a 'length' argument with the version that expects a NULL-terminated input, and extend the buffer by a byte to allow space for a null-terminator. In the case of decrypt, we need to add the null ourself. Fixes https://github.com/vector-im/vector-web/issues/1719.
2016-05-26Put a signature on sent group messagesRichard van der Hoff
It's important that group messages be signed by the sender, rather than by a secret derived from the shared secret.
2016-05-26js group demo: use a remoteOps objectRichard van der Hoff
To make sure that we don't sneakily use methods which we wouldn't be able to for remote users, expose an interface object which contains the remote interface.
2016-05-26javascript/olm_inbound_group_session.js: fix length argRichard van der Hoff
message.length counts codepoints; we need bytes.
2016-05-25Add a demo for group messaging via the JS bindingsRichard van der Hoff
2016-05-25Javascript bindings for group sessionsRichard van der Hoff
2016-05-20Add support for building the JS wrappers to the MakefileRichard van der Hoff
Now that we have C and C++, we need to split the compile and link steps (because we need different flags for the C and C++ files), so this is easier with a Makefile.