Help us shape the future of Go! Take the 2026 Go Developer Survey

registration

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package registration derives a session's ID from its host key and proves, over one connection, that a host holds that key.

Index

Constants

View Source
const (
	// SecretLen is the length of a session secret. The secret keeps the ID
	// from being computable by anyone who learns the public key, and the relay
	// refuses any other length.
	SecretLen = 16
	// IDLen is the length of a derived session ID. It matches the shape of
	// random IDs the relay issues today, so connect strings and tooling don't
	// change.
	IDLen = 20 // the shape of uniuri.NewLen(uniuri.UUIDLen)

	// RefusedProof is what the relay sends when it refuses a registration's
	// proof. The host classifies this refusal by this exact text, so it is
	// part of the wire contract.
	RefusedProof = "upterm: session proof refused"
	// Superseded is what the relay sends when a newer registration supersedes
	// an older one. The host classifies this refusal by this exact text, so it
	// is part of the wire contract.
	Superseded = "upterm: superseded by a newer registration"
)

Variables

This section is empty.

Functions

func ID

func ID(sessionKey ssh.PublicKey, secret []byte) string

ID derives a deterministic session ID from the session key and secret. Host and relay both compute it independently and may run different versions, so the output is pinned by a golden test. Its hash input is domain-separated from the message a proof signs, so neither can be passed off as the other.

func NewSecret

func NewSecret() ([]byte, error)

NewSecret generates a new session secret for a host process. The secret is kept in memory for the process's lifetime, and that stability keeps the session ID constant across redials.

func Sign

func Sign(key ssh.Signer, sshSessionID, secret []byte, generation uint64) ([]byte, error)

Sign generates a proof of key possession. It binds the proof to one SSH connection (so a captured proof can't replay on another connection) and to one generation (so a delayed older registration can't claim a newer one's place).

func Verify

func Verify(sessionKey ssh.PublicKey, sshSessionID, secret []byte, generation uint64, proof []byte) error

Verify is what the relay runs before accepting a derived ID. It checks the inputs itself because a hostile host can sign any message it likes, including generation 0, an empty session ID, or an invalid secret length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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