Expand description
Rust bindings for the auditable
secretgenerator
CLI.
Each function in this crate corresponds to a CLI subcommand. The
function shells out to secretgenerator, parses the schema-v1 JSON
envelope, and returns a typed Output. When the CLI exits
non-zero a Error::Cli is returned with the structured error
envelope attached so callers can branch on stable error codes
(E_ENTROPY_TOO_LOW, E_CHARSET_EMPTY, E_CLASS_IMPOSSIBLE, etc.)
rather than parsing free-form messages.
§Install the binary
npm install -g @secretgenerator/cli
# or: brew install rafaelperoco/tap/secretgenerator
# or: go install github.com/rafaelperoco/secretgenerator/cmd/secretgenerator@latest§Quick start
use secretgenerator::{password, PasswordOptions};
let out = password(
PasswordOptions::default()
.length(24)
.charset("alphanum-symbols-v1")
.require_classes("lower,upper,digit,symbol"),
)?;
println!("{} ({} bits)", out.password, out.entropy_bits);Structs§
- ApiKey
Options - CliFailure
- Detailed CLI failure payload, boxed in
Error::Cliso the enum stays small. - Crack
Time Estimate - One attacker scenario applied to a credential’s entropy.
- Error
Detail - Error
Envelope - Structured error envelope emitted by the CLI when a subcommand
fails. The
codefield is the part of the contract you are meant to branch on. - Estimate
Output - Schema-v1 envelope for the
entropysubcommand. The CLI does not echo the password it analyzes, soOutputwould not deserialize cleanly — this struct keeps just the fields the subcommand populates. - Output
- Schema-v1 envelope returned by every generation subcommand.
- Passphrase
Options - Password
Options - Builder for
password. - PinOptions
- Secret
Options
Enums§
- Error
- Error type returned by every function in this crate.
Constants§
- SCHEMA_
VERSION - The schema version this crate is pinned to.