auth

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 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 auth handles passwords and turns request credentials into a user.

Index

Constants

View Source
const (
	CookieName = "matinee_session"
	SessionTTL = 90 * 24 * time.Hour
)

Variables

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

Functions

func BrowserName

func BrowserName(userAgent string) string

BrowserName describes a browser from its User-Agent, such as "Firefox on macOS", for the list of signed-in devices.

func CheckPIN

func CheckPIN(hash, pin string) bool

CheckPIN compares a PIN with a profile's stored hash.

func CheckPassword

func CheckPassword(u store.User, password string) bool

CheckPassword says whether password is the user's.

func HashPassword

func HashPassword(pw string) (string, error)

func Login

func Login(ctx context.Context, s *store.Store, username, password string, dev store.Device) (store.User, string, error)

Login checks a password and starts a session for a device.

func Token

func Token(r *http.Request) string

Token pulls a session token from the Authorization header, the session cookie, or a ?token= query parameter (for <video> and <audio> sources in apps).

func UserFrom

func UserFrom(ctx context.Context) (store.User, bool)

func ValidPIN

func ValidPIN(pin string) bool

ValidPIN reports whether a profile PIN is four digits.

func WithUser

func WithUser(ctx context.Context, u store.User) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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