password

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: BSD-3-Clause Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// VeryWeak password
	VeryWeak = 0
	// Weak password
	Weak = 1
	// Fair password
	Fair = 2
	// Strong password
	Strong = 3
	// VeryStrong password
	VeryStrong = 4

	// OK password is the recommended minimum strength for API calls
	OK = Fair
)

Variables

This section is empty.

Functions

func IsValid

func IsValid(password string, minimumStrength Strength) error

IsValid returns nil if password is a reasonable length and has strength greater than or equal to [minimumStrength]

func SufficientlyStrong

func SufficientlyStrong(password string, minimumStrength Strength) bool

SufficientlyStrong returns true if password has strength greater than or equal to [minimumStrength]

Types

type Hash

type Hash struct {
	Password [32]byte `serialize:"true"` // The salted, hashed password
	Salt     [16]byte `serialize:"true"` // The salt
}

Hash of a password

func (*Hash) Check

func (h *Hash) Check(password string) bool

Check returns true iff the provided password was the same as the last password set.

func (*Hash) Set

func (h *Hash) Set(password string) error

Set updates the password hash to be of the provided password

type Strength

type Strength int

Strength is the strength of a password

Jump to

Keyboard shortcuts

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