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

Consider Web Assembly (wasm) System Interface (wasi) and it's possibilities #1128

Closed
wucke13 opened this issue Dec 31, 2019 · 3 comments
Closed

Comments

@wucke13
Copy link

wucke13 commented Dec 31, 2019

I would like to start a discussion about how wasm and especially the Web Assembly System Interface (wasi) may be used to improve the capabilities deltachat. This is a huge topic, and especially wasi is quite young. Nonetheless I would like to see a discussion about this happening, so here we go. I'll propose some starting points, but in no way that is meant to limit the discussion to just these.

  1. Making deltachat-core-rust cross platform from a single blob.
    This is huge IMO. Currently it's not straight forward to get up running and playing with deltachat-core-rust's repl example. To do so, I have to setup a rust nightly toolchain, compile it (which on my fairly old laptop takes some 15+ minutes) and then I got a dynamically linked blob with all the issues related to dynamic linking. If I could simply download a .wasm file for the repl example and run it, that would be nicer.
  2. Security.
    I Hope so that the last sentence made you wonder whether I just download and run binary blobs randomly. I admit it, I do. However, If I do so with wasi stuff, I may feel a bit more encouraged, as wasi runtimes need to offer sandboxing, making it harder for malicious code to harm me without explicitly giving consent to file access.
  3. Integration.
    How would one use deltachat-core-rust as a library in python? Well there is bindings and modules for that, offering rich functionality once set up. However, using wasi, one would get all of that, almost for free, for almost any language! There already are bindings for Python, Java, JavaScript, Rust, etc. and more are to come. By using this technology, one binary blob may be offered as library for many languages.

Please share your thoughts on this!

@wucke13 wucke13 changed the title Consider Web Assembly (wasm) System Interface (wasi) and it's possibilites Consider Web Assembly (wasm) System Interface (wasi) and it's possibilities Dec 31, 2019
@r10s r10s added the discussion label Jan 2, 2020
@link2xt
Copy link
Collaborator

link2xt commented Jan 4, 2020

@wucke13 Have you tried compiling Delta Chat for wasm32-wasi runtime? If we can setup CI for it and ensure that it can be built it would be nice, but honestly I don't see where we can use it now. All the platforms use native versions of the library and switching to wasm VM will only make things slower. There is probably some use for it for bot writing, though.

If you want to try doing it, please try to compile it and open specific issues if something does not work or PR that adds CI if it does. We try to move general discussions to https://support.delta.chat/ so issues on GitHub only contain issues that someone is working on.

@wucke13
Copy link
Author

wucke13 commented Jan 5, 2020

I don't see where we can use it now

As stated in my issue: For letting people try out your example with the quite fancy repl without spending 20 minutes on compilation.

All the platforms use native versions of the library and switching to wasm VM will only make things slower

How is the status of static linking? I was not able to build statically (which likely is to blame on me).
How is the status of compiling on the stable channel?

Regarding compilation, I'll start a list of blockers here (may not be exhaustive):

@hpk42
Copy link
Contributor

hpk42 commented Jan 22, 2020

Didn't follow in detail but I suggest to first try to get our rPGP dependency to work fully with WASM/wasi. This will also be useful by itself, as it would make rPGP available in Browsers and for webmail and other browser software. See #1198

@hpk42 hpk42 closed this as completed Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants