enrollment

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package enrollment holds the enrollment-token lifetime policy shared by the API and Web UI host-creation paths. Keeping the resolver in one place stops the two paths from drifting: GHSA-g4x6-jcvr-9m3g was exactly such a drift — the API honored the configured TTL while the Web UI hardcoded 24h.

Index

Constants

View Source
const DefaultTokenTTL = 24 * time.Hour

DefaultTokenTTL is the fallback lifetime applied when neither a per-network override nor a server-level default is configured (ADR 0004 §7.1).

Variables

This section is empty.

Functions

func TokenTTL

func TokenTTL(ctx context.Context, g NetworkConfigGetter, defaultTTL time.Duration, networkID string) time.Duration

TokenTTL resolves the enrollment-token TTL for networkID. Order of precedence: the per-network `enrollment_token_ttl` value in network_config, then the server-level defaultTTL, then DefaultTokenTTL. A non-positive defaultTTL is treated as unset. A missing, empty, unparseable, or non-positive per-network value falls through to the next level.

Types

type NetworkConfigGetter

type NetworkConfigGetter interface {
	GetNetworkConfig(ctx context.Context, networkID, key string) (string, error)
}

NetworkConfigGetter reads a single per-network configuration value. Both store.Store and *store.SQLiteStore satisfy it via GetNetworkConfig, so the resolver stays decoupled from the full store surface.

Jump to

Keyboard shortcuts

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