migration1

package
v0.17.12 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 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

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrDBInitErr is returned when a bucket that we expect to have been
	// set up during DB initialisation is not found.
	ErrDBInitErr = errors.New("db did not initialise properly")
)
View Source
var (
	// SuperMacaroonRootKeyPrefix is the prefix we set on a super macaroon's
	// root key to clearly mark it as such.
	SuperMacaroonRootKeyPrefix = [4]byte{0xFF, 0xEE, 0xDD, 0xCC}
)

Functions

func MigrateSessionIDToKeyIndex

func MigrateSessionIDToKeyIndex(tx *bbolt.Tx, timeNow func() time.Time) error

MigrateSessionIDToKeyIndex back-fills the session ID to key index so that it has an entry for all sessions that the session store is currently aware of.

func NewSuperMacaroonRootKeyID

func NewSuperMacaroonRootKeyID(id [4]byte) uint64

NewSuperMacaroonRootKeyID returns a new macaroon root key ID that has the prefix to mark it as a super macaroon root key.

func SerializeSession

func SerializeSession(w io.Writer, session *Session) error

SerializeSession binary serializes the given session to the writer using the tlv format.

Types

type FeaturesConfig

type FeaturesConfig map[string][]byte

FeaturesConfig is a map from feature name to a raw byte array which stores any config feature config options.

type ID

type ID [4]byte

ID represents the id of a session.

func IDFromMacRootKeyID

func IDFromMacRootKeyID(rootKeyID uint64) ID

IDFromMacRootKeyID converts a macaroon root key ID to a session ID.

type MacaroonRecipe

type MacaroonRecipe struct {
	Permissions []bakery.Op
	Caveats     []macaroon.Caveat
}

MacaroonRecipe defines the permissions and caveats that should be used to bake a macaroon.

type Session

type Session struct {
	ID                ID
	Label             string
	State             State
	Type              Type
	Expiry            time.Time
	CreatedAt         time.Time
	RevokedAt         time.Time
	ServerAddr        string
	DevServer         bool
	MacaroonRootKey   uint64
	MacaroonRecipe    *MacaroonRecipe
	PairingSecret     [mailbox.NumPassphraseEntropyBytes]byte
	LocalPrivateKey   *btcec.PrivateKey
	LocalPublicKey    *btcec.PublicKey
	RemotePublicKey   *btcec.PublicKey
	FeatureConfig     *FeaturesConfig
	WithPrivacyMapper bool
}

Session is a struct representing a long-term Terminal Connect session.

func DeserializeSession

func DeserializeSession(r io.Reader) (*Session, error)

DeserializeSession deserializes a session from the given reader, expecting the data to be encoded in the tlv format.

func NewSession

func NewSession(label string, typ Type, expiry time.Time, serverAddr string,
	devServer bool, perms []bakery.Op, caveats []macaroon.Caveat,
	featureConfig FeaturesConfig, privacy bool) (*Session, error)

NewSession creates a new session with the given user-defined parameters.

type State

type State uint8

State represents the state of a session.

const (
	StateCreated State = 0
	StateInUse   State = 1
	StateRevoked State = 2
	StateExpired State = 3
)

type Type

type Type uint8

Type represents the type of session.

const (
	TypeMacaroonReadonly Type = 0
	TypeMacaroonAdmin    Type = 1
	TypeMacaroonCustom   Type = 2
	TypeUIPassword       Type = 3
	TypeAutopilot        Type = 4
	TypeMacaroonAccount  Type = 5
)

Jump to

Keyboard shortcuts

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