password

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 6 Imported by: 0 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 (
	Time    = 1
	Memory  = config.Argon2Memory
	Threads = 4
	KeyLen  = 32
)

Argon2id parameters

View Source
const (
	MinPasswordLength = 8
	MaxPasswordLength = 128
)

Variables

View Source
var StrengthRequirements = fmt.Sprintf(
	"Password must be between %d and %d characters.",
	MinPasswordLength, MaxPasswordLength)

StrengthRequirements is the full password rule text for user-facing errors.

Functions

func HashPassword

func HashPassword(password string) (hash, salt string, err error)

HashPassword hashes a password with a new random salt using Argon2id

func ValidatePasswordChange

func ValidatePasswordChange(currentPassword, newPassword,
	confirmPassword string) error

ValidatePasswordChange validates a password change operation

func ValidatePasswordConfirmation

func ValidatePasswordConfirmation(password, confirmation string) error

func ValidatePasswordStrength

func ValidatePasswordStrength(password string) error

func VerifyPassword

func VerifyPassword(password, hash, salt string) bool

VerifyPassword verifies a password against a stored hash and salt

Types

This section is empty.

Jump to

Keyboard shortcuts

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