Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v0.1.94 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthStore

type AuthStore struct {
	// contains filtered or unexported fields
}

func NewAuthStore

func NewAuthStore(db *sqlx.DB) *AuthStore

func (*AuthStore) CountTokens

func (s *AuthStore) CountTokens() (int, error)

CountTokens returns the number of stored auth tokens.

func (*AuthStore) CreateToken

func (s *AuthStore) CreateToken() (string, error)

func (*AuthStore) DeleteToken

func (s *AuthStore) DeleteToken(id int64) error

DeleteToken removes the auth token with the given id, revoking it. It returns an error if no token with that id exists.

func (*AuthStore) ListTokens

func (s *AuthStore) ListTokens() ([]TokenInfo, error)

ListTokens returns metadata for all stored auth tokens, newest first.

func (*AuthStore) ValidateToken

func (s *AuthStore) ValidateToken(token string) (bool, error)

type TokenInfo

type TokenInfo struct {
	ID          int64  `db:"id"`
	TokenPrefix string `db:"token_prefix"`
	CreatedAt   string `db:"created_at"`
}

TokenInfo is the non-secret metadata about a stored auth token. The token plaintext is never recoverable (only a salted Argon2 hash is stored), so listing exposes just the id, short prefix, and creation time.

Jump to

Keyboard shortcuts

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