advancedcapability

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package advancedcapability verifies the short-lived, secret-free capabilities which authorize individual StackKits advanced operations.

Verification is deliberately offline. Callers must inject a versioned trust bundle and the exact local stack, owner, and operation scope being admitted.

Index

Constants

View Source
const (
	SchemaVersion            = "stackkit.advanced-capability/v1"
	TrustBundleSchemaVersion = "stackkit.advanced-trust-bundle/v1"
	Audience                 = "stackkit"
)
View Source
const (
	OperationDriftReconcileAdvanced   = "drift.reconcile.advanced"
	OperationRestoreDrill             = "restore.drill"
	OperationRollbackCoordinated      = "rollback.coordinated"
	OperationTerramateChangeSetApply  = "terramate.change-set.apply"
	OperationTerramateChangeSetCreate = "terramate.change-set.create"
)

Variables

This section is empty.

Functions

func VerifyIdentityProjectionDigest

func VerifyIdentityProjectionDigest(
	bundle *TrustBundle,
	issuerID, keyID string,
	digest, signature []byte,
) error

VerifyIdentityProjectionDigest verifies one domain-separated desired identity projection digest against the exact Owner-approved issuer/key binding. It intentionally exposes neither trusted public-key bytes nor a generic signing oracle to callers.

func VerifyTrustedDigest

func VerifyTrustedDigest(bundle *TrustBundle, issuerID, keyID string, digest, signature []byte) error

VerifyTrustedDigest verifies one domain-separated digest against the exact Owner-approved issuer/key binding used by Advanced capability verification. It is the only additional trust seam needed by authenticated execution channels: callers cannot supply a second trust schema, store, or key parser.

Types

type Denial

type Denial struct {
	Code   ReasonCode
	Field  string
	Detail string
}

Denial is returned for every Verify failure. Code is stable; Field and Detail are diagnostic and must not be used as policy inputs.

func (*Denial) Error

func (d *Denial) Error() string

type Grant

type Grant struct {
	CapabilityID      string
	IssuerID          string
	StackID           string
	OwnerRef          string
	AllowedOperations []string
	UIManagerRef      string
	RILRef            string
	IssuedAt          time.Time
	ExpiresAt         time.Time
	KeyID             string
}

Grant is the fully verified and locally scoped capability.

func Verify

func Verify(raw []byte, request Request) (Grant, error)

Verify validates signature, trust, lifetime, and the exact caller-supplied local scope without network access or side effects.

type ReasonCode

type ReasonCode string

ReasonCode is a stable, machine-readable fail-closed denial reason.

const (
	ReasonTrustBundleUnavailable     ReasonCode = "advanced_trust_bundle_unavailable"
	ReasonCapabilityRequired         ReasonCode = "advanced_capability_required"
	ReasonCapabilityMalformed        ReasonCode = "advanced_capability_malformed"
	ReasonCapabilityUntrustedKey     ReasonCode = "advanced_capability_untrusted_key"
	ReasonCapabilitySignatureInvalid ReasonCode = "advanced_capability_signature_invalid"
	ReasonCapabilityNotYetValid      ReasonCode = "advanced_capability_not_yet_valid"
	ReasonCapabilityExpired          ReasonCode = "advanced_capability_expired"
	ReasonCapabilityLifetimeExceeded ReasonCode = "advanced_capability_lifetime_exceeded"
	ReasonCapabilityScopeMismatch    ReasonCode = "advanced_capability_scope_mismatch"
	ReasonCapabilityOperationDenied  ReasonCode = "advanced_capability_operation_denied"
	ReasonAdvancedChangeSetInvalid   ReasonCode = "advanced_change_set_invalid"
	ReasonAdvancedChangeSetStale     ReasonCode = "advanced_change_set_stale"
	ReasonCapabilityUnavailable      ReasonCode = "advanced_capability_unavailable"
)

func Reason

func Reason(err error) (ReasonCode, bool)

Reason returns a stable reason code for a denial.

type Request

type Request struct {
	Now          time.Time
	TrustBundle  *TrustBundle
	StackID      string
	OwnerRef     string
	Operation    string
	IssuerID     string
	UIManagerRef string
	RILRef       string
}

Request binds verification to the exact local operation being admitted. Optional expected issuer/approval references add narrower caller scope.

type TrustBundle

type TrustBundle struct {
	SchemaVersion string
	Keys          []TrustedKey
}

TrustBundle is injected by the StackKits composition root. Verification performs no network, environment, file, or Techstack-client discovery.

type TrustedKey

type TrustedKey struct {
	KeyID     string
	IssuerID  string
	PublicKey ed25519.PublicKey
}

TrustedKey is one explicitly trusted Techstack issuer key. PublicKey is the raw 32-byte Ed25519 public key, never a credential or private key.

Jump to

Keyboard shortcuts

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