users

package
v0.0.0-...-b667a3b Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(username string, password string) error

Appends a user to the `users.toml`, The username must not be taken. The password will be hashed and a salt will be generated and stored alongside it.

Returns nil on success

func ChangePassword

func ChangePassword(username string, password string) error

Edits the password record of a specific user. The user must exist.

Returns nil on success

func HashPassword

func HashPassword(password string) (string, error)

Hashes a password to be stored in the users file, a salt is applied based on the salt specified in the config.

func RemoveUser

func RemoveUser(username string) error

Removes a user from the user file

Returns nil on success

func UserExists

func UserExists(username string) bool

Tests for existence of specified user in the user file

func ValidateUser

func ValidateUser(username string, password string) bool

Tests a raw password and username against the credentials in the `users.toml` file.

Types

type UserData

type UserData struct {
	PassHash string `toml:"pass"`
}

func GetUser

func GetUser(username string) (UserData, error)

Jump to

Keyboard shortcuts

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