docs.rs failed to build secure-gate-0.4.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
secure-gate-0.7.0-rc.14
secure-gate
Zero-overhead, no_std-compatible secret wrappers with configurable zeroization.
v0.4.1 – 2025-11-20
New in 0.4.1 – Configurable Zeroization Modes
use ;
let pw = new; // Safe mode (default)
let pw_full = new_full_wipe; // Full wipe (incl. slack)
let pw_pass = new_passthrough; // No extra wiping
let pw_custom = with_mode;
Safe(default) – wipes only used bytes (nounsafe)Full– wipes entire allocation including spare capacity (unsafe-wipefeature)Passthrough– relies only on inner type’sZeroizeimpl
Perfect for defense-in-depth, compliance, or performance trade-offs.
Features
| Feature | Effect |
|---|---|
zeroize |
Enables zeroization via secrecy + zeroize (on by default) |
stack |
Zero-allocation fixed-size secrets using Zeroizing<T> (on by default) |
unsafe-wipe |
Enables Full zeroization mode (wipes spare capacity) |
serde |
Serialization support |
full |
All features above |
no_std+alloccompatible- Zero runtime overhead when
zeroizeis disabled - Redacted
Debugoutput - Full test coverage including timing safety
Installation
[]
= "0.4.1"
Enable full wiping:
= { = "0.4.1", = ["unsafe-wipe"] }
Quick Start
use ;
// Immutable password (recommended)
let pw: SecurePassword = "hunter2".into;
assert_eq!;
// Mutable builder
let mut builder = from;
builder.expose_secret_mut.push_str;
let pw: SecurePassword = builder.build;
// Fixed-size keys (stack-allocated when `stack` enabled)
let key = secure!; // Zeroizing<[u8; 32]>
let key = key32; // same thing
Accessors
let secret: &str = gate.expose_secret;
let secret: &mut String = gate.expose_secret_mut;
Use .expose_secret() — it's the canonical, zero-cost way.
Why secure-gate?
- Zero overhead when zeroization is disabled
- True stack allocation for fixed-size keys
- Configurable wiping strategy — from safe to paranoid
- No breaking changes from 0.3.x → 0.4.x (deprecated aliases preserved)
- Extensively tested including slack wiping, timing variance, and concurrency
Migration from 0.3.x
All your existing code continues to compile:
use SecurePassword; // still works
use Secure; // deprecated but available
Only the underlying generic type changed:
// Old
let s = new;
// New (recommended)
let s = new;
// or
type SG<T> = ;
let s = SGnew;
License
Dual-licensed under MIT OR Apache-2.0, at your option.