Crates.io | ovunto-security |
lib.rs | ovunto-security |
version | 0.1.16 |
source | src |
created_at | 2024-03-01 13:57:28.393413 |
updated_at | 2024-08-03 16:14:20.625757 |
description | A library for secure end-to-end communication between clients through a server. |
homepage | |
repository | https://github.com/Galitan-dev/Ovunto-Security |
max_upload_size | |
id | 1158931 |
size | 199,012 |
Ovunto Security is a Rust library for secure end-to-end communication between clients through a server. It provides functionality for encrypting and decrypting messages, managing keys, and constructing cryptographic chains.
Add this crate to your Cargo.toml
[dependencies]
ovunto-security = "0.1.0"
use ovunto_security::{Error, Keyring, Salt};
fn main() -> Result<(), Error> {
let (username, password) = form().map_err(|_| Error)?;
let salt = Salt::random();
let keyring = Keyring::derive_from(password, &salt)?;
let mut sender_chain = keyring.into_chain();
let cipher1 = sender_chain.add(format!("{username} initiated a chain"))?;
let cipher2 = sender_chain.add("Some cookies!".to_owned())?;
let mut receiver_chain = keyring.into_chain();
let change1 = receiver_chain.decrypt(cipher1.clone())?;
let change2 = receiver_chain.decrypt(cipher2.clone())?;
println!("{:?}", (cipher1, cipher2));
println!("{:?}", (change1, change2));
Ok(())
}
API documentation for this crate can be found on docs.rs.
This project is licensed under the MIT License - see the LICENSE file for details.