Introducing a new way to review your PRs.

Read the announcement

jdx / fnox

encrypted/remote secret manager

View on GitHub

27 documents · Updated Nov 23, 2026

docs / local-and-hardware-providers

Local and hardware secret providers

Local and hardware secret providers let fnox keep values on the developer's machine or tie encryption to a physical key. They cover direct values for simple cases, encrypted values for files and local stores, references to password systems, and hardware-backed encryption for secrets that must not be usable without a device.

Provider roles

The provider layer gives each backend the same high-level contract: retrieve a secret, store a secret when the backend permits it, encrypt a value when it is an encryption provider, and report whether it is ready. The contract also supports batch reads and batch encryption so a provider can avoid repeating user interaction for each value. A secret declaration names the provider and gives it either an opaque stored value or a backend reference.

Value handling

Providers fall into two useful groups for this page. Config encryption providers return ciphertext that can live in a config file. External storage providers keep the value in a local store or service and put only a name or reference in the config. Read-only password services, such as 1Password, resolve references but do not provide a place for fnox set to write values.

ProviderWhere the secret value livesMain useInteraction
PlainConfig file as writtenNon-sensitive defaults and testsNone
AgeEncrypted config valuePortable local encryptionPrivate age or SSH identity when reading
Password-storeGPG-encrypted pass filesUnix-style local storage and syncpass and an available GPG key
OS keychainNative credential storePer-machine bootstrap and local secretsOS access control or approval
KeePassLocal .kdbx databaseOffline structured storageDatabase password and optional keyfile
1Password1Password vaultTeam-managed read accessop CLI and service-account or session auth
FIDO2Encrypted config valueEncryption tied to a FIDO2 keyKey assertion and possible PIN
YubiKeyEncrypted config valueEncryption tied to a YubiKeyHMAC challenge-response and a tap

The common contract also lets the rest of fnox treat these providers in the same resolution flow. A command can ask for a value without knowing whether the provider reads a file, calls a CLI, queries a keychain, or decrypts local ciphertext.

References: crates/…/mod.rs• L171-255 crates/…/plain.rs• L8-46 crates/…/plain.toml• L1-11

Local value and file providers

These providers keep the value on the local machine or in files that the user controls. They differ in the protection boundary: Plain has no protection, Age protects the config value itself, and the two password stores place the value in a separate encrypted database or file tree.

For providers with file paths, fnox resolves a relative path from the config source that defines the active provider. A profile-specific provider therefore keeps its Age key, Password-store directory, or KeePass database tied to the file that supplies that provider declaration.

Plain values

The Plain provider returns the configured value unchanged and writes it unchanged. It needs no setup and is intended for non-sensitive data, development, and tests. It must not be treated as a secret-at-rest control because anyone who can read the config can read the value.

References: crates/…/plain.rs• L8-46 crates/…/plain.toml• L1-11

Age encryption

The Age provider encrypts values locally so the config can hold ciphertext rather than plaintext. It encrypts for one or more recipients and decrypts with a matching identity, which may come from inline environment data, a configured file, or another provider such as the OS keychain.

Age accepts native age recipients, SSH public keys, and age plugin recipients. This makes it suitable for offline work and shared config files, but access depends on the private identity and the recipient list. Adding a recipient does not unlock old ciphertext by itself; the affected values must be encrypted again for the new recipient.

When fnox handles several Age values as one batch, Age wraps one temporary batch key and uses it for the values in that batch. This lets a shared identity or plugin interaction happen once for the batch instead of once for every value. Single-value data continues to use the normal Age format.

References: crates/…/age.rs• L64-93 crates/…/age.rs• L174-278 crates/…/age.rs• L281-362 crates/…/age.rs• L367-482 crates/…/age.toml• L1-30

Password-store files

The Password-store provider uses the standard Unix pass store as an external storage backend. Each secret maps to a path in a GPG-encrypted file tree, and an optional prefix gives all fnox entries a separate name space. The config keeps the path while pass and GPG protect the value.

Reads and writes go through the pass command. The store can therefore use the normal pass layout and its existing sync methods, but the local machine still needs the CLI, an initialized store, and access to the right GPG key. A store path and GPG options can come from provider settings or the matching environment settings.

References: crates/…/password_store.rs• L6-10 crates/…/password_store.rs• L26-49 crates/…/password_store.rs• L120-227 crates/…/password-store.toml• L1-27

KeePass database

