Versions in this module Expand all Collapse all v0 v0.1.1 Nov 12, 2026 Changes in this version + var ErrNeedsMail = errors.New(...) type Option + func NoMail() Option v0.1.0 Oct 14, 2026 Changes in this version + const ColEmailVerifiedAt + const ColPrimaryEmail + const DefaultApprovePage + const DefaultChangePage + const DefaultCodeTTL + const DefaultMXTimeout + const DefaultMountPrefix + const DefaultUndoPage + const DefaultUndoTTL + const DefaultVerifyPage + const DefaultVerifyTTL + const EndpointAdd + const EndpointApproveChange + const EndpointApproveCode + const EndpointChange + const EndpointCheckCode + const EndpointConfirmChange + const EndpointConfirmCode + const EndpointList + const EndpointMakePrimary + const EndpointRemove + const EndpointResend + const EndpointSendCode + const EndpointSignInCode + const EndpointUndoChange + const EndpointVerify + const EndpointVerifyCode + const EndpointVerifyLink + const KindEmail + const MaxMetadataEntries + const MaxMetadataLength + const PluginName + const PurposeApproveCode + const PurposeApproveToken + const PurposeChangeApproval + const PurposeChangeCode + const PurposeChangeToken + const PurposeSignInCode + const PurposeUndoToken + const PurposeVerifyCode + const PurposeVerifyToken + const WarnChangeWithoutVerification + var CodeKindValues = []CodeKind + var EmailVerifiedAt = sqlb.Col[*time.Time](auth.TableUser, ColEmailVerifiedAt) + var ErrAddressRejected = auth.NewError("email.address_rejected", http.StatusBadRequest, ...) + var ErrBadCallback = errors.New(...) + var ErrBadDomainList = errors.New("email: AllowDomains needs at least one domain, and every entry must name one") + var ErrCallbackInvalid = auth.NewError("email.callback_invalid", http.StatusBadRequest, ...) + var ErrCodesNeedLogin = errors.New("email: SignInWithCode needs Login()") + var ErrNoBaseURL = errors.New("email: links need auth.WithBaseURL or email.Links") + var ErrNoMailer = errors.New("email: no mailer; pass email.WithMailer") + var ErrSignInOnVerifyNeedsLogin = errors.New("email: SignInOnVerify needs Login()") + var ErrSingleAddress = auth.NewError("email.single_address", http.StatusConflict, ...) + var PrimaryEmail = sqlb.Col[*string](auth.TableUser, ColPrimaryEmail) + func Bindings(c *EmailColumns) []sqlb.Binding + func CheckMetadata(m map[string]string) error + func DefaultLink(base string, purpose auth.Purpose, t auth.Token) string + func DefaultTemplates(m auth.Message) (subject, text string) + func Normalize(raw string) (string, error) + func ParseDomainList(r io.Reader) ([]string, error) + func Validate(v string) error + type Address struct + Email string + Primary bool + Verified bool + type AddressCheck func(ctx context.Context, address string) error + func BlockDomains(domains ...string) AddressCheck + func RequireMX(r MXResolver, timeout time.Duration) AddressCheck + type AddressCodeRequest struct + Code string + Email string + func (r AddressCodeRequest) RateIdentifier() string + type AddressRequest struct + Email string + Metadata map[string]string + func (r AddressRequest) RateIdentifier() string + type CheckCodeRequest struct + Code string + Email string + Kind CodeKind + func (r CheckCodeRequest) RateIdentifier() string + type CodeFor struct + Email string + Kind CodeKind + type CodeGenerator func(ctx context.Context, in CodeFor) (string, error) + type CodeKind string + const CodeKindApprove + const CodeKindChange + const CodeKindSignIn + const CodeKindVerify + type CodeRequest struct + Code string + Email string + Fields auth.Fields + Image string + Name string + func (r *CodeRequest) UnmarshalJSON(data []byte) error + func (r CodeRequest) RateIdentifier() string + type CodeSignInResult struct + Created bool + SecondFactorRequired bool + Token auth.Token + User auth.UserView + type EmailColumns struct + EmailVerifiedAt *time.Time + PrimaryEmail *string + type ListResult struct + Addresses []Address + type MXResolver interface + LookupHost func(ctx context.Context, host string) ([]string, error) + LookupMX func(ctx context.Context, name string) ([]*net.MX, error) + type Mail struct + Metadata map[string]string + Subject string + Text string + To string + type Mailer interface + Send func(ctx context.Context, m Mail) error + type MailerFunc func(ctx context.Context, m Mail) error + func (f MailerFunc) Send(ctx context.Context, m Mail) error + type Option func(*Plugin) + func AllowDomains(domains ...string) Option + func ApproveChangeFirst() Option + func ChangeWithoutVerification() Option + func CheckAddresses(checks ...AddressCheck) Option + func Contact() Option + func GenerateCode(fn CodeGenerator) Option + func Links(fn func(p auth.Purpose, t auth.Token) string) Option + func Login() Option + func Multiple() Option + func Recover() Option + func ReplaceUnverified() Option + func RequireVerified() Option + func ResendOnSignIn() Option + func ReuseCodeOnResend() Option + func ScopedByTenant() Option + func SignInOnVerify() Option + func SignInWithCode() Option + func SignUpWithCode() Option + func Templates(fn func(m auth.Message) (subject, text string)) Option + func TemplatesByLocale(byLocale map[string]TemplateFunc) Option + func VerifyByCode() Option + func VerifyByGET(callback string) Option + func Welcome() Option + func WithCodeSendLimit(n int, window time.Duration) Option + func WithCodeTTL(d time.Duration) Option + func WithCodeTryLimit(n int, window time.Duration) Option + func WithMailer(m Mailer) Option + func WithMaxAttempts(n int) Option + func WithNormalizer(fn func(raw string) (string, error)) Option + func WithUndoTTL(d time.Duration) Option + func WithVerifyTTL(d time.Duration) Option + type Plugin struct + func New(opts ...Option) *Plugin + func (p *Plugin) Add(ctx context.Context, address string) error + func (p *Plugin) ApproveChange(ctx context.Context, t auth.Token) error + func (p *Plugin) ApproveChangeCode(ctx context.Context, address, code string) error + func (p *Plugin) Change(ctx context.Context, address string) error + func (p *Plugin) CheckCode(ctx context.Context, kind CodeKind, address, code string) error + func (p *Plugin) Columns() []auth.ColumnExtension + func (p *Plugin) ConfirmChange(ctx context.Context, t auth.Token) (VerifyResult, error) + func (p *Plugin) ConfirmChangeCode(ctx context.Context, address, code string) (VerifyResult, error) + func (p *Plugin) DataHooks() auth.DataHooks + func (p *Plugin) Deliver(ctx context.Context, to auth.Identity, m auth.Message) error + func (p *Plugin) Identifiers() []auth.IdentifierKind + func (p *Plugin) Init(a *auth.Auth) error + func (p *Plugin) List(ctx context.Context) ([]Address, error) + func (p *Plugin) MakePrimary(ctx context.Context, address string) error + func (p *Plugin) Name() string + func (p *Plugin) Operations() []auth.Operation + func (p *Plugin) OptionErr() error + func (p *Plugin) RateLimits() []auth.RateRule + func (p *Plugin) Remove(ctx context.Context, address string) error + func (p *Plugin) Resend(ctx context.Context, address string) error + func (p *Plugin) SendCode(ctx context.Context, address string) error + func (p *Plugin) SendCodeWithMetadata(ctx context.Context, address string, metadata map[string]string) error + func (p *Plugin) SendVerification(ctx context.Context, to auth.Identity) error + func (p *Plugin) SetFor(ctx context.Context, userID, address string, verified bool) error + func (p *Plugin) SignInCode(ctx context.Context, address, code string) (CodeSignInResult, error) + func (p *Plugin) SignInCodeAs(ctx context.Context, address, code, name string) (CodeSignInResult, error) + func (p *Plugin) SignInCodeWith(ctx context.Context, in CodeRequest) (CodeSignInResult, error) + func (p *Plugin) SignsIn() bool + func (p *Plugin) UndoChange(ctx context.Context, t auth.Token) error + func (p *Plugin) Validate(c *auth.Config) error + func (p *Plugin) Verify(ctx context.Context, t auth.Token) (VerifyResult, error) + func (p *Plugin) VerifyCode(ctx context.Context, address, code string) (VerifyResult, error) + type TemplateFunc = func(m auth.Message) (subject, text string) + type TokenRequest struct + Token auth.WireToken + type VerifyLinkRequest struct + CallbackURL string + Token auth.WireToken + type VerifyResult struct + Email string + SecondFactorRequired bool + SignedIn bool + Token auth.Token