rotate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 11 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 rotate owns broker-side credential rotation. A rotator knows one provider's key-management API: create a fresh credential, verify it, retire the old one. Agents never see this — the item id and grants are unchanged, only the sealed material is replaced.

Coverage is a matrix, not a claim: providers with issuance APIs get zero-touch rotation; dashboard-only providers get nothing here yet.

Index

Constants

View Source
const WellKnownPath = "/.well-known/key-rotation"

WellKnownPath is the discovery path for providers implementing the open key-rotation contract.

Variables

This section is empty.

Functions

func Coverage

func Coverage() []string

Coverage is the provider matrix for docs/status — which hosts rotate zero-touch, sorted deterministically.

func ErrNoRotator

func ErrNoRotator() error

func ManagementEndpoint

func ManagementEndpoint(rawURL string) bool

ManagementEndpoint reports whether rawURL targets a registered provider's key-management endpoint — paths only the broker's RotateItem may call.

func Register

func Register(host string, r Rotator)

Register binds a rotator to a host or host:port.

func RegisterSpec

func RegisterSpec(spec Spec) error

RegisterSpec validates and registers a declarative provider rotator for spec.Host.

Types

type Rotator

type Rotator interface {
	// Create mints a fresh credential for the item's name, returning the new
	// secret and the provider-side key id (stored on the item so the old
	// credential can be retired later). liveKey is the current secret.
	Create(ctx context.Context, itemName string, liveKey []byte) (secret []byte, keyID string, err error)
	// Verify proves the new credential authenticates — cheap authed call,
	// no side effects.
	Verify(ctx context.Context, secret []byte) error
	// Retire deletes the provider-side credential by id, signed with
	// liveKey. Best-effort — an orphan key still costs the provider
	// nothing, but it must be logged.
	Retire(ctx context.Context, keyID string, liveKey []byte) error
	// ManagementPaths lists URL path prefixes on this provider's host that
	// mint, list, or revoke API keys. Agent fetch calls to these paths are
	// denied by the grant engine so a self-rotating credential cannot be
	// used by an agent to mint its own keys.
	ManagementPaths() []string
}

Rotator is one provider's key-management API. Create and Retire take the live (old) secret as an explicit parameter — it signs the provider's management calls. It is never stored in a context or logged.

func ForHost

func ForHost(rawURL string) (Rotator, bool)

ForHost maps an item's URI host to a registered provider rotator.

func NewSpecRotator

func NewSpecRotator(spec Spec) (Rotator, error)

NewSpecRotator validates a declarative Spec and returns a Rotator pinned to spec.Host that refuses all HTTP redirects.

type Spec

type Spec struct {
	Host            string         `json:"host"`
	Scheme          string         `json:"scheme,omitempty"`
	CreatePath      string         `json:"create_path"`
	CreateBody      map[string]any `json:"create_body,omitempty"`
	TokenField      string         `json:"token_field"`
	KeyIDField      string         `json:"key_id_field"`
	VerifyPath      string         `json:"verify_path"`
	RetirePath      string         `json:"retire_path"` // "{id}" is replaced with the key ID
	RetireMethod    string         `json:"retire_method,omitempty"`
	ManagementPaths []string       `json:"management_paths"`
}

Spec is the declarative 3-operation rotation contract (create, verify, retire). All paths are relative to BaseURL's host and HTTP redirects are refused so a live credential is never forwarded off-host.

Jump to

Keyboard shortcuts

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