Skip to content

Commit

Permalink
Info about WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro committed Jun 26, 2024
1 parent bf3950e commit c70825f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
34 changes: 34 additions & 0 deletions did-imp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,37 @@ The plan is to eventually have a fully functional implementation for JVM and JS
- AdditionalAuthenticatedData - https://www.rfc-editor.org/rfc/rfc7518#section-5
- Keep meta information when decrypting a message
- Fail if the message decrypted is authenticated but does not match the 'from' field


## JS with WASM

Another approach is to use the RUST libraries for all the cryptography.
Call those methods through WebAssembly.

User `wasm-pack` to build the wasm.
Ex project https://github.com/rustwasm/wasm-pack-template build with `wasm-pack build --target web`

Config `vite.config.js` with `import wasm from "vite-plugin-wasm";`

### ScalaJS

Install the JS package with `npm install --save ./wasm/pkg`

```scala
import org.scalajs.dom._
val importObject = js.Dynamic.literal(imports = js.Dynamic.literal(imported_func = (p1) => println(p1)))
js.Dynamic.global.WebAssembly
.instantiateStreaming(fetch("simple.wasm"), importObject)
.`then`((obj: js.Dynamic) => obj.instance.exports.exported_func())
```

The ScalablyTyped plugin will generate the Facade. It can be called like this

```scala
import typings.myproject.mod
mod
.default() // "myproject_bg.wasm"
.`then` { e =>
mod.greet()
}
```
9 changes: 9 additions & 0 deletions webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

[See info about who to buind and run in demo](./../demo/README.md)

**Run Frontend:**

```shell
# Live reload
sbt '~serviceworker/fastLinkJS';
sbt '~webapp/fastLinkJS' # run on another console
npm run dev
```

## TODO LIST:

- Update to the [material-web version 3](https://github.com/material-components/material-web#readme).

0 comments on commit c70825f

Please sign in to comment.