GelotvBot.Metadata (GeloTVBot v0.1.0)

Copy Markdown View Source

Signed visible metadata tokens for chat messages.

Summary

Types

attach_option()

@type attach_option() :: {:secret, iodata()} | {:metadata, map()}

Functions

attach(message, opts)

@spec attach(
  GelotvBot.Message.t(),
  keyword()
) :: GelotvBot.Message.t()

decode(token, secret)

@spec decode(String.t(), iodata()) :: {:ok, map()} | {:error, atom()}

decode_invisible(encoded, secret)

@spec decode_invisible(String.t(), iodata()) :: {:ok, map()} | {:error, atom()}

decode_zero_width(encoded)

@spec decode_zero_width(String.t()) :: {:ok, binary()} | {:error, atom()}

encode(metadata, secret)

@spec encode(map(), iodata()) :: String.t()

encode_invisible(metadata, secret)

@spec encode_invisible(map(), iodata()) :: String.t()

encode_zero_width(payload)

@spec encode_zero_width(binary()) :: String.t()

extract(body, secret)

@spec extract(String.t(), iodata()) :: {:ok, map()} | {:error, atom()}

extract_invisible(body, secret)

@spec extract_invisible(String.t(), iodata()) :: {:ok, map()} | {:error, atom()}

extract_zero_width(body)

@spec extract_zero_width(String.t()) :: {:ok, binary()} | {:error, atom()}

zero_width_alphabet()

@spec zero_width_alphabet() :: [String.t()]