Crates.io | mpc-relay |
lib.rs | mpc-relay |
version | 0.7.0 |
source | src |
created_at | 2023-06-13 06:22:44.766676 |
updated_at | 2024-07-09 04:31:00.80348 |
description | Noise protocol websocket relay for MPC/TSS applications |
homepage | |
repository | https://github.com/mpc-sdk/framework |
max_upload_size | |
id | 888730 |
size | 156,635 |
End-to-end encrypted relay service designed for MPC/TSS applications built using the noise protocol and websockets for the transport layer.
The service facilitates secure communication between peers but it does not handle public key exchange nor meeting points.
For clients to use the relay service they must know the public key of the server and the public keys of all the participants for a session.
Creating a meeting point that shares the session identifier between participants to execute an MPC/TSS protocol is left up to the application. Typically, this can be achieved by encoding the session identifier in a URL and sharing the URL with all the participants.
cargo install mpc-relay
The client implementation uses web-sys for webassembly and tokio-tungstenite for other platforms.
You will need the rust toolchain and a few other tools:
cargo install cargo-make
cargo install wasm-pack
Minimum supported rust version (MSRV) is 1.68.1.
Run the gen-keys
task to setup keypairs for the server and test specs:
cargo make gen-keys
Start a server:
cargo run -- start config.toml
cargo make doc
To run the tests using the native client:
cargo make test
To test the web client using webassembly, first start a test server (port 8008):
cargo make test-server
Now you can run the webassembly tests:
cargo make test-wasm
The webassembly tests cannot simulate key generation and signing as it is too computationally intensive for a single-threaded context and the integration tests would hit the browser script timeout before completion.
To run end to end tests for the web platform, first compile the webassembly bindings:
cargo make bindings
Then generate the test files:
cargo make gen-e2e
Start a server for the end-to-end tests:
cargo make e2e-server
Note we don't use the test-server
task as the e2e tests use a configuration with different timeout settings.
Then start a dev server (port 9009) used to serve the HTML and Javascript:
cargo make dev-server
Running the test specs requires playwright, so first install the dependencies for the end-to-end tests and then the playwright browsers:
cd tests/e2e
npm install
npx playwright install
Then you should be able to run the end-to-end tests:
npm test
Or run headed to see the browsers, which can be useful for debugging:
npm run test-headed
Or use the playwright UI:
npm run test-ui
If you need to debug the test specs you can also just open the pages manually in a browser, first open the initiator /cggmp/p1.html
and then open the participant pages /cggmp/p2.html
and /cggmp/p3.html
on the http://localhost:9009
development server.
The bindings and driver crates are released under the GPLv3 license and all other code is either MIT or Apache-2.0.