Skip to main content

Module fleet_secrets

Module fleet_secrets 

Source
Expand description

Fleet-wide, tenant-agnostic provider API key & config storage.

Stores encrypted-at-rest provider overrides in PostgreSQL (loaded by ares-store::fleet_provider_secrets), decrypts into an in-memory Arc<ArcSwap<FleetSecrets>> map for lock-free hot-swap reads.

Encryption: AES-256-GCM (RustCrypto aes-gcm) with a 96-bit nonce from OsRng per encryption. Master key is SHA-256 of FLEET_SECRETS_KEY env var, wrapped in Zeroizing so it is zeroed on drop.

If FLEET_SECRETS_KEY is unset the module logs a single warning and treats all getters as returning None — the service does NOT refuse to start (OSS deployments without UI never set the master key).

Structs§

EncryptedPayload
AES-256-GCM ciphertext with its 96-bit nonce. Stored side-by-side so the loader does not have to track nonces separately.
FleetSecrets
Decrypted, in-memory fleet secrets state. Cheap to clone (it’s an Arc<ArcSwap<...>> under the hood), so callers can hand the wrapper directly to handlers.
MasterKey
Master-key wrapper that zeroes itself on drop. Cheap to clone via Arc.
ProviderOverride
In-memory decrypted view of a single provider override row.

Enums§

FleetSecretsError
Fixed-length error type for the fleet-secrets module.

Functions§

decrypt_api_key
Decrypt a previously-encrypted payload back to the plaintext API key.
encrypt_api_key
Encrypt a UTF-8 plaintext API key. Returns the ciphertext + nonce.
last_n_visible
Return the last n chars of a key, prefixed with , for safe display. Returns None for empty input.