apptoken

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 6 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 apptoken makes and recognises the tokens the daemon's loopback services (AI, mail) hand to the apps they serve.

A token isn't stored. It is an HMAC of the app's name and a generation under a key the service keeps, so the same token is handed to the app every time it starts, including after the daemon restarts, without keeping it in a form that could be read back. Regenerating bumps the generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mint

func Mint(prefix string, key []byte, service string, gen int64) string

Mint is service's token at generation gen under key, with prefix in front so a token says which service it is for.

Types

type Issued

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

Issued remembers which app each handed-out token belongs to. It keeps the tokens' hashes, not the tokens.

func NewIssued

func NewIssued(prefix string) *Issued

NewIssued is an empty set for tokens that start with prefix.

func (*Issued) Add

func (i *Issued) Add(tok, service string)

Add records tok as service's.

func (*Issued) Remove

func (i *Issued) Remove(tok string)

Remove forgets tok, which stops working at once.

func (*Issued) Service

func (i *Issued) Service(tok string) (string, bool)

Service is the app tok was handed to.

Jump to

Keyboard shortcuts

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