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 ¶
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 ¶
ManagementEndpoint reports whether rawURL targets a registered provider's key-management endpoint — paths only the broker's RotateItem may call.
func RegisterSpec ¶
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 NewSpecRotator ¶
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.