Crate secretspec

Source
Expand description

SecretSpec - A declarative secrets manager for development workflows

This library provides a type-safe, declarative way to manage secrets and environment variables across different environments and storage backends.

§Features

  • Declarative Configuration: Define secrets in secretspec.toml
  • Multiple Providers: Keyring, dotenv, environment variables, OnePassword, LastPass
  • Profile Support: Different configurations for development, staging, production
  • Type Safety: Optional compile-time code generation for strongly-typed access
  • Validation: Ensure all required secrets are present before running applications

§Example

use secretspec::{Secrets, Result};

fn main() -> Result<()> {
    // Load the secret specification
    let spec = Secrets::load()?;

    // Validate all secrets are present
    spec.check(None, None)?;

    // Run a command with secrets injected
    spec.run(vec!["npm".to_string(), "start".to_string()], None, None)?;

    Ok(())
}

Modules§

cli

Macros§

register_provider
Declarative macro for registering providers.

Structs§

Resolved
Container for resolved secrets with their context.
Secrets
The main entry point for the secretspec library
ValidatedSecrets
Container for validated secrets with metadata

Enums§

SecretSpecError
The main error type for secretspec operations

Type Aliases§

Result
A type alias for Result<T, SecretSpecError>