At the behest of the excellent Quorum Control company, I have
carried out my first foray into both Rust and Web Assembly (abbr. Wasm), making a
library. The reason behind this undertaking is that Quorum Control (and others) need
BLS cryptographic signature
solid implementation of this although in the Rust language.
Luckily, there are facilities for converting Rust code into Web Assembly, i.e. the
of Indy Crypto. In practice, this is done by writing a set of Rust functions tagged so that they
get exported by the binding generated by wasm-bindgen. Additionally, we produce two variants of
the binding: One for Node.js and one for ECMAScript modules aware systems (such as the Webpack
bundler), in order for it to work both server side and in the browser.
Using the binding from Node.js (i.e. on the server side) proved to be relatively
straightforward, but importing it in the browser was trickier than I foresaw. The approach that
include the Wasm code correctly, and to import this bundle
dynamically as otherwise the
Wasm import would fail.
There’s API documentation in docs/index.html. You can also find an example of using
as it turned out to be non-trivial (e.g. having to be dynamically imported).