Skip to content

config

Structs

Enums


Struct

Authority configuration loaded from TOML file and/or environment variables.

The field shape and default values live in [firma_config_schema::authority::AuthorityConfig]; this type adds the Authority’s behavior: path re-basing against the config directory and FIRMA_AUTHORITY_-prefixed environment overrides, which take precedence over TOML values (e.g., FIRMA_AUTHORITY_LISTEN_ADDR).

Fields are private: the only way to obtain an AuthorityConfig is [AuthorityConfigBuilder::build], which validates runtime and cross-field invariants. An invalid AuthorityConfig therefore cannot be constructed; read access is through the accessors below.

This type is deliberately not Serialize: the wire representation is [schema::AuthorityConfig], obtained via [AuthorityConfig::to_schema].

Methods:

  • fn listen_addr(self: &Self) -> &str - gRPC listen address.
  • fn policy_dir(self: &Self) -> &Path - Directory of .cedar policies streamed to sidecars for enforcement.
  • fn schema_path(self: &Self) -> Option<&Path> - Optional override path to the Cedar schema file.
  • fn revocation_file(self: &Self) -> &Path - Path to the revocation file.
  • fn max_ttl_seconds(self: &Self) -> NonZeroU32 - Strictly positive maximum token TTL in whole seconds.
  • fn key_file(self: &Self) -> &Path - Path to the Ed25519 signing key file.
  • fn bundle_ttl_seconds(self: &Self) -> NonZeroU32 - Strictly positive policy bundle TTL advertised to sidecars in whole seconds.
  • fn tls(self: &Self) -> &AuthorityTlsConfig - TLS configuration.
  • fn to_schema(self: &Self) -> Result<schema::AuthorityConfig, ConfigError> - Map back to the behavior-free [schema::AuthorityConfig] wire shape.
  • fn from_resolved_section(resolved: &firma_config_loader::ResolvedConfig, state: &RuntimeLayout, tls: TlsRequest) -> Result<Option<Self>, ConfigError> - Load Authority configuration from the [authority] section of a

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> Self

firma_authority::config::AuthorityConfigBuilder

Section titled “firma_authority::config::AuthorityConfigBuilder”

Struct

Assembles a validated [AuthorityConfig].

The builder retains the schema representation while applying path rebasing and FIRMA_AUTHORITY_-prefixed environment overrides. build then converts durations to the Authority’s whole-second runtime shape and validates cross-field invariants. A built AuthorityConfig is therefore always valid: nothing after build mutates or re-validates it.

Typical order is rebase, then env overrides (kept verbatim), then build:

let config = AuthorityConfigBuilder::from_toml_str(&body, state)?
.rebase_defaults(config_dir)
.apply_env_overrides()?
.build()?;

Methods:

  • fn new(schema: schema::AuthorityConfig, state: &RuntimeLayout) -> Self - Start from a schema representation (typically deserialized from TOML)
  • fn from_toml_str(contents: &str, state: &RuntimeLayout) -> Result<Self, toml::de::Error> - Start from an [authority] TOML fragment, resolving unset artifact
  • fn rebase_defaults(self: Self, config_dir: &std::path::Path) -> Self - Re-base the config’s relative resource paths against config_dir.
  • fn listen_addr<impl Into<String>>(self: Self, addr: impl Trait) -> Self - Override the listen address on the in-progress config.
  • fn without_tls(self: Self) -> Self - Turn TLS off for this config, overriding explicit paths, environment
  • fn build(self: Self) -> Result<AuthorityConfig, AuthorityConfigError> - Validate the fully-resolved config and return it.

firma_authority::config::AuthorityConfigError

Section titled “firma_authority::config::AuthorityConfigError”

Enum

Error validating an [AuthorityConfig].

