pwd

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultPolicy creates the default password policy.

Functions

func DigitsCheck

func DigitsCheck(minCount int) validateFunc

DigitsCheck validates that a password to contains digits.

func LengthCheck

func LengthCheck(minLength int) validateFunc

LengthCheck validates that a password meets a minimum length.

func LowerCaseCheck

func LowerCaseCheck(minCount int) validateFunc

LowerCaseCheck validates that a password to contains lowercase letters.

func SpecialCharCheck

func SpecialCharCheck(minCount int) validateFunc

SpecialCharCheck validates that a password to contains special characters.

func UpperCaseCheck

func UpperCaseCheck(minCount int) validateFunc

UpperCaseCheck validates that a password to contains uppercase letters.

Types

type Hasher

type Hasher struct {
	// contains filtered or unexported fields
}

func NewHasher

func NewHasher() *Hasher

NewHasher creates a new Hasher instance.

func (*Hasher) ComputeHash

func (h *Hasher) ComputeHash(password string) string

type PolicyFunc

type PolicyFunc = func(password string) (ok bool, errMsgs []string)

PolicyFunc validates a password against a set of rules.

func Policy

func Policy(funcs ...validateFunc) PolicyFunc

Policy combines multiple different password validation functions into a single `PolicyFunc`.

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *Validator

NewValidator creates a new Validator instance.

func (*Validator) ValidatePassword

func (v *Validator) ValidatePassword(password string, passwordHash string) (ok bool, needsUpgrade bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL