Documentation
¶
Overview ¶
Package emailverifier implements email-verified self-registration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendVerificationEmail ¶
SendVerificationEmail mirrors emailVerifier.ts's sendVerificationEmail: a multipart/alternative (text + html) message with the same subject and bodies, sent via cfg (Config.values.smtp).
cfg.Secure mirrors nodemailer's `secure` option: true dials straight into TLS (SMTPS, typically port 465); false dials plaintext and upgrades via STARTTLS if the server offers it - which is exactly what net/smtp.SendMail already does unconditionally, so that branch reuses it directly rather than reimplementing STARTTLS negotiation.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store mirrors emailVerifier.ts's module-level `pending` map plus its setInterval sweep, wrapped in a struct per this codebase's usual pattern for what was process-global state in Node.
func New ¶
func New() *Store
New starts the periodic expiry sweep immediately, matching the module-level `setInterval(...)` in emailVerifier.ts running from the moment the file is first imported.
func (*Store) AllowRegistration ¶
AllowRegistration limits verification-email delivery by source IP and normalized email address. The check and increment are atomic so concurrent WebSocket connections cannot bypass the limit by racing one another.
func (*Store) Stop ¶
func (s *Store) Stop()
Stop halts the periodic sweep. Not present in the Node original (a long-running process never needs to cancel its setInterval) - added so Go tests and graceful shutdown don't leak a background timer.
func (*Store) StorePending ¶
StorePending mirrors emailVerifier.ts's storePending.
func (*Store) VerifyCode ¶
VerifyCode mirrors emailVerifier.ts's verifyCode exactly, including incrementing Attempts before the max-attempts check (so the Nth failed attempt at MAX_ATTEMPTS is the one that evicts the entry) and comparing codes via a constant-time comparison (internal/auth.SafeCompareTokens, the same helper server/util.ts's safeCompareTokens backs both here and in session-token comparison).