createsession

package
v0.0.0-...-4d14c86 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Lifetime = 30 * 24 * time.Hour

Lifetime is how long a session lasts without use: each use starts it again (readsession).

Variables

View Source
var ErrBadCredentials = errors.New("wrong account name or password")

Functions

func Process

func Process(ctx context.Context, db bun.IDB, input Input) *run

Process logs in: the account's password checked, a session made for the device.

Types

type Input

type Input struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	// Token asks the token in the answer too, for a client without cookies (the CLI): the web keeps it HttpOnly.
	Token bool `json:"token" binding:"optional"`
}

type Result

type Result struct {
	Token     string      `json:"token,omitempty" binding:"optional"`
	User      domain.User `json:"user"`
	ExpiresAt time.Time   `json:"expires_at"`
}

Result is the new session: the token goes to the client, and only there.

Jump to

Keyboard shortcuts

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