Skip to content

feat: add PyPI and crates.io wrappers#27

Merged
rafaelperoco merged 1 commit into
mainfrom
chore/pypi-crates-wrappers
May 3, 2026
Merged

feat: add PyPI and crates.io wrappers#27
rafaelperoco merged 1 commit into
mainfrom
chore/pypi-crates-wrappers

Conversation

@rafaelperoco
Copy link
Copy Markdown
Owner

Closes part of #13.

Adds two language wrappers around the CLI so the obvious-search install path works in Python and Rust ecosystems:

  • pip install secretgenerator — pure-Python wrapper at python/. secretgenerator.password(), .passphrase(), .secret(), .api_key(), .pin(), .entropy() return parsed schema-v1 dicts. SecretgeneratorError.code exposes the stable error code (E_ENTROPY_TOO_LOW, etc.) so callers branch on identifiers rather than message strings.
  • cargo add secretgenerator — typed Rust crate at rust-crate/. Builder-pattern options structs (PasswordOptions::default().length(24).charset("alphanum-symbols-v1")), Output and CrackTimeEstimate derive serde, Error::cli_code() exposes the stable code.

Why wrappers, not reimplementations: cryptographic primitives stay in the audited binary with SLSA L3 + cosign keyless. The wrappers just parse JSON.

Both ship CI workflows that:

  • Install the latest CLI via the composite action (setup-secretgenerator)
  • Build + test on ubuntu/macos/windows
  • For Rust: cargo fmt --check and cargo clippy -D warnings

10 pytest cases cover schema pinning, error codes, required-classes guarantee, etc. — all green locally. cargo run --example quickstart produces the expected output.

@rafaelperoco rafaelperoco merged commit ef01ca0 into main May 3, 2026
21 checks passed
@rafaelperoco rafaelperoco deleted the chore/pypi-crates-wrappers branch May 3, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant