password

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package password hashes and verifies passwords with argon2id (PHC-encoded). It is the shared hasher for any forge service that stores local credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argon2id

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

Argon2id implements Hasher with the OWASP-recommended argon2id parameters and the standard PHC string encoding.

func NewArgon2id

func NewArgon2id() *Argon2id

func (*Argon2id) Hash

func (h *Argon2id) Hash(password string) (Hashed, error)

func (*Argon2id) Verify

func (h *Argon2id) Verify(password, encoded string) (bool, error)

type Hashed

type Hashed struct {
	Encoded string
	Algo    string
	Params  map[string]any
}

Hashed is the result of hashing a plaintext password: the PHC-encoded argon2id string plus the algorithm + params for storage/audit.

type Hasher

type Hasher interface {
	Hash(password string) (Hashed, error)
	Verify(password, encoded string) (bool, error)
}

Hasher hashes and verifies passwords. The Argon2id implementation is the default; the interface keeps callers testable and the algorithm swappable.

Jump to

Keyboard shortcuts

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