Keyden
Keyden is a lightweight tool for managing, rotating, and retrieving secret keys.
It is designed to be both a fast command-line utility and a pure Rust library โ making secure key management simple for applications and developers.
โจ Features
- ๐ Secure Secret Management: Manage printable secret keys for sessions, tokens, password resets.
- ๐ Key Rotation: Rotate keys based on age or minimum key count.
- โก Blazing Fast: Pure
std, no async runtime needed. - ๐งน Minimalistic CLI: Clean commands for scripting and automation.
- ๐ Library First: Fully embeddable inside any Rust server, CLI or worker.
- ๐ ๏ธ Transparent Format: Human-readable key files, simple for backups.
๐ญน Design Philosophy
Keyden is built to be:
- Sync-first: No async or futures overhead unless necessary.
- Memory efficient: Minimal allocations, small footprint.
- Concurrency safe: Internal fast
RwLockwithparking_lot. - Extensible: Plug different backends easily (e.g., database, encrypted stores).
- Transparent and Simple: Files are plain, portable, and auditable.
๐ฆ Installation
Install Keyden CLI:
Or include it in your project:
[]
= "0.1"
๐ ๏ธ CLI Usage
Keyden CLI manages secret keys through four subcommands:
| Subcommand | Description |
|---|---|
rotate [file] |
Rotate keys. Generates new ones if count is insufficient. |
current [file] |
Print the latest active secret key. |
list [file] |
List all keys and their creation timestamps. |
generate |
Generate a one-time temporary secret key (not stored). |
๐น Examples
Rotate keys in a file:
Rotate with custom key size:
Retrieve the current active key:
List all keys:
Generate a temporary secret key without storing:
๐น Environment variable: KEYDEN_FILE
Instead of providing [file] every time, you can set a default file path:
If the positional file argument is missing, Keyden automatically tries $KEYDEN_FILE.
๐ Using Keyden as a Library
Add to your Cargo.toml:
[]
= "0.1"
Example Rust usage
use FileKeyStore;
use KeyManager;
๐ Important Security Notes
- Keyden does not encrypt key files. Set correct permissions (
chmod 600 keys.txt). - The file format is portable and easy to parse in any environment.
- Rotate keys regularly for high-security environments.
๐ ๏ธ Project Structure
keyden/
โโโ src/
โ โโโ main.rs # CLI entry point
โ โโโ lib.rs # Library exports
โ โโโ commons.rs # Common types: KeyStore, KeyMaterial
โ โโโ file_store.rs # File-based KeyStore backend
โ โโโ key_manager.rs # KeyManager: rotation, reload, listing
โ โโโ utils.rs # Helpers (e.g., generate_secret)
โโโ Cargo.toml
โโโ README.md
โโโ .gitignore
โโโ LICENSE
๐ License
Licensed under either of:
- MIT License
- Apache 2.0 License
at your option.