secrecy
Rust wrapper types that keep secrets out of logs, debug output, and Clone/Copy, and securely wipe them from memory on drop
Repository Health
Technical Analysis
secrecy is a small, forbid(unsafe_code) Rust crate built around one idea: a secret value (an API key, password, or private key) should be structurally hard to leak by accident. Its core SecretBox<T> type wraps any value so it cannot be printed via Debug, serialized, or copied without going through an explicit ExposeSecret trait call - forcing every place a secret is actually read to be visible and intentional in the code. When a SecretBox is dropped, its contents are zeroed out via the zeroize crate so the plaintext doesn’t linger in memory.
Maintained by iqlusion (part of the iqlusioninc/crates collection of Rust crates) alongside cryptography and key-management crates like zeroize and bip32, secrecy has become a common building block wherever Rust code handles credentials, tokens, or cryptographic key material and wants the type system to help prevent leaking them into logs or error messages.
What You Get
SecretBox<T>, a generic wrapper that stores any value as a secret and blocks its accidental exposure viaDebugor logging- The
ExposeSecrettrait, requiring callers to explicitly opt in every time they need the underlying secret value - Automatic memory zeroing on drop, built on the
zeroizecrate, so secret bytes don’t remain readable in freed memory - Optional
serdesupport (feature-gated) for deserializing owned secret values while minimizing accidental copies no_std-compatible design (withalloc), making it usable in embedded and constrained environments
Common Use Cases
- Wrapping API keys, tokens, or passwords in application config structs so they can’t be accidentally printed in logs or error messages
- Holding cryptographic key material in memory with a guarantee that it’s zeroed out as soon as it goes out of scope
- Passing secrets through a codebase where the type system should force every read site to be an explicit, auditable
expose_secret()call - Deserializing secret values from config files or environment variables via
serdewithout leaving extra plaintext copies around
Under The Hood
Architecture - The crate is intentionally minimal (a single ~350-line src/lib.rs): SecretBox<T> is a newtype wrapper around T, with manual (non-derived) implementations of Debug/Clone/etc. that either omit the inner value or route through explicit APIs, and a Drop impl that calls into the zeroize crate’s Zeroize trait to overwrite the memory before deallocation. The ExposeSecret trait is the single sanctioned way to read the wrapped value, keeping every access point grep-able and auditable. Tech Stack - Pure Rust, no_std-compatible with the alloc feature, depends only on zeroize (with optional serde support gated behind a cargo feature), uses Rust edition 2024 and requires Rust 1.85+; part of the iqlusioninc/crates Cargo workspace alongside related crates like zeroize and bip32. Code Quality - The crate carries a forbid(unsafe_code) attribute and a “Safety Dance” badge, signaling a deliberate constraint against unsafe blocks; being a thin wrapper crate, its correctness rests heavily on zeroize’s tested zeroing guarantees rather than a large internal test suite of its own. API Design - The API surface is deliberately tiny - construct a SecretBox, and read it only via expose_secret() - trading flexibility for a hard-to-misuse guarantee, which is the entire point of the crate.
Used by 7 apps in this directory
Fern
Developer Tools
Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
Latitude
AI Agents · Monitoring
Open-source AI agent monitoring that catches what will break next before your users do.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.
PeerDB
Data Engineering · Databases
Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.
Tabby
AI Code Assistants
Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.
Vibe Kanban
AI Agents · AI Code Assistants · Project Management
A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.