package auth

import "git.sr.ht/~pingoo/stdx/auth"

Index

Functions

func CreateAccount

func CreateAccount(ctx context.Context, db db.Queryer, accountID uuid.UUID, password string) (err error)

func CreateSession

func CreateSession(ctx context.Context, db db.Queryer, accountID uuid.UUID) (token string, err error)

func DeleteAccount

func DeleteAccount(ctx context.Context, db db.Queryer, accountID uuid.UUID) (err error)

func DeleteSession

func DeleteSession(ctx context.Context, db db.Queryer, token string) (err error)

func RefreshSession

func RefreshSession(ctx context.Context, db db.Queryer, oldToken string) (newToken string, err error)

Types

type Account

type Account struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
}

type ApiKey

type ApiKey struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time

	Name string
}

type Session

type Session struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time

	AccountID uuid.UUID
}

func GetSessionsForAccount

func GetSessionsForAccount(ctx context.Context, db db.Queryer, accountID uuid.UUID) (sessions []Session, err error)

Source Files

accounts.go apikeys.go sessions.go

Version
v0.0.0-20240218134121-094174641f6e (latest)
Published
Feb 18, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
4 months ago

Tools for package owners.