A safe, simple, and consistent Rust wrapper around the libsodium-rs crate.
librsodium exposes a clean, JSON‑ready API for all cryptographic primitives provided by libsodium, making them easier to use and harder to misuse.
libsodium-rs already provides excellent bindings to the C libsodium library.
However, its API is low‑level and requires manual error handling, memory management, and type juggling.
librsodium adds:
- Uniform response type – every function returns
LibrsodiumResponse<T>withsuccess,data, anderrorfields. Call.to_json()for instant JSON serialization. - Strict input validation – invalid sizes, empty buffers, or out‑of‑range values are rejected immediately with machine‑readable error codes.
- Consistent naming – all functions follow a predictable naming scheme.
- Full test coverage – every function is tested for both success and error paths.
- Zero unsafe in user code – the wrapper uses
libsodium-rsinternally, so you never touchunsafe.
This project is licensed under the MIT License.
librsodium is built on top of the excellent libsodium-rs bindings by Frank Denis and contributors.
This project is still under development