lib.secrets module

Helper functions/classes related to secrets (e.g. passwords).

get_secret(key, *key_parts, cmd_list=None, folder=None, user=None)[source]

Returns a secret (i.e. a password).

Parameters
  • key (str) – The key that the secret is associated with.

  • key_parts (str) – If provided, these are treated as part of the secret key and are joined with the key argument by separating each distinct key part with a period.

  • cmd_list (Optional[Iterable[str]]) – Optional command list to use for fetching the secret (e.g. [“pass”, “show”], which is the default). Note: we will append the key argument to this list before running.

  • folder (Optional[str]) – If provided, this folder name is prepended to the beginning of the key argument.

  • user (Optional[str]) – Should we use sudo -u <user> to run our secret retriever command as that user?

Return type

str