authority

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 21 Imported by: 1 module, 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 authority defines provider-independent evidence selected by trusted deployment policy. Model output may refer to this evidence, but it cannot manufacture it through a cognition output port.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEffectReceiptClosed means the deployment-owned key lifecycle ended.
	ErrEffectReceiptClosed = errors.New("client-effect receipt provider is closed")
	// ErrEffectReceiptInvalid deliberately covers syntax, key drift, and
	// cryptographic tampering without exposing which property of an opaque
	// receipt was useful to an attacker.
	ErrEffectReceiptInvalid = errors.New("client-effect receipt is invalid")
	// ErrEffectReceiptExpired is distinct so a caller can report an actionable
	// retry without retaining the receipt or its claims in evidence.
	ErrEffectReceiptExpired = errors.New("client-effect receipt expired")
	// ErrEffectReceiptMismatch means a valid receipt was replayed for a
	// different session, call, declaration, argument object, or target.
	ErrEffectReceiptMismatch = errors.New("client-effect receipt does not authorize this exact call")
)

Functions

func CandidateType

func CandidateType() element.Type

CandidateType is the exact graph type emitted by activation policies and consumed by authority joins.

func CanonicalEffectArguments

func CanonicalEffectArguments(source []byte) (json.RawMessage, string, error)

CanonicalEffectArguments normalizes one strict JSON object and returns the exact sha256 digest used on both the gateway and host sides of a receipt.

Types

type Candidate

type Candidate struct {
	RunID                    string `json:"run_id"`
	SessionID                string `json:"session_id"`
	ActivationItemID         string `json:"activation_item_id"`
	ActivationCauseItemID    string `json:"activation_cause_item_id"`
	ObservationItemID        string `json:"observation_item_id"`
	ObservationTriggerItemID string `json:"observation_trigger_item_id"`
	SourceRevision           uint64 `json:"source_revision"`
	ContextVersion           uint64 `json:"context_version"`
	ContextEnvelopeItemID    string `json:"context_envelope_item_id"`
	ContextTailItem          string `json:"context_tail_item"`
	// ContextExtended says the context was rebased past the observation
	// onto newer items - a decision held while the voice was speaking is
	// taken against everything the voice has said since - so the tail is
	// not descended from the observation, only later than it.
	ContextExtended bool `json:"context_extended,omitempty"`
}

Candidate records the observation basis selected by one activation decision. It deliberately contains identities and revisions rather than an authority label: effect admission derives actual authority from the deployment-owned canonical trajectory.

ActivationItemID is the cognition.Generate trigger emitted by the same policy decision. ActivationCauseItemID is the committed-observation outcome that released the decision. ObservationItemID is the canonical trajectory item the policy selected as the basis, while ObservationTriggerItemID is the ingress/perception envelope recorded by that item.

type EffectReceiptClaims

type EffectReceiptClaims struct {
	SessionID         string `json:"session_id"`
	CallID            string `json:"call_id"`
	Name              string `json:"name"`
	ArgumentsDigest   string `json:"arguments_digest"`
	DeclarationDigest string `json:"declaration_digest"`
	Target            string `json:"target"`
}

EffectReceiptClaims are the complete server-owned authority boundary for one client effect. They contain no model or client assertion of authority: only an EffectReceiptIssuer can seal them.

type EffectReceiptIssuer

type EffectReceiptIssuer interface {
	IssueEffectReceipt(context.Context, EffectReceiptClaims) (string, error)
}

EffectReceiptIssuer is the gateway seam. A deployment may replace the in-process sealed implementation with an HSM or remote authority service.

type EffectReceiptIssuerProvider

type EffectReceiptIssuerProvider interface {
	EffectReceiptIssuer
	Available() bool
}

EffectReceiptIssuerProvider is the lifecycle-aware gateway selection. A gateway offers client.effects only while Available reports true, so key revocation or provider loss cannot leave negotiation promising authority it can no longer issue.

type EffectReceiptOptions

type EffectReceiptOptions struct {
	TTL    time.Duration
	Clock  func() time.Time
	Random io.Reader
}

EffectReceiptOptions configures a sealed provider. Key material is always generated internally and is never returned. Clock and Random exist for deterministic conformance tests and replaceable platform entropy sources.

type EffectReceiptProvider

type EffectReceiptProvider interface {
	EffectReceiptIssuerProvider
	EffectReceiptVerifierProvider
}

EffectReceiptProvider is the common in-process deployment shape. Issuer and verifier remain separate interfaces so they can be deployed independently.

type EffectReceiptVerifier

type EffectReceiptVerifier interface {
	VerifyEffectReceipt(context.Context, string, EffectReceiptClaims) error
}

EffectReceiptVerifier is the effect-host seam. Verification accepts the expected claims rather than returning ambient authority for a caller to interpret loosely.

type EffectReceiptVerifierProvider

type EffectReceiptVerifierProvider interface {
	EffectReceiptVerifier
	Identity() string
	Close() error
}

EffectReceiptVerifierProvider is a lifecycle-aware verifier selected by a descriptor-locked host plugin. Identity is non-secret and must remain stable for the provider's lifetime; Close revokes all outstanding receipts.

type SealedEffectReceipts

type SealedEffectReceipts struct {
	// contains filtered or unexported fields
}

SealedEffectReceipts issues compact AES-256-GCM receipts. It stores only the raw key so Close can overwrite it; cipher schedules are created for one operation and discarded. No receipt or claim is retained after a call.

func NewSealedEffectReceipts

func NewSealedEffectReceipts(options EffectReceiptOptions) (*SealedEffectReceipts, error)

NewSealedEffectReceipts creates one issuer/verifier key domain. The caller must close it; Close is idempotent and synchronizes with in-flight crypto.

func (*SealedEffectReceipts) Available

func (provider *SealedEffectReceipts) Available() bool

Available reports whether this key domain can still issue and verify. It carries no receipt, identity, or key material.

func (*SealedEffectReceipts) Close

func (provider *SealedEffectReceipts) Close() error

Close revokes every receipt in this key domain and overwrites retained key bytes. It waits for active issue/verify operations before zeroizing.

func (*SealedEffectReceipts) Identity

func (provider *SealedEffectReceipts) Identity() string

Identity is a stable, non-secret provider identity suitable for live dependency drift checks. It is not a key fingerprint.

func (*SealedEffectReceipts) IssueEffectReceipt

func (provider *SealedEffectReceipts) IssueEffectReceipt(
	ctx context.Context, claims EffectReceiptClaims,
) (string, error)

IssueEffectReceipt seals one exact, short-lived call authorization.

func (*SealedEffectReceipts) VerifyEffectReceipt

func (provider *SealedEffectReceipts) VerifyEffectReceipt(
	ctx context.Context, receipt string, expected EffectReceiptClaims,
) error

VerifyEffectReceipt authenticates, expires, and exact-matches one opaque receipt. A receipt for the same call may be retransmitted; irreversible duplicate suppression remains the effect host's idempotency responsibility.

Jump to

Keyboard shortcuts

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