View Source GPGex.Keystore (gpg_ex v1.0.0-alpha.3)
Functions for managing GPG keystores.
Summary
Types
An abstraction on top of GPG's homedir
and keyring
to hold references to private and public keys locations.
Types
An abstraction on top of GPG's homedir
and keyring
to hold references to private and public keys locations.
Functions
Ensures the specified GPG keystore is initialized and
returns a struct to use with GPGex
functions.
Options
:path
- the GPG homedir to use, defaults to$GNUPGHOME || "~/.gnupg"
:keyring
- the keyring filename, defaults tonil
(uses GPG's default)
Examples
Get the default keystore:
iex> GPGex.Keystore.get_keystore()
Get (and maybe create) a keystore in a specific location:
iex> keystore = GPGex.Keystore.get_keystore(path: "/tmp/test_keystore", keyring: "pubring_2.kbx")
%GPGex.Keystore{path: "/tmp/test_keystore", keyring: "pubring_2.kbx"}
iex> {:ok, _, _} = GPGex.cmd(
...> ["--recv-keys", "18D5DCA13E5D61587F552A1BDEB5A837B34DD01D"],
...> keystore: keystore
...> )
@spec get_keystore_global() :: t() | nil
Calls get_keystore/2
with the global keystore options from Config
.
Returns nil
if the Config
is not set.
Examples
Get the globally configured keystore:
iex> GPGex.Keystore.get_keystore_global()
%GPGex.Keystore{path: "/tmp/gpg_ex_keystore", keyring: nil}
@spec get_keystore_temp() :: t()
Calls get_keystore/2
with a writable temporary directory.