pwd

package
v0.1.0-beta-007 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 interface {
	ComputeHash(string) string
}

Hasher implements password hashing methods.

func NewHasher

func NewHasher() Hasher

NewHasher creates a new Hasher instance.

type PolicyFunc

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

PolicyFunc validates a password against a set of rules.

DefaultPolicy creates the default password policy.

func Policy

func Policy(funcs ...validateFunc) PolicyFunc

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

type Validator

type Validator interface {
	ValidatePassword(password string, passwordHash string) (ok bool, isHashOutdated bool)
}

Validator implements password validation methods.

func NewValidator

func NewValidator() Validator

NewValidator creates a new Validator instance.

Jump to

Keyboard shortcuts

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