Skip to main content

Module keyring

Module keyring 

Source
Available on crate feature wizard only.
Expand description

OS-aware credential-provider picker shared by the account wizards.

A secret is read from a well-known credential CLI, from a custom shell command, or stored raw in the configuration. Two flavours share the same machinery:

  • a password is read from an OS keyring (KeyringProvider);
  • an OAuth 2.0 access token is read from a token broker (TokenBroker) that refreshes it on every read.

A known provider or broker yields an argv command (no shell), so the config serializes it as a TOML array; only a custom command falls back to a shell string. The picker never writes the secret: it just records the read command, leaving the value for the user to store under the chosen entry beforehand.

Enums§

KeyringProvider
A well-known credential-provider CLI a password can be read from.
SecretChoiceimap or jmap or smtp
A secret collected by the picker.
TokenBroker
A well-known OAuth 2.0 token broker: an external CLI that owns the account’s refresh token and prints a fresh access token on stdout.

Functions§

prompt_secretimap or jmap or smtp
Prompts for a password: a pick list of the OS keyring providers, then a custom command, then a raw value. See [prompt_choice] for how the entry is resolved.
prompt_tokenimap or jmap or smtp
Prompts for an API token: a pick list combining the OS keyrings (for a token the user generated on the provider and stored themselves) and, when oauth is true, the OAuth 2.0 token brokers (which refresh and print a fresh token on every read), then a custom command and a raw value. Same aim as prompt_secret — a command that returns the token — merging both acquisition paths behind one strategy prompt. The brokers are hidden unless the service advertises OAuth.