chore(crypto-js): Implement feedback from PR.

This commit is contained in:
Ivan Enderlin
2022-06-20 21:04:53 +02:00
parent 520e2f30f7
commit e5ea2a770b
4 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
/docs
/node_modules
/package-lock.json
/package-lock.json
+1 -1
View File
@@ -27,8 +27,8 @@ qrcode = ["matrix-sdk-crypto/qrcode"]
docsrs = []
[dependencies]
matrix-sdk-crypto = { version = "0.5.0", path = "../matrix-sdk-crypto" }
matrix-sdk-common = { version = "0.5.0", path = "../matrix-sdk-common" }
matrix-sdk-crypto = { version = "0.5.0", path = "../matrix-sdk-crypto" }
ruma = { version = "0.6.2", features = ["client-api-c", "js", "rand", "unstable-msc2676", "unstable-msc2677"] }
vodozemac = { git = "https://github.com/matrix-org/vodozemac/", rev = "d0e744287a14319c2a9148fef3747548c740fc36", features = ["js"] }
wasm-bindgen = "0.2.80"
+9 -8
View File
@@ -1,19 +1,19 @@
# `matrix-sdk-crypto-js`
Welcome to the [WebAssembly] + JavaScript binding for the Rust
[`matrix-sdk-crypto`] library! WebAssembly can run anywhere, but this
binding is designed to run on a JavaScript host. This binding is part
of the [`matrix-rust-sdk`] project, which is a library implementation
of a [Matrix] client-server.
[`matrix-sdk-crypto`] library! WebAssembly can run anywhere, but these
bindings are designed to run on a JavaScript host. These bindings are
part of the [`matrix-rust-sdk`] project, which is a library
implementation of a [Matrix] client-server.
`matrix-sdk-crypto-js` is a no-network-IO implementation of a state
`matrix-sdk-crypto` is a no-network-IO implementation of a state
machine, named `OlmMachine`, that handles E2EE ([End-to-End
Encryption](https://en.wikipedia.org/wiki/End-to-end_encryption)) for
[Matrix] clients.
## Usage
This WebAssembly binding is written in [Rust]. To build this binding, you
These WebAssembly bindings are written in [Rust]. To build them, you
need to install the Rust compiler, see [the Install Rust
Page](https://www.rust-lang.org/tools/install). Then, the workflow is
pretty classical by using [npm], see [the Downloading and installing
@@ -29,8 +29,9 @@ $ npm run build
$ npm run test
```
A `matrix_sdk_crypto.js`, `matrix_sdk_crypto.d.ts` and a `matrix_sdk_crypto_bg.wasm` files should be
generated in the `pkg/` directory.
A `matrix_sdk_crypto.js`, `matrix_sdk_crypto.d.ts` and a
`matrix_sdk_crypto_bg.wasm` files should be generated in the `pkg/`
directory.
TBD
+3 -3
View File
@@ -84,9 +84,9 @@ impl OlmMachine {
pub fn tracked_users(&self) -> Set {
let set = Set::new(&JsValue::UNDEFINED);
self.inner.tracked_users().into_iter().map(identifiers::UserId::from).for_each(|user| {
set.add(&user.into());
});
for user in self.inner.tracked_users() {
set.add(&identifiers::UserId::from(user).into());
}
set
}