The KeePass provider reads and writes secrets in a local KeePass .kdbx database. A reference names an entry and can select fields such as password, username, URL, or notes. Group paths allow the same database to organize values by environment or application.

The database opens with a master password and may also use a keyfile. If the configured database does not exist, the first write can create it. This provider is offline and structured, but the database file, its backup plan, and any sync method remain the user's responsibility.

References: crates/…/keepass.rs• L11-16 crates/…/keepass.rs• L31-100 crates/…/keepass.rs• L196-228 crates/…/keepass.rs• L352-466 crates/…/keepass.toml• L1-28

Operating-system and password-manager providers

These providers place the protection boundary outside the config file. The OS keychain uses the machine's native credential store, while 1Password uses a password service reached through its CLI. Both store references in fnox rather than the secret value, but their portability and authentication models are different.

OS keychain

The OS keychain provider stores each value in the platform's secure credential store. On macOS this is Keychain; on Windows it is Credential Manager; on Linux it uses a Secret Service backend such as GNOME Keyring or KWallet. The configured service name forms a namespace, and an optional prefix separates a project's entries inside that service.

This provider is best for a small set of machine-local or bootstrap secrets. It can require an unlocked keychain, a desktop session, or user approval. A useful relationship is to store one Age identity or one provider token in the keychain and keep larger groups of secrets behind that value rather than creating a keychain prompt for every secret.

References: crates/…/keychain.rs• L10-52 crates/…/keychain.rs• L55-95 crates/…/keychain.rs• L98-193 crates/…/keychain.toml• L1-23

1Password

The 1Password provider reads item fields through the 1Password op CLI. A short reference such as an item name or item/field is expanded using the configured vault; a full op://vault/item/field reference can name the vault directly. The default field for a short item reference is password.

Authentication comes from a service-account token or an op session. The provider is read-only in the provider contract, so it is suited to consuming team-managed values rather than storing new values from fnox. For a group of secrets, it can ask the CLI to resolve them together and falls back to individual reads when needed.

References: crates/…/onepassword.rs• L16-20 crates/…/onepassword.rs• L35-81 crates/…/onepassword.rs• L268-407 crates/…/1password.toml• L1-30

Hardware-backed encryption

Hardware providers use a device response as the root of a local encryption key. The device response is not stored in the config. Instead, fnox derives a symmetric key from it and stores only the resulting ciphertext, so a copied config is not enough to decrypt the value.

Shared encryption model

FIDO2 and YubiKey use different device protocols but the same later protection model. fnox derives an AES-256-GCM key with HKDF-SHA256, creates a fresh nonce for each encryption, and stores a base64 blob containing the nonce and authenticated ciphertext.

The provider name is part of the derivation context. This keeps separate provider instances from sharing derived keys, but it also means that renaming a hardware provider changes the key context. Existing values must be re-encrypted after such a rename.

The following diagram shows the shared hardware path from a physical device to a stored value.

flowchart LR
    A[Physical key] --> B[Device response]
    B --> C[HKDF-SHA256 with provider context]
    C --> D[AES-256-GCM key]
    D --> E[Encrypt value with fresh nonce]
    E --> F[Base64 ciphertext in config]
    F --> G[Same key response required to decrypt]

References: crates/…/hw_encrypt.rs• L1-5 crates/…/hw_encrypt.rs• L13-25 crates/…/hw_encrypt.rs• L48-77 crates/…/mod.rs• L195-255

FIDO2

The FIDO2 provider uses the CTAP2 hmac-secret extension on a compatible security key. Setup creates a credential, records its identifier and a random salt, and checks that the key can return the needed secret. At use time, an assertion can require a PIN and a physical touch.

FIDO2 is device-portable across machines when the same key and provider settings move with the encrypted config. It supports any compatible FIDO2 authenticator rather than only YubiKey devices. Within one process, the device response is cached so a command that resolves several values does not ask for repeated touches.

References: crates/…/fido2.rs• L33-75 crates/…/fido2.rs• L78-152 crates/…/fido2.rs• L160-207 crates/…/fido2.toml• L1-39

YubiKey

The YubiKey provider uses the YubiKey HMAC-SHA1 challenge-response feature. Setup records a generated challenge and slot, then verifies the response. Later encryption and decryption require the same YubiKey and the same configured slot.

This provider is specific to YubiKey's OTP-capable HMAC interface. A FIDO2-only security key is not a substitute for this provider, although a YubiKey can support both the YubiKey and FIDO2 provider models when its features are configured. The response is cached for the process after a successful tap.

