lumenmail/auth

Authentication module for SMTP. Implements various SMTP authentication mechanisms.

Values

pub fn encode_cram_md5(
  credentials: types.Credentials,
  challenge: String,
) -> String

Generates CRAM-MD5 response from challenge. Challenge is base64 encoded from server. Response format: username HMAC-MD5-digest (base64 encoded)

pub fn encode_login_password(
  credentials: types.Credentials,
) -> String

Encodes the password for LOGIN authentication (second step).

pub fn encode_login_username(
  credentials: types.Credentials,
) -> String

Encodes the username for LOGIN authentication (first step).

pub fn encode_plain(credentials: types.Credentials) -> String

Encodes credentials for PLAIN authentication. Format: \0username\0password (base64 encoded)

pub fn encode_xoauth2(credentials: types.Credentials) -> String

Generates XOAUTH2 authentication string. Format: user=\x01auth=Bearer \x01\x01

pub fn mechanism_to_string(
  mechanism: types.AuthMechanism,
) -> String

Returns the SMTP command name for an auth mechanism.

pub fn parse_mechanism(
  s: String,
) -> Result(types.AuthMechanism, Nil)

Parses an auth mechanism string from server.

pub fn select_best_mechanism(
  available: List(types.AuthMechanism),
  credentials: types.Credentials,
) -> Result(types.AuthMechanism, String)

Selects the best authentication mechanism from available options. Prefers more secure mechanisms.

Search Document