Core unsubscribe token and URL service for RFC 8058 flows.
Tokens carry only the delivery_id. Verification tries the current
compliance endpoint/secret first, then each configured previous raw secret
to survive secret_key_base rotation without breaking in-flight links.
Summary
Functions
Signs a delivery-only unsubscribe token with the current endpoint/secret.
Builds the canonical unsubscribe URL for a delivery.
Verifies an unsubscribe token against the current endpoint first and then any configured previous raw secrets.
Types
@type verify_result() :: {:ok, %{delivery_id: String.t()}} | {:error, :expired | :invalid}
Functions
Signs a delivery-only unsubscribe token with the current endpoint/secret.
Builds the canonical unsubscribe URL for a delivery.
Raises %Mailglass.ConfigError{} before returning if the generated URL
exceeds 900 bytes.
@spec verify_token(binary()) :: verify_result()
Verifies an unsubscribe token against the current endpoint first and then any configured previous raw secrets.