session

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package session defines the Session entity: an opaque, server-side persisted authentication session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	ID        string     `json:"id"`
	UserID    string     `json:"user_id"`
	TokenHash string     `json:"token_hash"`
	IPAddress string     `json:"ip_address"`
	UserAgent string     `json:"user_agent"`
	ExpiresAt time.Time  `json:"expires_at"`
	RevokedAt *time.Time `json:"revoked_at,omitempty"`
	CreatedAt time.Time  `json:"created_at"`
}

Session is a server-side session. The plaintext token is only returned to the client once, at creation; the store keeps TokenHash exclusively.

func (*Session) Expired

func (s *Session) Expired(now time.Time) bool

Expired reports whether the session is expired at the given instant.

func (*Session) Revoked

func (s *Session) Revoked() bool

Revoked reports whether the session has been revoked.

func (*Session) Valid

func (s *Session) Valid(now time.Time) bool

Valid reports whether the session is neither expired nor revoked.

Jump to

Keyboard shortcuts

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