Crates.io | sealed_box |
lib.rs | sealed_box |
version | 0.2.8 |
source | src |
created_at | 2021-05-21 14:46:11.130716 |
updated_at | 2024-05-09 21:23:52.281053 |
description | Libsodium sealed_box construction for Rust/WebAssembly |
homepage | https://github.com/jedisct1/rust-sealed_box |
repository | https://github.com/jedisct1/rust-sealed_box |
max_upload_size | |
id | 400361 |
size | 71,981 |
This Rust crate provides libsodium sealed boxes for WebAssembly.
Usage:
// 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
.