misc

package module
v0.0.0-...-ea86d5f Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSessionCookie

func AddSessionCookie(w http.ResponseWriter, r *http.Request, db *sql.DB) (err error)

func CreateCookie

func CreateCookie(r *http.Request, salt []byte) (cookie string, err error)

func GenerateRandomSalt

func GenerateRandomSalt(saltSize int) (salt []byte, err error)

func HashPassword

func HashPassword(password string, salt []byte) string

func PasswordMatchHash

func PasswordMatchHash(password string, hash string, salt []byte) bool

func PopString

func PopString(s []string) (ss []string, err error)

func ReturnError

func ReturnError(w http.ResponseWriter, errorCode int, msg string) (err error)

func VerifyLogin

func VerifyLogin(r *http.Request, db *sql.DB) (authorized bool, err error)

func VerifyPOSTLogin

func VerifyPOSTLogin(r *http.Request, db *sql.DB) (authorized bool, err error)

func VerifySessionCookie

func VerifySessionCookie(r *http.Request, db *sql.DB) (authorized bool, err error)

Types

type ErrorFields

type ErrorFields struct {
	Status  string `json:"status,omitempty"`
	Details string `json:"details,omitempty"`
}

type ErrorStatus

type ErrorStatus struct {
	Error []ErrorFields `json:"errors"`
}

type Session

type Session struct {
	UserID int
	Expire time.Time
}

type User

type User struct {
	ID           int
	Username     string
	PasswordHash string
	PasswordSalt string
	FirstName    string
	LastName     string
}

Jump to

Keyboard shortcuts

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