Expand description
At-rest encryption of secrets in config.toml (GAP-009 / R-SECRETS-DEFAULT).
Primary-key resolution order (32 bytes), 0.5.1:
- CLI flags (
--secrets-key-file,--use-keyring,--allow-plaintext-secrets) - Env (deprecated):
SSH_CLI_SECRETS_KEY,SSH_CLI_SECRETS_KEY_FILE,SSH_CLI_USE_KEYRING - OS keyring when enabled (
service=ssh-cli,user=secrets-primary-key; legacy read alias) - XDG
secrets.keyfile (next toconfig.toml), auto-created on first write
Opt-out: --allow-plaintext-secrets or deprecated SSH_CLI_ALLOW_PLAINTEXT_SECRETS=1.
With a key: serialization writes sshcli-enc:v1:<base64(nonce||ciphertext)>.
Never log or return the key or plaintext in public errors.
Structs§
- Secrets
Status - Secrets mode report (no sensitive material).
Enums§
- KeySource
- Primary-key source (without exposing material).
Constants§
- ENC_
PREFIX - Prefix for encrypted blobs in TOML.
- KEY_
FILE_ NAME - File name of the primary key in the config directory.
Functions§
- auto_
key_ created - Returns true if a key was auto-created (non-consuming).
- deserialize_
secret - Deserializes from TOML: decrypts
sshcli-enc:v1:blobs; otherwise returns as-is. - ensure_
key_ for_ write - Ensures a key for write: loads existing or auto-creates
secrets.key(unless plaintext opt-out). - generate_
hex_ key - Generates 32 random bytes as 64 hex chars.
- init_
primary_ key - Initializes primary-key in XDG file or keyring. Never prints the key.
- is_
encrypted_ blob - True if the string is already an encrypted blob.
- load_
primary_ key - Resolves primary key and source (does not auto-create).
- plaintext_
allowed - True if plaintext opt-out is active (CLI flag first, then deprecated env).
- secrets_
config_ dir - Config directory used for
secrets.key(override > SSH_CLI_HOME > XDG). - secrets_
key_ path - Canonical path of the local primary-key file.
- secrets_
status - Current status (without loading material into logs).
- serialize_
secret - Serializes a secret for TOML: encrypts if a key exists (or is auto-created); otherwise plaintext.
- set_
config_ dir - Sets the config directory used to resolve
secrets.key(one-shot; called fromdispatch). - set_
runtime_ flags - Applies one-shot CLI flags for secrets resolution (GAP-AUD-006).
- take_
auto_ key_ created - Returns true once if a key was auto-created since the last flag reset (consume).
- write_
key_ file - Writes hex key to file with 0o600 (when supported).
- write_
key_ to_ keyring - Stores primary-key (hex) in the OS keyring. Does not print the key.