Karta.Auth.DKIM.TagList (Karta v1.0.0)

The tag=value lists of DKIM signatures and key records (RFC 6376 §3.2), also used by ARC (RFC 8617).

tag-spec  = [FWS] tag-name [FWS] "=" [FWS] tag-value [FWS]
tag-name  = ALPHA *(ALPHA / DIGIT / "_")
tag-value = [ tval *( 1*(WSP / FWS) tval ) ]   ; tval = 1*(%x21-3A / %x3C-7E)

Values may also contain UTF-8 (RFC 8616 §4, for internationalised d= and i=). Tag names are case-sensitive. A tag that appears twice, a tag without =, a malformed name, or any other character (a control character, invalid UTF-8, a line break that is not folding) makes the whole list invalid. Values keep their inner white space; surrounding white space is removed.

Summary

Functions

Parses a tag list into a map of name to value.

Removes all white space and folding (for base64 values).

Removes white space, including folding, at both ends.

Functions

parse(text)

@spec parse(binary()) ::
  {:ok, %{required(String.t()) => String.t()}} | {:error, :syntax}

Parses a tag list into a map of name to value.

strip_whitespace(value)

@spec strip_whitespace(binary()) :: binary()

Removes all white space and folding (for base64 values).

trim(value)

@spec trim(binary()) :: binary()

Removes white space, including folding, at both ends.