Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPasswordBreach(password string) error
- func DefaultResetPasswordEmailTemplate(data ResetPasswordTemplateData) (mailer.Content, error)
- func DefaultVerifyEmailTemplate(data VerifyEmailTemplateData) (mailer.Content, error)
- func GenerateVerificationCode() (string, error)
- func HashPassword(password string) (string, error)
- func NormalizeEmail(email string) string
- func ValidateEmail(email string) error
- func ValidatePassword(password string) error
- func ValidatePasswordWithMinLength(password string, minLength int) error
- func VerifyPassword(password, encoded string) bool
- type Client
- func (c *Client) ChangePasswordWithConfirmation(ctx context.Context, ...) error
- func (c *Client) IssueEmailVerificationCode(ctx context.Context, userID string) (string, error)
- func (c *Client) Login(ctx context.Context, email, password string) (*User, error)
- func (c *Client) ResetPassword(ctx context.Context, token, newPassword, confirmPassword string) error
- func (c *Client) Signup(ctx context.Context, email, password string) (*User, error)
- func (c *Client) StartPasswordReset(ctx context.Context, email string) (string, error)
- func (c *Client) VerifyEmailCode(ctx context.Context, userID, code string) error
- type ClientConfig
- type EmailVerificationCode
- type EmailsConfig
- type PasswordBreachCheckConfig
- type PasswordBreachChecker
- type PasswordResetToken
- type PasswordTooShortError
- type ResetPasswordTemplate
- type ResetPasswordTemplateData
- type User
- type UserWithPassword
- type VerifyEmailTemplate
- type VerifyEmailTemplateData
Constants ¶
View Source
const EmailVerificationExpiry = 15 * time.Minute
View Source
const PasswordResetExpiry = 1 * time.Hour
Variables ¶
View Source
var ( ErrInvalidEmail = errors.New("invalid email") ErrPasswordTooShort = errors.New("password too short") ErrPasswordTooLong = errors.New("password too long") ErrInvalidEmailOrPassword = errors.New("invalid email or password") )
View Source
var ErrEmailAlreadyVerified = errors.New("email already verified")
View Source
var ErrEmailMissing = errors.New("email missing")
View Source
var ErrEmailTaken = errors.New("email already registered")
View Source
var ErrInvalidCode = errors.New("invalid or expired code")
View Source
var ErrInvalidCurrentPassword = errors.New("current password is incorrect")
View Source
var ErrInvalidToken = errors.New("invalid or expired token")
View Source
var ErrPasswordBreached = errors.New("password found in data breach")
View Source
var ErrPasswordsDoNotMatch = errors.New("passwords do not match")
View Source
var ErrUserNotFound = errors.New("user not found")
Functions ¶
func CheckPasswordBreach ¶
func DefaultResetPasswordEmailTemplate ¶
func DefaultResetPasswordEmailTemplate(data ResetPasswordTemplateData) (mailer.Content, error)
func DefaultVerifyEmailTemplate ¶
func DefaultVerifyEmailTemplate(data VerifyEmailTemplateData) (mailer.Content, error)
func HashPassword ¶
func NormalizeEmail ¶
func ValidateEmail ¶
func ValidatePassword ¶
func VerifyPassword ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
func (*Client) ChangePasswordWithConfirmation ¶
func (*Client) IssueEmailVerificationCode ¶
func (*Client) ResetPassword ¶
func (*Client) StartPasswordReset ¶
type ClientConfig ¶
type EmailVerificationCode ¶
type EmailsConfig ¶
type EmailsConfig struct {
ResetPassword ResetPasswordTemplate
VerifyEmail VerifyEmailTemplate
}
type PasswordBreachChecker ¶
func NewHIBPPasswordBreachChecker ¶
func NewHIBPPasswordBreachChecker(cfg PasswordBreachCheckConfig) PasswordBreachChecker
type PasswordResetToken ¶
type PasswordTooShortError ¶
type PasswordTooShortError struct {
MinLength int
}
func (PasswordTooShortError) Error ¶
func (e PasswordTooShortError) Error() string
func (PasswordTooShortError) Is ¶
func (e PasswordTooShortError) Is(target error) bool
type ResetPasswordTemplate ¶
type ResetPasswordTemplate func(data ResetPasswordTemplateData) (mailer.Content, error)
type UserWithPassword ¶
func GetUserPasswordByEmail ¶
type VerifyEmailTemplate ¶
type VerifyEmailTemplate func(data VerifyEmailTemplateData) (mailer.Content, error)
Click to show internal directories.
Click to hide internal directories.