sessions

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserFromLoginId

func GetUserFromLoginId(id string) string

func HasTOTP

func HasTOTP(user string) bool

func InvalidateSession

func InvalidateSession(sid string)

func NewLogin

func NewLogin(user string) (string, error)

Create a login object and cache it in the db returns the login id

func NewSession

func NewSession(user string, ttl time.Duration) string

Create a new 32-character SID, returns the created Session struct

func NewTOTP

func NewTOTP(user string, ttl time.Duration) (*otp.Key, error)

func PasswordIsValid

func PasswordIsValid(user []byte, passwd []byte) bool

Returns true if the hash of the password matches the hash associated with user

func VerifySession

func VerifySession(sid string) string

func VerifyTOTP

func VerifyTOTP(user string, otp string) bool

Types

type Login

type Login struct {
	User string
	Id   string
}

func GetLogin

func GetLogin(user string) (*Login, error)

type Session

type Session struct {
	User string
	SID  string
}

func GetSession

func GetSession(user string) *Session

Retrieves a users session from the db Returns nil if no session exists

Jump to

Keyboard shortcuts

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