References: crates/…/yubikey.rs• L17-71 crates/…/yubikey.rs• L74-95 crates/…/yubikey_usb.rs• L17-33 crates/…/yubikey_usb.rs• L538-587 crates/…/yubikey.toml• L1-27

Provider selection

The right choice depends on where the value must live and what must be present to read it. The following distinctions describe the intended boundaries rather than a strict ranking.

Protection boundaries

NeedSuitable providerReason
A harmless fixed valuePlainNo setup and direct value handling
Encrypted values that can move with a projectAgeCiphertext can stay with the config and work offline
A Unix file-tree workflowPassword-storeUses GPG files and the pass ecosystem
An offline database with groups and fieldsKeePassKeeps structured entries in a .kdbx file
A few secrets tied to one machineOS keychainUses native OS access control
Team-managed read access1PasswordUses vault policy and CLI authentication
Encryption that requires a physical authenticatorFIDO2 or YubiKeyThe device response is required for decryption

The providers can also be combined. For example, an OS keychain can hold an Age identity or a 1Password token, while Age protects the larger set of values in a shared config. Hardware providers serve the same bootstrap role when the project requires a physical presence instead of a software key.

References: crates/…/mod.rs• L44-63 crates/…/mod.rs• L195-240 crates/…/age.toml• L1-10 crates/…/keychain.toml• L1-11

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep provider metadata, config resolution, provider construction, and wizard behavior aligned when adding or renaming a provider. The provider metadata drives generated provider types and setup information.
  • Re-encrypt existing Age values when the recipient set changes. Re-encrypt hardware-protected values when the provider name or hardware derivation context changes.
  • Treat changes to a keychain service or prefix, Password-store prefix or directory, KeePass database path, or 1Password vault as reference migrations. Existing secret declarations may still point to the old location.
  • Check relative file paths when a provider moves between top-level and profile config. The active provider's source file determines where its Age key, Password-store directory, or KeePass database path points.
  • Preserve the authentication contract for external CLIs. The provider must continue to pass the expected token, session, store, or GPG settings to the tool that owns the secret.
  • Keep hardware setup data compatible with the device protocol. FIDO2 needs the credential, salt, and relying-party identity; YubiKey needs the challenge and slot.

Important failure modes

TriggerConsequenceGuard
Plain provider used for sensitive dataThe secret is visible to anyone who can read the configUse Age, a local store, or a hardware provider
Age identity does not match any recipientEncrypted values cannot be readKeep the matching private identity available and re-encrypt after recipient changes
Age batch data is copied without its wrapped batch key or is alteredThe batch values cannot be decryptedPreserve each complete stored value and use the same Age identity or plugin access
pass or its GPG key is missing or lockedReads and writes fail through the CLIInstall and initialize pass; make the required GPG key available
KeePass password, keyfile, or database path is wrongThe database cannot open or values cannot be foundCheck all database credentials and config-relative paths
A profile points a relative path at a different config source than expectedAge, Password-store, or KeePass reads use the wrong local file or storeCheck the provider declaration's active profile and source file
Keychain backend is locked or unavailableLocal reads and writes fail, often in headless sessionsUse an unlocked OS backend or choose a provider that works without a desktop session
1Password CLI session or token is invalidVault reads fail before the item reference is resolvedUse a valid service-account token or authenticated op session
FIDO2 key lacks hmac-secret, or the wrong key is usedSetup or decryption failsUse the same compatible authenticator and preserve its provider settings
YubiKey is absent, uses a non-OTP interface, or has the wrong slotChallenge-response cannot produce the encryption secretUse an OTP-capable YubiKey with the configured HMAC slot and required USB support

Key files

FileWhy to read it
crates/…/mod.rsDefines the provider contract, batch operations, capability model, profile-aware path context, and provider construction boundary
crates/…/*.toml for plain, age, password-store, keychain, keepass, 1password, fido2, and yubikeyDefines the user-facing type names, categories, setup guidance, and provider fields
crates/…/plain.rs, age.rs, password_store.rs, and keepass.rsShows the local value, encrypted-file, GPG-store, and database provider behaviors
crates/…/keychain.rs and onepassword.rsShows the OS credential-store and password-service boundaries
crates/…/hw_encrypt.rsDefines the shared hardware-to-ciphertext protection model
crates/…/fido2.rs, yubikey.rs, and yubikey_usb.rsShows the two hardware authentication models and their setup requirements
crates/…/generate_providers.rsExplains how provider metadata becomes the common config, resolver, and wizard surface