https://github.com/jedisct1/rust-sealed_box
Sealed boxes implementation for Rust/WebAssembly.
https://github.com/jedisct1/rust-sealed_box
rust sealedbox wasm
Last synced: about 1 year ago
JSON representation
Sealed boxes implementation for Rust/WebAssembly.
- Host: GitHub
- URL: https://github.com/jedisct1/rust-sealed_box
- Owner: jedisct1
- License: mit
- Created: 2021-05-21T14:46:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-09T21:23:59.000Z (about 2 years ago)
- Last Synced: 2025-03-27T14:55:01.584Z (over 1 year ago)
- Topics: rust, sealedbox, wasm
- Language: Rust
- Homepage:
- Size: 213 KB
- Stars: 16
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sealed boxes for Rust/WebAssembly
This Rust crate provides [libsodium sealed boxes](https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes) for WebAssembly.
Usage:
```rust
// Recipient: create a new key pair
let recipient_kp = sealed_box::KeyPair::create();
// Sender: encrypt the message for the recipient whose public key is recipient_kp.pk
let msg = b"test";
let ciphertext = sealed_box::seal(msg, recipient_kp.pk);
// Recipient: decrypt the ciphertext using the key pair
let decrypted_msg = sealed_box::open(&ciphertext, &recipient_kp).unwrap();
assert_eq!(msg[..], decrypted_msg);
```
Compile with `cargo wasix`.