password

package
v0.0.0-...-71c93ef Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BcryptHasher

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

BcryptHasher is a password hashing and checking implementation using bcrypt.

func NewBcryptHasher

func NewBcryptHasher() *BcryptHasher

NewBcryptHasher returns a new BcryptHasher instance.

func NewBcryptWithCost

func NewBcryptWithCost(cost int) *BcryptHasher

func (BcryptHasher) Check

func (b BcryptHasher) Check(_ context.Context, password, hashedPassword string) error

Check checks if the provided password is correct or not.

func (BcryptHasher) Hash

func (b BcryptHasher) Hash(_ context.Context, password string) (string, error)

Hash returns the bcrypt hash of the password.

type Checker

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

Checker is a struct that checks if a password is good enough.

func NewChecker

func NewChecker() *Checker

NewChecker creates a new Checker.

func NewCheckerWithEntropy

func NewCheckerWithEntropy(minimumEntropy float64) *Checker

NewCheckerWithEntropy creates a new Checker with a custom minimum entropy.

func (Checker) IsOK

func (p Checker) IsOK(_ context.Context, password string) error

IsOK checks if the password is strong enough and not in the pwned password database.

type DummyHasher

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

DummyHasher is a dummy password hashing and checking implementation.

func NewDummyHasher

func NewDummyHasher(spy *util.Spy) *DummyHasher

NewDummyHasher returns a new DummyHasher instance.

func (DummyHasher) Check

func (b DummyHasher) Check(_ context.Context, password, hashedPassword string) error

Check checks if the provided password is correct or not.

func (DummyHasher) Hash

func (b DummyHasher) Hash(_ context.Context, password string) (string, error)

Hash returns the bcrypt hash of the password.

Jump to

Keyboard shortcuts

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