Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to WebAssembly-powered Olm #743

Merged
merged 12 commits into from
Oct 25, 2018
Merged

Update to WebAssembly-powered Olm #743

merged 12 commits into from
Oct 25, 2018

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Sep 25, 2018

Requires https://github.com/matrix-org/olm-backup/pull/57 to be released (after which we can bump the Olm version here)

Mostly this just changes over to use the aync init of olm.

wasm Olm has a new interface: it now has an init method that needs
to be called and the promise it returns waited on before the Olm
module is used. Support that, and allow Crypto etc to be imported
whether Olm is enabled or not. Change whether olm is enabled to
be async since now it will be unavailable if the async module init
fails. Don't call getOlmVersion() until the Olm.init() is done.
@ara4n
Copy link
Member

ara4n commented Sep 25, 2018

looks plausible to me :)

By doing `Olm = global.Olm` on script load, we require that Olm is
available right from the start, which isn't really necessary. As
long as it appears some time before we actually want to use it,
this is fine (we can probably assume it's not going to go away
again..?)

This means Riot doesn't need to faff about making sure olm is
loaded before starting anything else.
it("Crypto exposes the correct olm library version", function() {
console.log(Crypto);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debugging line should be taken out

it("Crypto exposes the correct olm library version", function() {
console.log(Crypto);
expect(Crypto.getOlmVersion()[0]).toEqual(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need to s/2/3/ since we'll need to bump the major version for olm due to backward incompatible API changes

@@ -124,6 +128,8 @@ utils.inherits(Crypto, EventEmitter);
* Returns a promise which resolves once the crypto module is ready for use.
*/
Crypto.prototype.init = async function() {
await global.Olm.init();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wrapped this in an if (global.Olm.init), would everything still work with older versions of Olm?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm - probably. Not sure whether or not its worth trying.

Copy link
Member

@uhoreg uhoreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failures are probably because the CI image needs to be updated with the newer olm (which may cause every other PR to fail, until they all get updated.)

@dbkr dbkr merged commit 870e96a into develop Oct 25, 2018
@t3chguy t3chguy deleted the dbkr/wasm branch May 10, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants