View Source SecretVault.Config (SecretVault v1.2.2)

Configuration for a SecretVault vault. This configuration defines ciphers, their options, holds simmetric encryption key and path to the vault.

You can set configuration as plain values like

config :my_app, :secret_vault,
  default: [password: "super secret password"]

Or like

config :my_app, :secret_vault,
  default: [password: {System, :get_env, "SUPER_SECRET_PASSWORD"}]

To fetch password in runtime with specified module function arity

Summary

Types

A module implementing SecretVault.EncryptionProvider behaviour.

Options for specified cipher.

Options to set for a config.

Simmetric key for cipher

Options for specified key derivation function.

Plain string password.

Path prefix for your secrets in priv directory.

Priv path. Use it only when you wan't to specify it by hands.

t()

Functions

Return list of options available for config.

Same as fetch_from_env/3, but passes env authomatically. Fetch config from the application configuration (e.g. in confix.exs).

Creates a struct that keeps configuration data for the storage.

Types

@type cipher() :: module()

A module implementing SecretVault.EncryptionProvider behaviour.

@type cipher_opts() :: Keyword.t()

Options for specified cipher.

@type config_option() ::
  {:cipher, cipher()}
  | {:cipher_opts, cipher_opts()}
  | {:key_derivation, key_derivation()}
  | {:key_derivation_opts, key_derivation_opts()}
  | {:priv_path, priv_path()}
  | {:prefix, prefix()}
  | {:password, password()}
  | {:key, key()}
  | {:env, String.t()}

Options to set for a config.

@type key() :: binary()

Simmetric key for cipher

@type key_derivation() :: module()

A module implementing SecretVault.KeyDerivation

@type key_derivation_opts() :: Keyword.t()

Options for specified key derivation function.

@type password() :: String.t()

Plain string password.

@type prefix() :: String.t()

Path prefix for your secrets in priv directory.

It's usefull when you want to have more than one secret storage. Defaults to secrets.

@type priv_path() :: String.t()

Priv path. Use it only when you wan't to specify it by hands.

@type t() :: %SecretVault.Config{
  cipher: cipher(),
  cipher_opts: cipher_opts(),
  env: String.t(),
  key: key(),
  prefix: prefix(),
  priv_path: priv_path()
}

Functions

@spec available_options() :: [atom()]

Return list of options available for config.

Link to this function

fetch_from_current_env(otp_app, prefix \\ "default", opts \\ [])

View Source
@spec fetch_from_current_env(atom(), prefix(), [config_option()]) ::
  {:ok, t()}
  | {:error, {:no_configuration_for_app, otp_app :: module()}}
  | {:error, {:no_configuration_for_prefix, prefix()}}

Same as fetch_from_env/3, but passes env authomatically. Fetch config from the application configuration (e.g. in confix.exs).

otp_app is the current OTP application name. prefix must be one of the configured prefixes.

Link to this function

new(app_name, opts \\ [])

View Source
@spec new(app_name :: atom(), [config_option()]) :: t()

Creates a struct that keeps configuration data for the storage.

app_name is an OTP application name for the app you want to keep secrets for.