Skip to content

Subpackage exporter

derivepassphrase.exporter

Foreign configuration exporter for derivepassphrase.

get_vault_key

get_vault_key() -> bytes

Automatically determine the vault master key/password.

Query the VAULT_KEY, LOGNAME, USER and USERNAME environment variables, in that order. This is the same algorithm as vault uses.

Returns:

Type Description
bytes

The master key/password. This is generally used as input to a key-derivation function to determine the actual encryption and signing keys for the vault configuration.

Raises:

Type Description
KeyError

We cannot find any of the named environment variables. Please set VAULT_KEY manually to the desired value.

get_vault_path

get_vault_path() -> str | bytes | os.PathLike

Automatically determine the vault configuration path.

Query the VAULT_PATH environment variable, or default to ~/.vault. This is the same algorithm as vault uses. If not absolute, then VAULT_PATH is relative to the home directory.

Returns:

Type Description
str | bytes | PathLike

The vault configuration path. Depending on the vault version, this may be a file or a directory.

Raises:

Type Description
RuntimeError

We cannot determine the home directory. Please set HOME manually to the correct value.