login

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package login is the session: log in, log out, and who is asking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(db bun.IDB) http.HandlerFunc

Handler logs in: POST /api/login. The session token goes in an HttpOnly cookie, in the body only when the input asks it (the CLI). @Summary Log in @Tags session @Accept json @Produce json @Param body body createsession.Input true "body" @Success 200 {object} createsession.Result @Failure 400 {object} respond.Failure @Failure 401 {object} respond.Failure @Failure 429 {object} respond.Failure @Router /api/login [post]

func Logout

func Logout(db bun.IDB) http.HandlerFunc

Logout logs this device out: POST /api/logout. @Summary Log out @Tags session @Success 204 @Failure 401 {object} respond.Failure @Router /api/logout [post]

func Me

func Me() http.HandlerFunc

Me is who asks: GET /api/me. @Summary Who is asking @Tags session @Produce json @Success 200 {object} login.MeResult @Failure 401 {object} respond.Failure @Router /api/me [get]

Types

type MeResult

type MeResult struct {
	Kind     domain.TokenKind `json:"kind" enums:"session,api,oauth"`
	Name     string           `json:"name,omitempty" binding:"optional"`
	ReadOnly bool             `json:"read_only"`
	Version  string           `json:"version"`
}

MeResult is who asks: the kind of its token, and whether it only reads.

Jump to

Keyboard shortcuts

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