| Crates.io | herosal-vault |
| lib.rs | herosal-vault |
| version | 0.1.1 |
| created_at | 2025-12-13 07:04:01.375403+00 |
| updated_at | 2025-12-14 13:31:55.900165+00 |
| description | SAL Vault - Secure key management and cryptographic operations |
| homepage | |
| repository | https://github.com/threefoldtech/sal |
| max_upload_size | |
| id | 1982682 |
| size | 59,986 |
A secure, encrypted key-value store system for the System Abstraction Layer (SAL).
SAL Vault provides a two-tiered encrypted storage system:
Vault
├── KeySpace 1 (encrypted with password A)
├── KeySpace 2 (encrypted with password B)
└── KeySpace N (encrypted with password N)
Each keyspace is independently encrypted, allowing different access controls and security boundaries.
use sal_vault::{Vault, Error};
use std::path::Path;
#[tokio::main]
async fn main() -> Result<(), Error> {
// Create a new vault at the specified path
let vault = Vault::new(Path::new("./my_vault")).await?;
// Open an encrypted keyspace
let keyspace = vault.open_keyspace("user_data", "secure_password").await?;
// Use the keyspace for encrypted storage
// (KeySpace API documentation coming soon)
Ok(())
}
The vault also supports WASM targets with browser-compatible storage:
#[cfg(target_arch = "wasm32")]
async fn wasm_example() -> Result<(), Error> {
let vault = Vault::new().await?; // No path needed for WASM
let keyspace = vault.open_keyspace("session_data", "password").await?;
Ok(())
}
The vault uses a comprehensive error system:
use sal_vault::Error;
match vault.open_keyspace("test", "password").await {
Ok(keyspace) => {
// Success - use the keyspace
}
Err(Error::IOError(io_err)) => {
// Handle I/O errors (file system issues)
}
Err(Error::CryptoError(crypto_err)) => {
// Handle cryptographic errors (wrong password, corruption)
}
Err(other) => {
// Handle other errors
}
}
This vault implementation replaces the previous Ethereum-focused vault. Key differences:
The previous implementation is preserved in _archive/ for reference and potential feature extraction.
When contributing to the vault module:
This module is part of the SAL project and follows the same licensing terms.