Variants:

  • MissingMappingPaths - No enforcement mapping source was selected.
  • EmptyMappingPath{ index: usize } - A selected mapping source has an empty path.
  • DurationOutOfRange{ field: &'static str } - A human-readable duration exceeds the downstream whole-second integer range.
  • DurationNotWholeSeconds{ field: &'static str } - A human-readable duration contains a fractional second.
  • TlsPairMismatch - tls_cert_path and tls_key_path were not both set or both unset.
  • MtlsPairMismatch - mtls_client_ca_cert_path and authorized_clients_path were not paired.
  • TlsMaterialIncomplete{ dir: String } - Only one half of the state-directory TLS pair exists on disk.
  • TlsMaterialMissing{ dir: String } - No TLS was configured and the state directory holds no material either.
  • MtlsRequiresServerTls - mTLS was configured without the base server TLS cert/key.
  • MtlsIssuerKeyWithoutClientCa - The client CA signing key was configured without the CA it signs for.

Traits: Error, Eq

Trait Implementations:

  • Display
    • fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result
  • Clone
    • fn clone(self: &Self) -> Self
  • PartialEq
    • fn eq(self: &Self, other: &Self) -> bool
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result

firma_authority::config::AuthorityMtlsConfig

Section titled “firma_authority::config::AuthorityMtlsConfig”

Struct

Client-certificate trust for Sidecar connections.

Present only on a TLS-enabled server: requiring a client certificate is meaningless without a handshake to require it in.

Methods:

  • fn client_ca_cert(self: &Self) -> &Path - Path to the PEM CA certificate Sidecar client certs are verified against.
  • fn client_ca_key(self: &Self) -> Option<&Path> - Path to the PEM CA private key that signs new Sidecar client certs.

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> Self

firma_authority::config::AuthorityTlsConfig

Section titled “firma_authority::config::AuthorityTlsConfig”

Enum

TLS posture of the Authority gRPC server.

The wire keys (tls_cert_path, tls_key_path, …) live on [schema::AuthorityConfig] as independent options; this is their validated in-memory form, where the pairing rules are structural rather than checked: a half-configured server cannot be named.

Variants:

  • Disabled - Serve plaintext gRPC.
  • Enabled(AuthorityTlsMaterial) - Serve TLS with the given material.

Methods:

  • fn material(self: &Self) -> Option<&AuthorityTlsMaterial> - Server TLS material, or None when the Authority serves plaintext.

Trait Implementations:

  • Default
    • fn default() -> Self
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> Self

firma_authority::config::AuthorityTlsMaterial

Section titled “firma_authority::config::AuthorityTlsMaterial”

Struct

Server TLS material, plus the mTLS client trust it optionally enforces.

Methods:

  • fn cert(self: &Self) -> &Path - Path to the PEM server certificate.
  • fn key(self: &Self) -> &Path - Path to the PEM server private key.
  • fn mtls(self: &Self) -> Option<&AuthorityMtlsConfig> - Client-certificate trust, when the server demands one.

Trait Implementations:

  • Clone
    • fn clone(self: &Self) -> Self
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result

Enum

Variants:

  • IoError{ path: std::path::PathBuf, reason: String }
  • ParseError{ path: std::path::PathBuf, reason: String }
  • InvalidEnvironmentVariable{ name: &'static str, field: &'static str, reason: String }

Traits: Error

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Display
    • fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result

Enum

What a caller wants of TLS before the config is resolved.

Distinct from [AuthorityTlsConfig], which is the outcome: this is the request, and Required still has to find material to become [AuthorityTlsConfig::Enabled].

Named rather than a bool because the two values are not a presence test and read identically at a call site: from_resolved_section(&resolved, &state, true) gives no hint that true means plaintext.

Variants:

  • Required - Serve TLS, from the configured pair or the state directory’s.
  • Disabled - Serve plaintext gRPC, whatever material the host holds.

Traits: Copy, Eq

Trait Implementations:

  • Default
    • fn default() -> Self
  • PartialEq
    • fn eq(self: &Self, other: &Self) -> bool
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> Self