View Source GPGex (gpg_ex v1.0.0-alpha.1)
A simple wrapper to run GPG commands.
Tested on Linux with gpg (GnuPG) 2.2.27
.
Warning
This is a pre-release version. As such, anything may change at any time, the public API should not be considered stable, and using a pinned version is recommended.
Configuration
You can specify an optional directory to be passed to --homedir
.
Without this option your default GPG keyring will be used.
config :gpg_ex,
gpg_home: "/tmp/gpg_ex_home"
Summary
Functions
Runs GPG with the given args.
Same as cmd/1
but raises a
RuntimeError
if the command fails.
Functions
Runs GPG with the given args.
Returns parsed status messages and stdout rows separately in a tuple.
Examples
iex> {:ok, messages, stdout} = GPGex.cmd(["--recv-keys", "18D5DCA13E5D61587F552A1BDEB5A837B34DD01D"])
iex> messages
[
"KEY_CONSIDERED 18D5DCA13E5D61587F552A1BDEB5A837B34DD01D 0",
"IMPORTED DEB5A837B34DD01D GPGEx Test <spam@sherlox.io>",
"IMPORT_OK 1 18D5DCA13E5D61587F552A1BDEB5A837B34DD01D",
"IMPORT_RES 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0"
]
iex> stdout
[
"key DEB5A837B34DD01D: public key \"GPGEx Test <spam@sherlox.io>\" imported",
"Total number processed: 1",
"imported: 1"
]
iex> GPGex.cmd(["--delete-keys", "18D5DCA13E5D61587F552A1BDEB5A837B34DD01D"])
{:ok, [], []}
iex> GPGex.cmd(["--recv-keys", "91C8AFC4674BF0963E7A90CEB7FFBE9D2DF23D67"])
{:error, ["FAILURE recv-keys 167772218"], ["keyserver receive failed: No data"]}
Same as cmd/1
but raises a
RuntimeError
if the command fails.