Documentation
¶
Overview ¶
Package onetimeaccess issues single-use sign-in tokens delivered by email: admins mint them per user; unauthenticated users may request one for their own address when the app policy allows. Storage: auth_tokens (purpose = one_time_access, hash at rest) via the shared token store.
Index ¶
Constants ¶
View Source
const ( // TokenTTL bounds one-time access tokens. TokenTTL = 15 * time.Minute // ResendThrottle bounds re-request frequency. ResendThrottle = time.Minute )
Token lifetime and resend throttle.
Variables ¶
View Source
var ( // ErrNotFound covers unknown tokens/users without leaking which. ErrNotFound = errors.New("onetimeaccess: token is invalid or expired") // ErrThrottled rejects re-requests inside the resend window. ErrThrottled = errors.New("onetimeaccess: request throttled") )
Errors surfaced to handlers.
Functions ¶
This section is empty.
Types ¶
type Feature ¶
type Feature struct {
// contains filtered or unexported fields
}
Feature is the wireable unit.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service orchestrates one-time access tokens.
type ServiceOption ¶
type ServiceOption func(*Service)
ServiceOption configures the feature.
func WithMail ¶
func WithMail(sender identity.MailSender, appURL string) ServiceOption
WithMail wires the queued email sender and the base URL used to build the sign-in link.
Click to show internal directories.
Click to hide internal directories.