enrollment

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package enrollment defines single-machine installation invitations.

Index

Constants

This section is empty.

Variables

View Source
var ErrPendingInvitation = errors.New("name has an existing invitation")

ErrPendingInvitation identifies a name reservation that force may retract.

Functions

func GatewayURL

func GatewayURL(value string) (string, error)

func Hash

func Hash(secret string) string

func InstallCommand

func InstallCommand(link string, windows bool, mode string) string

func Message

func Message(ticket string, r Redemption) []byte

func PowerShellQuote

func PowerShellQuote(s string) string

func Script

func Script(invitation Invitation, link string) (string, error)

func ShellQuote

func ShellQuote(s string) string

func SystemName added in v0.5.0

func SystemName(name string) string

func SystemTicket added in v0.5.0

func SystemTicket(ticket string) string

SystemTicket derives a separate companion ticket without storing either installation URL in the gateway database.

Types

type Invitation

type Invitation struct {
	UserID      string `json:"userId,omitempty"`
	ID          string `json:"id"`
	Name        string `json:"name"`
	AutoName    bool   `json:"autoName,omitempty"` // Hostname selected and signed by the target installer.
	Gateway     string `json:"gateway"`
	ServiceMode string `json:"serviceMode,omitempty"`
	// HybridID links independently enrolled User and System contexts. The
	// companion uses a separate ticket, credential, identity, and profile.
	HybridID   string         `json:"hybridId,omitempty"`
	HybridRole string         `json:"hybridRole,omitempty"`
	Asset      update.Asset   `json:"asset"`            // Selected binary; first candidate until architecture selection.
	Assets     []update.Asset `json:"assets,omitempty"` // Pinned candidates for architecture-detecting installers.
	Version    string         `json:"version"`
	ExpiresAt  time.Time      `json:"expiresAt"`
	CreatedAt  time.Time      `json:"createdAt"`
	RedeemedID string         `json:"redeemedId,omitempty"`
	ReplaceID  string         `json:"replaceId,omitempty"` // Existing identity reserved by a same-name invitation.
	Revoked    bool           `json:"revoked"`
}

func (Invitation) Candidates

func (i Invitation) Candidates() []update.Asset

func (Invitation) ResolveName

func (i Invitation) ResolveName(hostname string) (string, error)

ResolveName runs on the target. The resolved name is persisted with the pending enrollment so a retry cannot rename the machine if its hostname changes.

func (Invitation) Select

func (i Invitation) Select(arch string) (update.Asset, bool)
type Link struct {
	Invitation
	URL     string `json:"url"`
	Command string `json:"command"`
}

type Redemption

type Redemption struct {
	Arch           string `json:"arch,omitempty"`
	Name           string `json:"name,omitempty"`
	PublicKey      []byte `json:"publicKey"`
	CredentialHash string `json:"credentialHash"`
	Signature      []byte `json:"signature"`
}

type Request

type Request struct {
	Name        string `json:"name"`
	AutoName    bool   `json:"autoName,omitempty"`
	OS          string `json:"os"`
	Arch        string `json:"arch,omitempty"`
	TTLSeconds  int    `json:"ttlSeconds,omitempty"`
	Gateway     string `json:"gateway"`
	ServiceMode string `json:"serviceMode,omitempty"`
	Force       bool   `json:"force,omitempty"`
}

Jump to

Keyboard shortcuts

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