Commit Graph

119 Commits (22f85d3f3d5a043c90486992008347ddd97529d9)

Author SHA1 Message Date
Lukas Lihotzki 6611165bff do not pollute the global object 2020-10-03 03:46:15 +02:00
Saúl Ibarra Corretgé 2ef1f6f4fc SAS: add olm_sas_is_their_key_set
Also make olm_sas_generate_bytes fail if their key wasn't set.
2020-09-23 15:27:55 -04:00
Hubert Chathi c45f19f12d Merge branch 'master' into uhoreg/fallback 2020-09-01 15:57:20 -04:00
Hubert Chathi 89050dc0b6 allow some things to be Uint8Array, and fix some TypeScript declarations 2020-08-31 10:50:33 -04:00
Hubert Chathi 171044f3fc add support for fallback keys 2020-08-14 17:29:41 -04:00
Saúl Ibarra Corretgé a0284c2ba3 Fix group demo to work with > 2 users
Add 4 by default, and make sure OT keys are not reused.
2020-07-04 16:59:26 -04:00
Hubert Chathi 8a958beb48 bump version info for release 2020-06-11 11:47:50 -04:00
Matthew Hodgson ddd140b23d fix group demo to work with Olm.init() 2020-05-16 17:11:54 +01:00
Matthew Hodgson 14c1db02fe fix 1:1 demo to work with Olm.init() 2020-05-16 17:10:32 +01:00
Matthew Hodgson fdf25eb3ba spell out error msg if you don't Olm.init 2020-05-16 17:10:18 +01:00
Hubert Chathi 05a7af8db1 add a note about calling Olm.init 2020-05-13 19:05:19 -04:00
Hubert Chathi 281c5aac21 fix type signature of unpickle in Inbound/OutboundGroupSession
Thanks to Dominic Fischer for spotting.
2020-05-07 18:01:52 -04:00
Hubert Chathi e6f8a99b34 add missing declaration for PkDecryption#decrypt and SAS class 2020-04-29 12:39:41 -04:00
Hubert Chathi f409b69e88 add declarations for Inbound/OutboundGroupSession 2020-04-24 17:44:28 -04:00
Hubert Chathi 954d6f98eb initial TypeScript definition file 2020-04-24 17:27:55 -04:00
Hubert Chathi 6753595300 release 3.1.4 2019-10-09 12:33:47 -04:00
David Baker b482321213 Pass in a buffer to olm_session_describe
instead of having a static one, as that could end up taking up a
lot of memory if your app keeps olm sessions hanging about.
2019-10-04 11:43:40 +01:00
David Baker 39a1ee0b18 Add olm_session_describe
As a way to dump the state of an olm session, ie. the chain indicies,
so we can debug why olm sessions break and get out of sync.
2019-10-01 11:14:16 +01:00
Hubert Chathi ebd3ba6cc1 release 3.1.3 2019-06-24 17:09:41 -04:00
Hubert Chathi 769d013ef7 release 3.1.2 2019-04-30 18:25:21 -04:00
Hubert Chathi 6aafd69f8f bump version number for 3.1.1 2019-04-29 15:01:09 -04:00
Hubert Chathi bac8ca7802 prepare for 3.1.0 release 2019-04-17 17:31:01 -04:00
Hubert Chathi ebc156e7c2 re-add null termination in javascript
because older versions of emscripten don't support the length argument to
UTF8ToString.
2019-04-08 15:54:02 -04:00
Damir Jelić 071029c201 javascript: Switch from deprecated Pointer_stringify() to UTF8toString().
The Pointer_stringify() function is deprecated and has a couple of
issues because it tries to guess the encoding of the buffer. In some
cases it can ignore the length parameter which could end up in
inconsistencies.

Switch to UTF8toString() that takes a length parameter and respects,
that way we don't need to allocate an additional byte for a NULL byte.
2019-04-08 15:18:28 -04:00
Hubert Chathi 3148157ea4 add support for an incorrect KDF that snuck into Riot 1.0 2019-04-02 23:39:05 -04:00
Hubert Chathi 0348f06a56 rename functions to be more consistent 2019-03-13 22:39:21 -04:00
Hubert Chathi 48dda7922d call the right function and remove unnecessary include 2019-02-01 11:39:06 -05:00
David Baker 8df2ab7c07 Add signing class to the pk module 2019-01-29 20:47:41 +00:00
Hubert Chathi 94f664e725
initial implementation of short authentication string generation 2019-01-21 23:21:41 -05:00
Hubert Chathi ff24af601a prepare release 3.0.0 2018-10-23 12:58:10 -04:00
Hubert Chathi 340a4965c9 include the non-wasm version in the package 2018-10-23 12:24:49 -04:00
Hubert Chathi 93f764200e zero buffers in the JavaScript bindings 2018-10-16 17:50:34 -04:00
Hubert Chathi 22f8649c10 also ignore the non-wasm JS file 2018-10-16 16:11:22 -04:00
David Baker e73ebcea67 Merge remote-tracking branch 'origin/master' into dbkr/pk_private_export_import 2018-10-10 20:15:40 +01:00
Hubert Chathi f6e3f7f44a
Merge branch 'master' into dbkr/pk_private_export_import 2018-10-05 14:52:01 -04:00
Hubert Chathi 0a25ec137f
Merge branch 'master' into dbkr/wasm 2018-10-05 10:50:01 -04:00
Hubert Chathi bad14db8da remove unneeded polyfill 2018-10-05 10:35:09 -04:00
Hubert Chathi 8520168e0b fix some code style issues and typos 2018-10-05 10:35:09 -04:00
David Baker 602c00a8d6 Dual-build wasm and asm.js olm 2018-10-04 20:09:54 +01:00
David Baker e521ee84c5 Add an export for the length of a private key 2018-10-02 19:21:05 +01:00
David Baker 0346145a81 Work with PkDecryption keys by their private keys
Change interface to allow the app to get the private part of the
key and instantiate a decryption object from just the private part
of the key.

Changes the function generating a key from random bytes to be
initialising a key with a private key (because it's exactly the
same thing). Exports & imports private key parts as ArrayBuffer at
JS level rather than base64 assuming we are moving that way in
general.
2018-10-02 12:02:56 +01:00
David Baker 0ad32c9896 Call appropriate wrapper function
Don't think this matters since there's no PkEncryption /
PkDecryption object being passed, but for the sake of consistency
2018-10-01 13:22:04 +01:00
David Baker c4a3918686 Support passing olm options into init() 2018-09-26 16:38:39 +01:00
David Baker dfbe8a4796 Return same promise if init() called many times
So we only init the library once.
2018-09-25 17:48:17 +01:00
David Baker 263b94428a Another day, another interface
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-25 17:13:29 +01:00
David Baker f29d8cdd7b Also ship the wasm file 2018-09-21 16:39:04 +01:00
David Baker 5e87db615a Make OLM_OPTIONS work again
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-21 16:35:17 +01:00
David Baker 122867c45c WebAssembly support!
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-09-21 16:01:51 +01:00
Hubert Chathi 98e8ee1b0d prepare 2.3.0 2018-07-04 15:24:44 -04:00
Hubert Chathi f709b062bb add functions for pickling/unpickling a decryption object 2018-06-28 17:10:36 -04:00