A verifier key: the public half of a note-signing key, parsed from the C2SP vkey encoding.
<key name>+<hex key ID>+<base64(signature type || public key)>For Ed25519 keys (signature type 0x01, the only type this library
implements), the key ID embedded in the vkey must equal the first four
bytes of SHA-256(key name || 0x0A || 0x01 || public key), so a
mistyped or tampered vkey fails at parse time rather than producing a
verifier that can never match a signature.
Summary
Functions
Builds a verifier from a key name and a raw 32-byte Ed25519 public key, computing the key ID.
Parses a vkey string.
Renders the vkey encoding of this verifier.
Types
@type t() :: %SignedNote.Verifier{ key_id: <<_::4*8>>, name: String.t(), public_key: <<_::32*8>> }
An Ed25519 verifier: key name, 4-byte key ID, 32-byte public key.
Functions
@spec from_ed25519(String.t(), <<_::32*8>>) :: {:ok, t()} | {:error, SignedNote.Error.t()}
Builds a verifier from a key name and a raw 32-byte Ed25519 public key, computing the key ID.
@spec from_string(String.t()) :: {:ok, t()} | {:error, SignedNote.Error.t()}
Parses a vkey string.
iex> {:ok, verifier} =
...> SignedNote.Verifier.from_string(
...> "example.com/foo+530d903a+AekyeRrm56hApGFkyQR4ZCbV54Id2LKaANYcrnKv3U2k"
...> )
iex> verifier.name
"example.com/foo"
iex> Base.encode16(verifier.key_id, case: :lower)
"530d903a"
Renders the vkey encoding of this verifier.
iex> {:ok, verifier} =
...> SignedNote.Verifier.from_string(
...> "example.com/foo+530d903a+AekyeRrm56hApGFkyQR4ZCbV54Id2LKaANYcrnKv3U2k"
...> )
iex> SignedNote.Verifier.to_string(verifier)
"example.com/foo+530d903a+AekyeRrm56hApGFkyQR4ZCbV54Id2LKaANYcrnKv3U2k"