pass_table

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashSHA256 = "sha256"
	HashBcrypt = "bcrypt"
	HashArgon2 = "argon2"

	DefaultHash = HashBcrypt

	Argon2Salt = 16
	Argon2Size = 64
)

Variables

View Source
var (
	HashCompute = map[string]FuncHashCompute{
		HashBcrypt: computeBcrypt,
		HashArgon2: computeArgon2,
	}
	HashVerify = map[string]FuncHashVerify{
		HashBcrypt: verifyBcrypt,
		HashArgon2: verifyArgon2,
	}

	Hashes = []string{HashSHA256, HashBcrypt, HashArgon2}
)

Functions

func New

func New(modName, instName string, _, inlineArgs []string) (module.Module, error)

Types

type Auth

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

func (*Auth) AuthPlain

func (a *Auth) AuthPlain(username, password string) error

func (*Auth) CreateUser added in v0.3.0

func (a *Auth) CreateUser(username, password string) error

func (*Auth) DeleteUser added in v0.3.0

func (a *Auth) DeleteUser(username string) error

func (*Auth) Init

func (a *Auth) Init(cfg *config.Map) error

func (*Auth) InstanceName

func (a *Auth) InstanceName() string

func (*Auth) ListUsers added in v0.3.0

func (a *Auth) ListUsers() ([]string, error)

func (*Auth) Lookup added in v0.3.0

func (a *Auth) Lookup(username string) (string, bool, error)

func (*Auth) Name

func (a *Auth) Name() string

func (*Auth) SetUserPassword added in v0.3.0

func (a *Auth) SetUserPassword(username, password string) error

type FuncHashCompute

type FuncHashCompute func(opts HashOpts, pass string) (string, error)

type FuncHashVerify

type FuncHashVerify func(pass, hashSalt string) error

type HashOpts

type HashOpts struct {
	// Bcrypt cost value to use. Should be at least 10.
	BcryptCost int

	Argon2Time    uint32
	Argon2Memory  uint32
	Argon2Threads uint8
}

HashOpts is the structure that holds additional parameters for used hash functions. They are used for new passwords.

These parameters should be stored together with the hashed password so it can be verified independently of the used HashOpts.

Jump to

Keyboard shortcuts

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