Minisign (minisign v0.1.1)

Elixir implementation of the Minisign signature verification format.

see https://jedisct1.github.io/minisign/

Summary

Functions

verifies a signature, returning :ok if the signature is valid.

verifies a signature, and raises if any of the inputs are invalid.

Types

Link to this type

message_input()

@type message_input() :: binary() | {:file, Path.t()}
Link to this type

public_key_input()

@type public_key_input() :: String.t() | {:file, Path.t()} | Minisign.PublicKey.t()
@type reason() :: :key_id_match | :signature | :global_signature
Link to this type

signature_input()

@type signature_input() :: String.t() | {:file, Path.t()} | Minisign.Signature.t()

Functions

Link to this function

verify(message, signature, public_key)

@spec verify(message_input(), signature_input(), public_key_input()) ::
  :ok | {:invalid, reason()} | {:error, any()}

verifies a signature, returning :ok if the signature is valid.

if the signature is invalid, returns an :invalid tuple indicating the reason why the signature failed to validate.

if any of the inputs have failed, returns an :error tuple.

For the key or signature inputs you may provide Base64 encoded strings, or a {:file, path} tuple to read from a file or a preparsed datastructure.

For the message input, you may either provide the raw binary or, a {:file, path} tuple to read the message from the file.

Link to this function

verify!(message, signature, public_key)

verifies a signature, and raises if any of the inputs are invalid.