password

package
v0.0.0-...-059fb3b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("the encoded hash is not in the correct format")
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)

Functions

This section is empty.

Types

type Argon2IDPassword

type Argon2IDPassword struct{}

func NewArgon2IDPassword

func NewArgon2IDPassword() *Argon2IDPassword

func (*Argon2IDPassword) Compare

func (p *Argon2IDPassword) Compare(ctx context.Context, hashStr, password secret.Text) (bool, error)

func (*Argon2IDPassword) Encrypt

func (p *Argon2IDPassword) Encrypt(ctx context.Context, password secret.Text) (secret.Text, error)

type MockPassword

type MockPassword struct {
	mock.Mock
}

MockPassword is an autogenerated mock type for the Password type

func NewMockPassword

func NewMockPassword(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockPassword

NewMockPassword creates a new instance of MockPassword. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockPassword) Compare

func (_m *MockPassword) Compare(ctx context.Context, hash secret.Text, password secret.Text) (bool, error)

Compare provides a mock function with given fields: ctx, hash, password

func (*MockPassword) Encrypt

func (_m *MockPassword) Encrypt(ctx context.Context, password secret.Text) (secret.Text, error)

Encrypt provides a mock function with given fields: ctx, password

type Password

type Password interface {
	Encrypt(ctx context.Context, password secret.Text) (secret.Text, error)
	Compare(ctx context.Context, hash, password secret.Text) (bool, error)
}

Jump to

Keyboard shortcuts

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