sessions

package
v0.0.0-...-68d433b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, token tokens.Token) error

Delete removes a session from the database (logout)

func NewSession

func NewSession(ctx context.Context, user profile.Profile) (tokens.Token, error)

New creates a new authentication session in the database (login)

func ValidateSession

func ValidateSession(ctx context.Context, incomingToken tokens.Token) bool

ValidateSession takes a token and finds its session. Returns true if valid, false if anything else

Types

type Session

type Session struct {
	Owner   uuid.UUID `db:"owner"`
	Version string    `db:"token_version"`
	Public  string    `db:"token_public"`
	Secret  string    `db:"token_secret"`
	Salt    string    `db:"token_salt"`
	Created time.Time `db:"created"`
	Expires time.Time `db:"expires"`
}

func GetSession

func GetSession(ctx context.Context, token tokens.Token) (Session, error)

Jump to

Keyboard shortcuts

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