Crates.io | sodoken |
lib.rs | sodoken |
version | 0.0.901-alpha |
source | src |
created_at | 2020-12-17 18:52:03.419136 |
updated_at | 2024-04-26 17:41:08.157871 |
description | libsodium wrapper providing tokio safe memory secure api access. |
homepage | |
repository | https://github.com/holochain/sodoken |
max_upload_size | |
id | 323998 |
size | 246,991 |
lib SOdium + haDOKEN = SODOKEN!
Thin wrapper around libsodium-sys-stable.
use sodoken::*;
let mut pub_key = [0; sign::PUBLICKEYBYTES];
let mut sec_key = LockedArray::new().unwrap();
sign::keypair(&mut pub_key, &mut sec_key.lock()).unwrap();
let mut sig = [0; sign::SIGNATUREBYTES];
sign::sign_detached(&mut sig, b"hello", &sec_key.lock()).unwrap();
assert!(sign::verify_detached(&sig, b"hello", &pub_key));
assert!(!sign::verify_detached(&sig, b"world", &pub_key));