database

package
v0.0.0-...-8ff41f6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatableArgon2Version error = errors.New("incompatable argon2 version")
	ErrInvalidArgon2FieldCount   error = errors.New("invalid number of fields")
)
View Source
var (
	ErrInvalidUsername   error = errors.New("invalid username given")
	ErrIncorrectPassword error = errors.New("invalid password given")
	ErrUsernameExists    error = errors.New("username already exists")
)

Functions

func CreateAdminUser

func CreateAdminUser(username, password string) error

func CreateDB

func CreateDB(filepath, schemaFilepath string) error

func CreateUser

func CreateUser(username, password string) error

func DecodeHash

func DecodeHash(hash string, data *Argon2Params) error

func GenerateHash

func GenerateHash(secret string) (string, error)

func GetDB

func GetDB() *sql.DB

func SignInUser

func SignInUser(username, password string) (string, error)

func SignOutUser

func SignOutUser(sessionId string) error

func TryCreateUser

func TryCreateUser(username, password string) error

func UsernameTaken

func UsernameTaken(username string) (bool, error)

func VerifyHash

func VerifyHash(secret, hash string) bool

Types

type Argon2Params

type Argon2Params struct {
	Version int
	Time    uint32
	Memory  uint32
	Threads uint8
	KeyLen  uint32
	Salt    []byte
	Key     []byte
}

Jump to

Keyboard shortcuts

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