handoff

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 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 handoff carries a session from the server to `weg login` through the browser, sealed to a key the CLI made for that one sign-in (docs/decisions/d52-weg-login-holds-a-session.md).

The server and the CLI both import it, so that the two halves of the seal cannot drift apart. It holds the format and the cryptography and nothing else: no transport, no cookies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Seal

func Seal(public string, s *Session) (string, error)

Seal writes s to the public key, in a form a URL may carry.

func ValidPublic

func ValidPublic(public string) bool

ValidPublic reports whether public is a key Seal can seal to, so that a sign-in can be refused at its start rather than after the person has signed in.

Types

type Key

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

Key is the CLI's half: made for one sign-in and dropped after it.

func NewKey

func NewKey() (*Key, error)

NewKey makes a key for one sign-in.

func (*Key) Open

func (k *Key) Open(sealed string) (*Session, error)

Open reads what Seal wrote to this key.

func (*Key) Public

func (k *Key) Public() string

Public is the key the server seals to, in a form a URL may carry.

type Session

type Session struct {
	Value   string    `json:"session"`
	CSRF    string    `json:"csrf"`
	Expires time.Time `json:"expires"`
}

Session is what a sign-in hands the CLI: the sealed session cookie's value, the CSRF value a write has to repeat, and when both stop working.

Jump to

Keyboard shortcuts

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