xap

package module
v0.1.1 Latest Latest
Warning

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

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

README

xap-go

ci pkg.go.dev protocol scope signatures license

The reference verifier for the Execution Authority Protocol (XAP), protocol version xap-1.0.0. Go, standard-library first, holds no signing keys.

Don't trust an execution receipt — verify it. xap-go reproduces a receipt's digests and constraint outcomes from public keys alone, with no access to the enforcement point that issued it (¶0017).

What it does

xap-go is the verification side of XAP. It validates Machine Authority Tokens (MATs), verifies execution receipts, validates delegation chains, checks commitment bindings, and reconstructs multi-agent provenance — entirely from public keys and trust anchors. It performs no issuance and no enforcement: those are the job of the licensed enforcement engine, and this SDK exists so that any party can independently check that engine's output, now or years later.

Signatures are hybrid post-quantum by default — ECDSA P-384 + ML-DSA-65 (NIST FIPS 204), both halves must verify — with Ed25519 and ECDSA P-256 also supported.

Packages

  • root xap — protocol types (MAT, Receipt, CommitmentObject, RuntimeContext, Constraint), COSE_Sign1 verification, TrustAnchorSet, the Verifier (¶0095), delegation validation (¶0057), and provenance reconstruction (¶0084A).
  • canonical — the canonicalization function (Core Deterministic CBOR) and SHA-256 digest (¶0018, ¶0085).
  • conformance — runs the embedded conformance vectors.
  • cmd/xap — the CLI.
  • cmd/verify-wasm — the verify path compiled to WebAssembly (powers the in-browser verifier at vidimuslabs.com/verify).
  • examples/ — verify a receipt; validate a delegation chain; recompute a digest.

Verify a receipt

anchors := xap.NewTrustAnchorSet()
anchors.AddEd25519(kid, pub)

res := xap.NewVerifier(anchors).Verify(xap.VerifyInput{
    ReceiptEnvelope:   receiptCBOR,
    MATEnvelope:       matCBOR,
    ReproducedContext: &ctx,
})
fmt.Println(res.Valid, res.Decision)

CLI

xap verify  <receipt.hex> [--mat <mat.hex>] [--context <ctx.json>] \
            [--prior <receipt.hex>] [--commitment <c.hex>] --anchors <anchors.json>
xap inspect <mat.hex|receipt.hex|commitment.hex>
xap vectors run
xap digest  <context.json>

Test

go test ./...            # unit, property, determinism, adversarial, conformance
go run ./cmd/xap vectors run

Specification & conformance

The normative specification, the frozen xap-1.0.0 wire schema, and the golden conformance vectors live in xap-spec; xap vectors run replays them against this SDK. Paper: DOI 10.5281/zenodo.21144476.

Status

Verify-only reference SDK · protocol xap-1.0.0 (frozen) · hybrid post-quantum · patent-pending.

License

Apache License 2.0 — see LICENSE and NOTICE. Free to use, modify, and redistribute.

Apache 2.0 Section 3 carries a patent grant, made here by Yandeh Holdings Inc. as assignee of the XAP portfolio. It reaches this Work — the verification side. The licensed enforcement engine is a separate work under separate terms.


Protected by U.S. Patent No. [PENDING ISSUANCE — 19/570,167] and pending applications. www.vidimuslabs.com/patents

Documentation

Overview

Package xap is the reference SDK for the Execution Authority Protocol (XAP). It provides the protocol data types (Machine Authority Token, verifiable execution receipt, commitment object, runtime context), the canonical digest computation, MAT parsing and validation, receipt parsing and verification, delegation-chain validation, and multi-agent commitment provenance reconstruction.

Boundary: this package is verification-side. It can validate MATs and verify receipts using public keys and trust anchors, and it can recompute digests and constraint outcomes to confirm a proof structure. It deliberately holds no signing keys and no issuance or enforcement logic — those live in the private engine and server. Nothing here imports a private package.

Spec authority: the patent specification of U.S. patent application 19/570,167, as amended by the preliminary amendment filed in that application. Paragraph anchors (¶NNNN) in comments cite the amended specification for every protocol-semantic decision. The protocol layer is transcribed in xap-spec/docs/SPEC.md.

Index

Constants

View Source
const (
	FaultScopeUnconstrainedEscalation = "scope.unconstrained_escalation"
	FaultScopeActionsUnstated         = "scope.actions_unstated"
	FaultScopeResourcesUnstated       = "scope.resources_unstated"
	FaultScopeActionNotCovered        = "scope.action_not_covered"
	FaultScopeResourceNotCovered      = "scope.resource_not_covered"
	FaultScopeTraversalUnconstrained  = "scope.resource_traversal_unconstrained"

	FaultBoundaryMaxImpact         = "boundary.max_impact"
	FaultBoundaryMaxPrivilegeDelta = "boundary.max_privilege_delta"
	FaultBoundaryQuotaDropped      = "boundary.quota_dropped"
	FaultBoundaryQuotaExceeded     = "boundary.quota_exceeded"
	FaultBoundaryQuotaNotInParent  = "boundary.quota_not_in_parent"
	FaultBoundaryExclusionDropped  = "boundary.exclusion_dropped"

	FaultConstraintDropped      = "constraint.dropped"
	FaultConstraintTypeMismatch = "constraint.type_mismatch"
	// FaultConstraintLooserPrefix is completed with the constraint TYPE, because
	// each type has its own strictness comparison and they are separate code
	// paths. "constraint.looser.temporal" being pinned says nothing about
	// "constraint.looser.param_bound".
	FaultConstraintLooserPrefix = "constraint.looser."

	FaultObligationMissing  = "obligation.missing"
	FaultObligationLoosened = "obligation.freshness_loosened"

	FaultDelegationNotAllowed = "delegation.not_allowed"

	FaultChainEmpty         = "chain.empty"
	FaultChainNotRoot       = "chain.not_root"
	FaultChainLinkBreak     = "chain.link_break"
	FaultChainCycle         = "chain.cycle"
	FaultChainDepthUnstated = "chain.depth_unstated"
	FaultChainDepthExceeded = "chain.depth_exceeded"
)

Derivation fault paths name the exact rule a derivation or a chain broke. The sentinel errors above identify which INVARIANT failed, which is one level too coarse to hold a conformance corpus to: invariant (ii) alone has six distinct ways to fail, and pinning one of them looks identical, from the outside, to pinning all six. A named path makes coverage of this surface measurable the way the verifier's named checks made coverage of that one measurable (CF-xap-43).

View Source
const (
	ScopeDimensionActions   = "actions"
	ScopeDimensionResources = "resources"
)

ScopeDimension names a scope dimension for ExecutionScope.Unconstrained.

View Source
const ProtocolVersion = constants.ProtocolVersion

Re-export the protocol version so SDK callers need not import constants directly for the common case.

Variables

View Source
var (
	// ErrScopeNotSubset: child scope is not a subset of parent scope
	// (invariant i).
	ErrScopeNotSubset = errors.New("delegation: child scope exceeds parent scope")
	// ErrBoundaryExceeded: child permission boundary is not equal to or more
	// restrictive than parent (invariant ii).
	ErrBoundaryExceeded = errors.New("delegation: child boundary exceeds parent boundary")
	// ErrConstraintNotStricter: some child constraint is looser than the
	// corresponding parent constraint (invariant iii).
	ErrConstraintNotStricter = errors.New("delegation: child constraint looser than parent")
	// ErrObligationsNotSuperset: child proof obligations do not include all
	// parent obligations (invariant iv).
	ErrObligationsNotSuperset = errors.New("delegation: child proof obligations omit a parent obligation")
	// ErrDelegationDepthExceeded: the derivation depth exceeds the parent's
	// delegation depth allowance (¶0041 field 134).
	ErrDelegationDepthExceeded = errors.New("delegation: depth exceeds parent allowance")
	// ErrDelegationNotAllowed: the parent does not permit delegation.
	ErrDelegationNotAllowed = errors.New("delegation: parent does not permit delegation")
	// ErrDelegationCycle: the delegation graph contains a cycle (¶0073).
	ErrDelegationCycle = errors.New("delegation: cyclic authorization graph")
)

Monotonic delegation invariants (FIG. 5, ¶0057). Derivation of a Child MAT from a Parent MAT is governed by four cryptographically enforced invariants, each with its own error type so a caller (or an adversarial test) can assert exactly which invariant a derived artifact violates. Enforcement points unconditionally reject derived artifacts failing derivation proof validation.

View Source
var ErrAnchorExists = errors.New("xap: a trust anchor is already registered for this key id")

ErrAnchorExists reports an attempt to register a key id that is already registered.

View Source
var ErrAnchorRoleMismatch = errors.New("xap: trust anchor is not registered for this artifact kind")

ErrAnchorRoleMismatch reports that an envelope verified against a key the operator did not register for that artifact kind.

View Source
var ErrIssuerKeyMismatch = errors.New("xap: MAT issuer key id does not match the verifying anchor")

ErrIssuerKeyMismatch reports that a MAT's signed issuer identity names a key id other than the one that actually verified it.

View Source
var ErrNoTrustAnchor = errors.New("xap: no trust anchor for key id")

Anchor registration rejects a malformed key instead of storing it.

The verification path hands an anchor's key to the underlying primitive, and crypto/ed25519.Verify panics on a public key that is not exactly ed25519.PublicKeySize bytes. An operator who registers the wrong bytes — an SPKI blob where a raw key belongs, or a zero value from an ignored decode error — therefore arms a panic that an attacker fires by sending an envelope naming that key id. Registration is where the operator can still act on the mistake; a request arriving hours later is not. Verification validates again anyway (see coseVerifierFor): this is the early gate, not the only one. ErrNoTrustAnchor reports that an envelope named a key id the verifier has no anchor for. It is distinct from a signature failure: the artifact may be perfectly well-formed and correctly signed by an issuer this verifier has not been configured to trust. Callers that conflate the two cannot tell "forged" from "unknown issuer", which are different operational problems.

Functions

func DecodeAny

func DecodeAny(payload []byte) (kind string, obj any, err error)

DecodeAny decodes a canonical payload into whichever protocol type it represents, discriminating by structure. Because the canonical decoder rejects unknown fields, exactly one of MAT / Receipt / CommitmentObject decodes cleanly for a well-formed payload.

func FaultPath

func FaultPath(err error) string

FaultPath returns the named rule err reports breaking, or "" if err is not a derivation fault.

func UnverifiedPayload

func UnverifiedPayload(envelope []byte) ([]byte, error)

UnverifiedPayload extracts the payload from a COSE_Sign1 envelope WITHOUT verifying the signature. It exists only for inspection tooling (`xap inspect`); every trust decision goes through the signature-verifying parse functions (ParseMAT/ParseReceipt/ParseCommitment). The name makes the absence of verification explicit at every call site.

func ValidateChain

func ValidateChain(chain []*MAT) error

ValidateChain validates a delegation chain from a root MAT down to a leaf, enforcing per-step derivation invariants, acyclicity (¶0073), and depth (¶0041 field 134). The chain is ordered root-first; chain[0] must be a root (no ParentID) and each subsequent element's ParentID must equal the previous element's ID.

func ValidateDerivation

func ValidateDerivation(parent, child *MAT) error

ValidateDerivation checks the four monotonic invariants for a single parent→child derivation step, plus delegation permission and depth (¶0057, ¶0041 field 134). It does not walk a chain; see ValidateChain.

func VerifyExpiry

func VerifyExpiry(mat *MAT, at time.Time) error

VerifyExpiry is a convenience lifecycle check the caller may run against the governing MAT before Verify; expired artifacts are unconditionally rejected (¶0065). It is separate from Verify because expiry depends on "now", which is the verifier's clock, not part of the signed receipt.

Types

type ActionCompliance

type ActionCompliance struct {
	// Action is the proposed action descriptor evaluated.
	Action string `cbor:"action"`
	// CommitmentCheck: action was within the declared action set.
	CommitmentCheck bool `cbor:"commitment_check"`
	// ScopeCheck: action was within the execution scope.
	ScopeCheck bool `cbor:"scope_check"`
	// BoundaryCheck: action was within the permission boundary.
	BoundaryCheck bool `cbor:"boundary_check"`
	// ConstraintOutcome: applicable constraints were satisfied at proposal time.
	ConstraintOutcome bool `cbor:"constraint_outcome"`
	// Code is a rationale/error code when any check failed.
	Code string `cbor:"code,omitempty"`
}

ActionCompliance is the per-action commitment compliance record (¶0084A Commitment Compliance Field). It lets a verifier confirm, from the proof structure alone, that the proposed action was evaluated against the commitment object at the time of proposal.

type AttestationRef

type AttestationRef struct {
	// Category is the attestation category, e.g. "tpm_quote", "tee_report".
	Category string `cbor:"category"`
	// KeyDigest is a digest over the attested platform key.
	KeyDigest []byte `cbor:"key_digest,omitempty"`
}

AttestationRef references hardware-bound attestation evidence (FIG. 7, ¶0059).

type ChainLink struct {
	ReceiptID        string
	ArtifactID       string
	CommitmentDigest []byte
	ParentDigest     []byte // nil/empty at the root
}

ChainLink is one edge in a reconstructed provenance chain: a receipt and the commitment digest that governed it, plus its parent commitment digest (empty for the root agent).

func ReconstructProvenance

func ReconstructProvenance(receipts []*Receipt) ([]ChainLink, error)

ReconstructProvenance orders a set of receipts into a single provenance chain, root first, following each receipt's provenance parent digest back to the commitment it derives from (¶0084A). It fails if the receipts do not form a single connected chain, if a referenced parent is missing (a broken link), or if a cycle is present.

Each input receipt must carry a CommitmentDigest; a receipt's Provenance, when present, must reference the CommitmentDigest of exactly one other receipt in the set.

type Check

type Check struct {
	Name string `json:"name"`
	// Pass is false only for CheckFailed. A not-performed check does not
	// invalidate a receipt, so it reports true here — which is exactly why
	// Status exists alongside it.
	Pass   bool        `json:"pass"`
	Status CheckStatus `json:"status"`
	Detail string      `json:"detail,omitempty"`
}

Check is one named verification step and its outcome. JSON tags match the VerificationResult schema in the xap-spec OpenAPI.

type CheckStatus

type CheckStatus string

CheckStatus is the outcome of one verification step. A check is not a boolean. "Not performed" is a third answer, and §9 spends a paragraph on why it must not be collapsed into the first: reporting an unavailable check as passed asserts a gate that was never applied. Pass carried both meanings, so the distinction the spec insists on existed only in the detail string.

const (
	// CheckPassed: the check ran and the receipt satisfied it.
	CheckPassed CheckStatus = "passed"
	// CheckFailed: the check ran and the receipt did not satisfy it.
	CheckFailed CheckStatus = "failed"
	// CheckNotPerformed: the inputs did not permit re-evaluating this check.
	// The receipt is not refuted by it and is not vouched for by it either.
	CheckNotPerformed CheckStatus = "not_performed"
)

type CommitmentBinding

type CommitmentBinding struct {
	ArtifactID       string `cbor:"artifact_id"`
	ConstraintDigest []byte `cbor:"constraint_digest"`
}

CommitmentBinding binds a commitment object to exactly one governing artifact (¶0084A). ConstraintDigest must equal the governing MAT's ConstraintDigest.

type CommitmentObject

type CommitmentObject struct {
	Version string `cbor:"v"`
	// ID is the commitment object identifier.
	ID string `cbor:"id"`
	// AgentIdentity cryptographically binds the object to the generating agent.
	AgentIdentity MachineIdentity `cbor:"agent_identity"`
	// SessionID provides replay protection within a single session.
	SessionID string `cbor:"session_id"`
	// DeclaredActions is the bounded enumeration of action types, resource
	// targets, and parameter ranges the agent declares it will propose.
	DeclaredActions DeclaredActionSet `cbor:"declared_actions"`
	// TemporalValidity bounds when the object may be presented.
	TemporalValidity TemporalValidity `cbor:"temporal_validity"`
	// Binding names the governing artifact and carries the constraint digest
	// computed over that artifact's constraint set (¶0084A binding subfield).
	Binding CommitmentBinding `cbor:"binding"`

	// Optional fields (¶0095B).
	ResourceTargets []string              `cbor:"resource_targets,omitempty"`
	Provenance      *CommitmentProvenance `cbor:"provenance,omitempty"`
	ActionWindow    *TemporalValidity     `cbor:"action_window,omitempty"`
}

CommitmentObject is the machine-readable structure an autonomous agent generates before an execution session, declaring the bounded set of actions it will propose and binding itself to a governing authority artifact (¶0095B, ¶0060 as replaced). The agent signature is carried by the COSE_Sign1 envelope, not this payload.

func UnmarshalCommitment

func UnmarshalCommitment(payload []byte) (*CommitmentObject, error)

UnmarshalCommitment decodes a canonical CBOR payload into a CommitmentObject.

func (*CommitmentObject) Digest

func (c *CommitmentObject) Digest() ([]byte, error)

Digest returns the commitment digest — a hash over the canonical commitment object (¶0084A Commitment Digest Field). It is the value recorded in a receipt's commitment_digest field and referenced by a child's provenance.

func (*CommitmentObject) Marshal

func (c *CommitmentObject) Marshal() ([]byte, error)

Marshal returns the canonical CBOR payload of the commitment object.

func (*CommitmentObject) ValidateTemporal

func (c *CommitmentObject) ValidateTemporal(at time.Time) error

ValidateTemporal reports whether the commitment object is within its temporal validity at the given instant.

func (*CommitmentObject) VerifyBinding

func (c *CommitmentObject) VerifyBinding(gov *MAT) error

VerifyBinding performs the Commitment Binding Verification (¶0084A): it confirms the commitment's binding names the governing MAT and that its constraint digest matches a fresh digest of the governing MAT's constraint set. A mismatch means the commitment's declared constraint scope was computed from a different constraint set than the one the MAT encodes, and the commitment must be rejected.

func (*CommitmentObject) WithinScopeOf

func (c *CommitmentObject) WithinScopeOf(gov *MAT) error

WithinScopeOf reports whether every operation this commitment declares is one the governing MAT actually authorizes (¶0095A).

A commitment is a narrowing of the authority it binds to: an agent may commit to less than it was granted, never to more. Nothing verified that. The declared set was signed and carried, and COMMITMENT_SCOPE_VIOLATION existed as a code an enforcement point could assert — but an independent party had no way to reach the same conclusion, so the bounded-enumeration claim rested entirely on the issuer's word.

type CommitmentProvenance

type CommitmentProvenance struct {
	ParentArtifactID       string `cbor:"parent_artifact_id"`
	ParentCommitmentDigest []byte `cbor:"parent_commitment_digest"`
}

CommitmentProvenance references a parent commitment in a multi-agent derivation chain (¶0084A Commitment Provenance Field).

type Constraint

type Constraint struct {
	// ID uniquely identifies the constraint within an artifact; it labels the
	// per-constraint rationale in the receipt and pairs parent/child constraints
	// during delegation strictness checks.
	ID string `cbor:"id"`
	// Type is one of: "temporal", "network_zone", "rate_limit", "param_bound",
	// "resource_state", "latency_bound". Unknown types evaluate as unsatisfied.
	Type string `cbor:"type"`

	// temporal: execution permitted only within [NotBefore, NotAfter] (RFC3339).
	NotBefore string `cbor:"not_before,omitempty"`
	NotAfter  string `cbor:"not_after,omitempty"`

	// network_zone: context network zone must be a member of Zones.
	Zones []string `cbor:"zones,omitempty"`

	// param_bound: context parameter Param must satisfy Min<=v and v<=Max.
	Param string   `cbor:"param,omitempty"`
	Min   *float64 `cbor:"min,omitempty"`
	Max   *float64 `cbor:"max,omitempty"`

	// resource_state: context resource state at Key must equal Equals, or be a
	// member of In when In is non-empty.
	Key    string   `cbor:"key,omitempty"`
	Equals string   `cbor:"equals,omitempty"`
	In     []string `cbor:"in,omitempty"`

	// rate_limit: context rate for this constraint ID must not exceed MaxRate.
	MaxRate *int64 `cbor:"max_rate,omitempty"`

	// latency_bound: maximum evaluation latency in milliseconds (¶0077). This is
	// an evaluation budget, not a context predicate; it always evaluates as
	// satisfied and is consumed by the engine's latency path and by the
	// verifier's timing check.
	MaxMS int64 `cbor:"max_ms,omitempty"`
}

Constraint is one element of the portable constraint representation (MAT field 132, ¶0041; ¶0087). A constraint encodes a runtime condition evaluated against the runtime context at execution time with consistent, reproducible outcomes (¶0016, ¶0047). Only the fields relevant to Type are populated; the canonical encoding (Core Deterministic CBOR) drops empty fields so the on-the-wire form is stable regardless of which type a constraint is.

The verifier evaluates constraints with the same deterministic Evaluate method the engine uses, so an independent party recomputes the identical per-constraint outcome from the same context (¶0095).

func (Constraint) Evaluate

func (c Constraint) Evaluate(ctx RuntimeContext) bool

Evaluate evaluates the constraint against a runtime context with a deterministic, reproducible outcome (¶0016). The same (constraint, context) pair always yields the same result on any implementation.

type ConstraintOutcome

type ConstraintOutcome struct {
	ConstraintID string `cbor:"id"`
	Satisfied    bool   `cbor:"satisfied"`
	// Code is a rationale/error code from xap-spec/constants when Satisfied is
	// false (typically CONSTRAINT_EVALUATION_FAILURE).
	Code string `cbor:"code,omitempty"`
}

ConstraintOutcome is the binary evaluation result for one constraint, recorded in the receipt with an optional rationale/error code (¶0047).

type DeclaredActionSet

type DeclaredActionSet struct {
	ActionTypes []string     `cbor:"action_types"`
	Resources   []string     `cbor:"resources,omitempty"`
	ParamRanges []Constraint `cbor:"param_ranges,omitempty"`
	// Unconstrained names dimensions this set deliberately does not bound, using
	// the same vocabulary and the same rule as ExecutionScope.Unconstrained: an
	// absent list declares nothing, not everything. A commitment whose whole
	// purpose is to be a *bounded* enumeration must not become unbounded by
	// omission.
	Unconstrained []string `cbor:"unconstrained,omitempty"`
}

DeclaredActionSet is the bounded action enumeration the agent commits to (¶0095B). Membership is evaluated with consistent, reproducible outcomes.

func (DeclaredActionSet) Covers

func (d DeclaredActionSet) Covers(action, resource string) error

Covers reports whether the declared set admits the operation. An absent dimension admits nothing unless declared unconstrained.

type DelegationRights

type DelegationRights struct {
	Allowed  bool `cbor:"allowed"`
	MaxDepth int  `cbor:"max_depth"`
}

DelegationRights specifies whether and how deeply an artifact may be derived (MAT field 134, ¶0041; depth enforcement, ¶0073).

type DerivationFault

type DerivationFault struct {
	Path string
	Err  error
}

DerivationFault carries the named rule a derivation broke, alongside the human-readable reason. It wraps rather than replaces the sentinel errors, so errors.Is against ErrScopeNotSubset and friends keeps working.

func (*DerivationFault) Error

func (f *DerivationFault) Error() string

func (*DerivationFault) Unwrap

func (f *DerivationFault) Unwrap() error

type EvidenceRef

type EvidenceRef struct {
	Category string `cbor:"category"`
	Digest   []byte `cbor:"digest"`
	Fresh    bool   `cbor:"fresh"`
}

EvidenceRef is one entry in the integrity evidence reference set (¶0048, ¶0050). It carries a category, a digest over the evidence, and the freshness outcome evaluated at execution time.

type ExecutionScope

type ExecutionScope struct {
	// Actions is the set of permitted operation identifiers.
	Actions []string `cbor:"actions,omitempty"`
	// Resources is the set of permitted resource-target patterns. A pattern
	// ending in "*" matches any target sharing the literal prefix.
	Resources []string `cbor:"resources,omitempty"`
	// Policy is an optional opaque policy expression evaluated by the engine.
	Policy string `cbor:"policy,omitempty"`
	// Unconstrained names the dimensions this scope deliberately does not
	// restrict — "actions", "resources", or both.
	//
	// It exists because absence is not a statement. Without it an empty list has
	// to mean either "nothing is permitted" or "everything is permitted", and
	// whichever is chosen, the other is what some issuer meant. Reading absence
	// as "everything" makes the most permissive grant in the protocol the one
	// requiring the least typing, and an artifact that says nothing about a
	// dimension indistinguishable from one that deliberately opened it.
	//
	// So absence now denies, and permitting a whole dimension requires naming it
	// here. Delegation carries the same rule: a child may declare a dimension
	// unconstrained only where its parent already did.
	//
	// Optional and omitempty: absent from every canonical vector digest issued
	// before it existed, which is what the frozen xap-1.0.0 schema requires of a
	// within-version addition (SCHEMA.md).
	Unconstrained []string `cbor:"unconstrained,omitempty"`
}

ExecutionScope defines permitted operations as a bounded structured enumeration or policy expression (MAT field 124, ¶0041).

type HybridPublicKey

type HybridPublicKey struct {
	ECDSA *ecdsa.PublicKey
	MLDSA *mldsa65.PublicKey
}

HybridPublicKey is the pair of verification keys for a hybrid-ecdsa-p384-ml-dsa-65 anchor: the classical ECDSA P-384 key and the post-quantum ML-DSA-65 key. Both must verify for the composite signature to be accepted (¶0066).

type IssuerIdentity

type IssuerIdentity struct {
	ID  string `cbor:"id"`
	KID []byte `cbor:"kid,omitempty"`
}

IssuerIdentity identifies the issuing authority (MAT field 136, ¶0041). The signature itself is carried by the COSE_Sign1 envelope, not this struct; KID matches the envelope's key identifier so a verifier can select the anchor.

type MAT

type MAT struct {
	// Version is the protocol version embedded in every MAT (¶0081).
	Version string `cbor:"v"`
	// ID is the artifact instance identifier (field 138 instance ID / ¶0084
	// Authority Identifier Field).
	ID string `cbor:"id"`
	// ParentID references the parent artifact for a derived MAT; empty for a
	// root MAT (monotonic delegation, ¶0057).
	ParentID string `cbor:"parent_id,omitempty"`

	MachineIdentity  MachineIdentity    `cbor:"machine_identity"`  // field 122
	Scope            ExecutionScope     `cbor:"scope"`             // field 124
	Boundary         PermissionBoundary `cbor:"boundary"`          // field 126
	TrustVector      TrustVector        `cbor:"trust_vector"`      // field 128
	ProofObligations []ProofObligation  `cbor:"proof_obligations"` // field 130
	Constraints      []Constraint       `cbor:"constraints"`       // field 132
	Delegation       DelegationRights   `cbor:"delegation"`        // field 134
	Issuer           IssuerIdentity     `cbor:"issuer"`            // field 136
	Replay           ReplayProtection   `cbor:"replay"`            // field 138
}

MAT is a Machine Authority Token — the cryptographically signed data structure encoding a complete execution authority grant (FIG. 2, ¶0041). The nine semantic fields are the MAT structure; the issuer signature itself is carried by the COSE_Sign1 envelope (see SignedMAT), not this payload struct, so the payload canonicalizes independently of the signature (¶0041 field 136, "signatures over canonical serialization").

func UnmarshalMAT

func UnmarshalMAT(payload []byte) (*MAT, error)

UnmarshalMAT decodes a canonical CBOR payload into a MAT.

func (*MAT) ConstraintDigest

func (m *MAT) ConstraintDigest() ([]byte, error)

ConstraintDigest returns the canonical digest over the MAT's constraint set (¶0084A). A commitment object's commitment-binding subfield must carry this exact digest; the mismatch check is the Commitment Binding Verification Field (¶0084A) that prevents binding a commitment computed from a different constraint set than the one the governing MAT encodes.

func (*MAT) CoversOperation

func (m *MAT) CoversOperation(action, resource string) error

func (*MAT) Expired

func (m *MAT) Expired(at time.Time) bool

Expired reports whether the MAT's validity interval does not include at. Expired artifacts are unconditionally rejected (¶0065). A parse error in the timestamps is treated as expired (fail closed).

func (*MAT) Marshal

func (m *MAT) Marshal() ([]byte, error)

Marshal returns the canonical CBOR payload of the MAT (¶0085). This is the exact byte sequence a signer signs and a verifier's digest is computed over.

func (*MAT) ScopeReproducible

func (m *MAT) ScopeReproducible(action, resource string) bool

ScopeReproducible reports whether a receipt disclosing this action and resource carries enough to re-evaluate every dimension the MAT constrains.

It exists because "covered" and "checked" are different claims. CoversOperation skips the resource test when the receipt omits the resource, so a receipt that names an action and withholds its resource would otherwise return nil — and a verifier reporting that as a passing scope check would be asserting a gate it never applied. Selective disclosure (¶0071, ¶0079) makes such receipts legitimate; it does not make them checkable.

func (*MAT) ValidateAt

func (m *MAT) ValidateAt(at time.Time) error

ValidateAt checks structure and that the MAT is within its validity window at the given instant. It is the lifecycle gate applied before any execution evaluation (¶0065). Revocation state is external (a revocation set) and checked by the engine, not by the SDK.

func (*MAT) ValidateStructure

func (m *MAT) ValidateStructure() error

ValidateStructure checks that a MAT is structurally well formed and carries a recognized protocol version. It does not check signatures (see ParseMAT) or lifecycle timing (see ValidateAt).

type MachineIdentity

type MachineIdentity struct {
	// Kind is one of "public_key", "cert_ref", "attestation", "composite".
	Kind        string            `cbor:"kind"`
	PublicKey   []byte            `cbor:"public_key,omitempty"`
	CertRef     string            `cbor:"cert_ref,omitempty"`
	Attestation *AttestationRef   `cbor:"attestation,omitempty"`
	Composite   []MachineIdentity `cbor:"composite,omitempty"`
}

MachineIdentity binds an artifact or commitment object to a specific machine or agent entity (MAT field 122, ¶0041; commitment agent identity, ¶0095B). The identity may be a raw public key, a certificate reference, a hardware attestation-bound identifier, or a composite of several anchors.

type PermissionBoundary

type PermissionBoundary struct {
	// MaxImpact is the maximum impact bound (a numeric ceiling).
	MaxImpact int64 `cbor:"max_impact"`
	// MaxPrivilegeDelta is the maximum privilege delta bound.
	MaxPrivilegeDelta int64 `cbor:"max_privilege_delta"`
	// ResourceQuotas is a per-resource numeric quota ceiling.
	ResourceQuotas map[string]int64 `cbor:"resource_quotas,omitempty"`
	// Exclusions lists actions or resources that are never permitted. A child
	// boundary that adds exclusions is more restrictive (¶0057 invariant ii).
	Exclusions []string `cbor:"exclusions,omitempty"`
}

PermissionBoundary encodes non-exceedable hard limits — a strict ceiling enforced by derivation proof validation (MAT field 126, ¶0041).

type ProofObligation

type ProofObligation struct {
	// Category, e.g. "software_attestation", "tpm_quote", "tee_report".
	Category string `cbor:"category"`
	// MaxAgeSeconds is the freshness window; evidence older than this fails
	// validation at execution time (¶0048).
	MaxAgeSeconds int64 `cbor:"max_age_seconds"`
}

ProofObligation specifies a category and freshness requirement of integrity evidence (MAT field 130, ¶0041).

type ProvenanceRef

type ProvenanceRef struct {
	ParentArtifactID       string `cbor:"parent_artifact_id"`
	ParentCommitmentDigest []byte `cbor:"parent_commitment_digest"`
}

ProvenanceRef ties a receipt to a parent agent's authority artifact and commitment in a multi-agent derivation chain (¶0084A).

type Receipt

type Receipt struct {
	Version string `cbor:"v"`
	// ID is the receipt identifier (¶0097).
	ID string `cbor:"id"`
	// ArtifactID references the governing authority artifact (¶0050).
	ArtifactID string `cbor:"artifact_id"`
	// Action and Resource name the operation this receipt decided — ¶0097's
	// "reference to an execution request or operation". Without them a receipt
	// proves that a decision was made under ArtifactID against ContextDigest, but
	// not *what* was authorized, and an independent verifier cannot reproduce the
	// scope and boundary check of ¶0046 (pipeline step 2). Optional so that
	// pre-existing receipts still decode and so selective disclosure (¶0071,
	// ¶0079) can omit them; when present, Verify recomputes scope membership and
	// the boundary exclusion check against the governing MAT.
	Action   string `cbor:"action,omitempty"`
	Resource string `cbor:"resource,omitempty"`
	// Decision is the ternary execution control decision (¶0049).
	Decision string `cbor:"decision"`
	// Controls lists applied execution controls when Decision is
	// permit_with_controls (¶0049).
	Controls []string `cbor:"controls,omitempty"`
	// ContextDigest is the runtime context digest (¶0010). 32 bytes for SHA-256.
	ContextDigest []byte `cbor:"context_digest"`
	// RationaleCodes are signature-bound rationale/error codes (¶0084 addition).
	RationaleCodes []string `cbor:"rationale_codes,omitempty"`
	// ConstraintOutcomes records each constraint's binary outcome (¶0047).
	ConstraintOutcomes []ConstraintOutcome `cbor:"constraint_outcomes,omitempty"`
	// EvidenceRefs is the evidence reference set (¶0050, ¶0048).
	EvidenceRefs []EvidenceRef `cbor:"evidence_refs,omitempty"`
	// PolicyDigest is the constraint-compilation digest (¶0076): a digest over
	// the governing MAT's canonical constraint set — the same value
	// MAT.ConstraintDigest computes. Defining it over the PORTABLE constraint
	// representation (¶0087) rather than an engine's internal compiled form is
	// what makes it checkable: an internal form is an implementation's own
	// business, and two conforming engines may represent it differently and both
	// be right, so a digest over it could never be compared by anyone.
	PolicyDigest []byte `cbor:"policy_digest,omitempty"`
	// Timing records evaluation start/completion/elapsed (¶0053).
	Timing Timing `cbor:"timing"`
	// PriorReceiptHash chains this receipt to the previous one (FIG. 11, ¶0063).
	// It carries the previous receipt's Digest — see Digest for why the link is
	// defined over the payload rather than the envelope.
	PriorReceiptHash []byte `cbor:"prior_hash,omitempty"`
	// ResourceStateDigest supports optimistic concurrency consistency checks
	// (¶0054). It is a digest over the resource-state variables named by
	// ResourceKeys, read at evaluation time.
	ResourceStateDigest []byte `cbor:"resource_state_digest,omitempty"`
	// ResourceKeys names the resource-state variables ResourceStateDigest was
	// computed over. Without it the digest is unreproducible: a verifier holding
	// the whole reproduced context still cannot tell which subset was read, so
	// the field could be carried and compared by nobody.
	ResourceKeys []string `cbor:"resource_keys,omitempty"`
	// Speculative flags a speculative evaluation pending confirmation (¶0078).
	Speculative bool `cbor:"speculative,omitempty"`
	// Confirms is the digest of the speculative receipt this one settles
	// (¶0078). A speculative evaluation is pending confirmation, and until this
	// existed there was nothing for it to be pending ON: confirmation returned a
	// verdict to its caller and produced no artifact, so a speculative receipt
	// had no path to one an independent verifier would accept. A confirming
	// receipt is an ordinary receipt — chained, signed, non-speculative —
	// naming what it settles, and it is issued whether the confirmation
	// succeeded or failed, because a race that voided a permit is exactly the
	// event an audit log should carry.
	Confirms []byte `cbor:"confirms,omitempty"`
	// EnforcementPoint identifies the emitting enforcement point.
	EnforcementPoint string `cbor:"enforcement_point,omitempty"`
	// EnforcementPointKID is the key id of the key that signed this receipt.
	// Without it, EnforcementPoint is a name with nothing to bind it to — the
	// same gap the MAT's issuer identity had before its kid was checked against
	// the verifying key.
	EnforcementPointKID []byte `cbor:"enforcement_point_kid,omitempty"`

	// Commitment fields, present when a commitment object governs the session
	// (¶0084A, ¶0097 addition). A per-action receipt carries the digest of the
	// governing commitment and that action's compliance record.
	CommitmentDigest     []byte            `cbor:"commitment_digest,omitempty"`
	CommitmentCompliance *ActionCompliance `cbor:"commitment_compliance,omitempty"`
	// Provenance reconstructs a multi-agent commitment derivation chain from
	// receipts alone (¶0084A Commitment Provenance Field).
	Provenance *ProvenanceRef `cbor:"provenance,omitempty"`
}

Receipt is the verifiable execution receipt — the cryptographic proof structure generated by an enforcement point for every request, including denials (¶0050, ¶0088, ¶0097 as amended). The enforcement point signature is carried by the COSE_Sign1 envelope (see SignedReceipt), not this payload.

A receipt is configured so an independent verifier can, from the receipt alone and reproduced inputs, recompute the runtime context digest, recompute per-constraint outcomes, validate signatures, check the evaluation timing bound, and check the chain link — without any access to enforcement point state (¶0017, ¶0095).

func UnmarshalReceipt

func UnmarshalReceipt(payload []byte) (*Receipt, error)

UnmarshalReceipt decodes a canonical CBOR payload into a Receipt.

func (*Receipt) Digest

func (r *Receipt) Digest() ([]byte, error)

Digest returns the receipt digest: a digest over the canonical receipt payload. It is the chain-link value a successor records in its PriorReceiptHash (¶0063, FIG. 11), and it is the single definition of that link — the enforcement point computing it at issuance and a verifier recomputing it are calling the same function.

It is deliberately a digest over the payload and not over the COSE envelope. The payload is what the signature covers and what canonicalization pins to one encoding; the envelope is neither, so envelope bytes cannot identify a receipt. The reasoning is set out in full above Verifier.Verify's chain-link step.

func (*Receipt) Marshal

func (r *Receipt) Marshal() ([]byte, error)

Marshal returns the canonical CBOR payload of the receipt (¶0085).

type ReplayProtection

type ReplayProtection struct {
	// NotBefore and NotAfter are RFC3339 UTC timestamps bounding validity.
	NotBefore string `cbor:"not_before"`
	NotAfter  string `cbor:"not_after"`
	// Nonce provides replay protection.
	Nonce []byte `cbor:"nonce"`
	// InstanceID uniquely identifies this artifact instance.
	InstanceID string `cbor:"instance_id"`
}

ReplayProtection encodes the validity interval, nonce, and instance identifier (MAT field 138, ¶0041).

type ReplaySeenSet

type ReplaySeenSet interface {
	// Seen reports whether a receipt with this digest has already been acted on.
	Seen(receiptDigest []byte) bool
}

ReplaySeenSet reports whether a receipt has already been acted upon.

The interface is deliberately query-only, and the unit is deliberately the RECEIPT. Both were wrong in the first version of this API and the reasons are worth keeping.

Query-only: Verify used to record what it saw, which made verification a mutation. Verifying the same receipt twice — auditing your own log, or two components checking one artifact — then reported the second look as a replay. A replay guard should be updated when a receipt is ACTED ON, which only the caller knows, not when it is inspected.

Per-receipt: the MAT's replay nonce identifies the ARTIFACT, and one artifact authorizes many operations, each producing its own receipt. Keying replay on it flagged every receipt after the first under the same MAT — so walking an append-only log, the ordinary auditing case, failed from the second entry onward. A commitment's session id has the same shape: a session has many actions. The receipt is the only unit whose second presentation is necessarily a replay rather than ordinary use.

type RuntimeContext

type RuntimeContext struct {
	// Time is the RFC3339 UTC instant at which context was captured.
	Time string `cbor:"time" json:"time"`
	// NetworkZone is the current network zone identifier.
	NetworkZone string `cbor:"network_zone,omitempty" json:"network_zone,omitempty"`
	// Params holds numeric operational parameters keyed by name (param_bound).
	Params map[string]float64 `cbor:"params,omitempty" json:"params,omitempty"`
	// ResourceState holds the current state of dependent resources
	// (resource_state predicate).
	ResourceState map[string]string `cbor:"resource_state,omitempty" json:"resource_state,omitempty"`
	// RiskScore is the current runtime risk score (¶0072 step-up trigger).
	RiskScore int `cbor:"risk_score,omitempty" json:"risk_score,omitempty"`
	// Rate holds the current observed rate keyed by rate_limit constraint ID.
	Rate map[string]int64 `cbor:"rate,omitempty" json:"rate,omitempty"`
}

RuntimeContext holds the current values of machine and operational state variables against which execution constraints are evaluated (¶0009, ¶0047). It is obtained at the time the operation is requested — not at session establishment (claim 1). Its canonical digest is bound into the receipt so an independent verifier can recompute it from reproduced inputs (¶0010, ¶0095).

A verifier presented with the reproduced context recomputes Digest and compares it to the receipt's context digest; a receipt may instead omit raw context and carry only the digest for privacy-preserving verification (¶0079).

func (RuntimeContext) Digest

func (r RuntimeContext) Digest() ([]byte, error)

Digest returns the canonical runtime context digest (¶0018, ¶0085). Because the canonicalization function is field-order and encoding independent, any party reproducing the same semantic context computes the same digest.

type SignedCommitment

type SignedCommitment struct {
	Envelope   []byte
	Commitment CommitmentObject
	// SigningKID is the key id of the anchor that verified the envelope.
	SigningKID []byte
}

SignedCommitment is a CommitmentObject conveyed inside a COSE_Sign1 envelope.

func ParseCommitment

func ParseCommitment(envelope []byte, anchors *TrustAnchorSet) (*SignedCommitment, error)

ParseCommitment decodes and signature-verifies a COSE_Sign1 commitment object envelope against the agent's key in the anchor set. Signature failure maps to COMMITMENT_OBJECT_SIGNATURE_FAILURE (¶0095A).

type SignedMAT

type SignedMAT struct {
	// Envelope is the COSE_Sign1 CBOR.
	Envelope []byte
	// MAT is the decoded payload (populated after ParseMAT).
	MAT MAT
	// SigningKID is the key id of the anchor that actually verified the
	// envelope. Kept because "which key signed this" is a different question
	// from "which key does the body claim signed this", and only the first is
	// evidence.
	SigningKID []byte
}

SignedMAT is a MAT conveyed inside a COSE_Sign1 envelope. The envelope bytes are the wire artifact; the enclosed payload is the canonical CBOR of the MAT.

func ParseMAT

func ParseMAT(envelope []byte, anchors *TrustAnchorSet) (*SignedMAT, error)

ParseMAT decodes and signature-verifies a COSE_Sign1 MAT envelope against the trust anchor set. Signature failure is an unconditional-denial condition (¶0045); callers map the error to ARTIFACT_SIGNATURE_FAILURE.

It also binds the issuer identity the MAT *claims* to the key that actually signed it. verifyEnvelope has always known which anchor verified, and every caller discarded it, so IssuerIdentity.KID — documented as matching the envelope's key id — was signed, carried, and never read. In a deployment trusting more than one issuer, which is the deployment TrustAnchorSet exists for (¶0066, FIG. 14), that let any trusted issuer mint an artifact naming another: B signs, the body says A, and a verifier reports it as A's.

The key id is required rather than checked-when-present. An artifact that declines to name its issuing key is not thereby more trustworthy, and the alternative reading — absence excuses the check — is the same "absence is not a statement" defect ExecutionScope.Unconstrained exists to prevent.

type SignedReceipt

type SignedReceipt struct {
	Envelope []byte
	Receipt  Receipt
	// SigningKID is the key id of the anchor that verified the envelope.
	SigningKID []byte
}

SignedReceipt is a Receipt conveyed inside a COSE_Sign1 envelope.

func ParseReceipt

func ParseReceipt(envelope []byte, anchors *TrustAnchorSet) (*SignedReceipt, error)

ParseReceipt decodes and signature-verifies a COSE_Sign1 receipt envelope against the trust anchor set (enforcement point signature, ¶0050).

type SignerRole

type SignerRole string

SignerRole names an artifact kind a key is trusted to sign. The protocol has three distinct signing roles and they are not interchangeable: an issuer grants authority (MAT, ¶0041 field 136), an enforcement point attests to a decision it made under that authority (receipt, ¶0050), and an agent commits in advance to what it will propose (commitment object, ¶0095B).

The anchor set used to be a flat map from key id to key, consulted identically by all three parsers, so any trusted key could sign any artifact kind — an agent's key could mint the very authority grant the agent operates under. Nothing in a raw public key says what it is for, so the role has to be recorded when the operator registers it.

const (
	// RoleIssuer may sign Machine Authority Tokens.
	RoleIssuer SignerRole = "issuer"
	// RoleEnforcementPoint may sign execution receipts.
	RoleEnforcementPoint SignerRole = "enforcement_point"
	// RoleAgent may sign commitment objects.
	RoleAgent SignerRole = "agent"
)

type TemporalValidity

type TemporalValidity struct {
	NotBefore string `cbor:"not_before"`
	NotAfter  string `cbor:"not_after"`
}

TemporalValidity is a validity interval (RFC3339 UTC).

type Timing

type Timing struct {
	Start     string `cbor:"start"`
	Complete  string `cbor:"complete"`
	ElapsedMS int64  `cbor:"elapsed_ms"`
	// MaxMS is the maximum evaluation latency bound in force; 0 means unbounded.
	MaxMS int64 `cbor:"max_ms,omitempty"`
}

Timing records the evaluation window (¶0053). ElapsedMS from Start to Complete is checked against MaxMS to confirm evaluation completed within the authorized latency bound (¶0051, ¶0088).

type TrustAnchor

type TrustAnchor struct {
	KID       []byte
	Algorithm constants.SignatureAlg
	PublicKey crypto.PublicKey
	// Subject is the identity the operator asserts this key belongs to — an
	// enforcement point name, for instance. Optional, and it is the ONLY thing
	// that can make a receipt's self-declared enforcement_point mean anything:
	// the enforcement point chooses both the name it writes and the key it signs
	// with, so a receipt cannot bind its own name. An operator can, because the
	// anchor set is the operator's statement about keys.
	Subject string
	// Roles are the artifact kinds this key may sign. An anchor with no roles
	// may sign nothing: registration requires the operator to say what the key
	// is for, because the alternative default — "anything" — is the most
	// permissive grant available and would arise from saying nothing.
	Roles []SignerRole
}

TrustAnchor is a single verification key with its signature algorithm, key identifier, and the roles it is trusted for (FIG. 14, ¶0066). The KID matches the COSE protected-header key id set by the signer.

func (TrustAnchor) Permits

func (a TrustAnchor) Permits(role SignerRole) bool

Permits reports whether this anchor is trusted to sign the given artifact kind.

type TrustAnchorSet

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

TrustAnchorSet is the configured set of trust anchors distributed to a verifier (¶0066, FIG. 14). Anchors are looked up by key identifier.

func NewTrustAnchorSet

func NewTrustAnchorSet() *TrustAnchorSet

NewTrustAnchorSet returns an empty anchor set.

func (*TrustAnchorSet) AddECDSAP256

func (s *TrustAnchorSet) AddECDSAP256(kid []byte, roles []SignerRole, pub *ecdsa.PublicKey) error

AddECDSAP256 registers an ECDSA P-256 verification key under the given key id. It demonstrates the algorithm agility the trust anchor set is built for (¶0066): the same verification path admits a second signature algorithm selected per key, so an HSM-backed ECDSA issuer verifies identically. It returns an error if kid is empty, pub is nil, or pub is not on P-256.

func (*TrustAnchorSet) AddEd25519

func (s *TrustAnchorSet) AddEd25519(kid []byte, roles []SignerRole, pub ed25519.PublicKey) error

AddEd25519 registers an Ed25519 verification key under the given key id, for the given signer roles. It returns an error if kid is empty, roles is empty or names an unknown role, or pub is not ed25519.PublicKeySize bytes.

func (*TrustAnchorSet) AddHybrid

func (s *TrustAnchorSet) AddHybrid(kid []byte, roles []SignerRole, ec *ecdsa.PublicKey, ml *mldsa65.PublicKey) error

AddHybrid registers a post-quantum hybrid verification key (ECDSA P-384 + ML-DSA-65) under the given key id. A receipt signed by the corresponding issuer is accepted only if both signature halves verify — an attacker must forge both the classical and the post-quantum scheme. This gives XAP the same quantum-resistance posture as the rest of the portfolio's authority artifacts. It returns an error if kid is empty, either half is nil, or the classical half is not on P-384. A nil half would defeat both-must-pass by panicking rather than denying.

func (*TrustAnchorSet) Get

func (s *TrustAnchorSet) Get(kid []byte) (TrustAnchor, bool)

Get returns the anchor registered under kid, if any.

func (*TrustAnchorSet) Len

func (s *TrustAnchorSet) Len() int

Len reports the number of registered anchors.

func (*TrustAnchorSet) SetSubject

func (s *TrustAnchorSet) SetSubject(kid []byte, subject string) error

SetSubject records the identity an operator asserts a key belongs to.

Optional. Where it is set, a receipt naming a different enforcement point is refused; where it is not, the name is unverifiable and reported NOT PERFORMED — which is honest under the round-3 rule, because the missing input is the OPERATOR's and not something the artifact withheld.

type TrustVector

type TrustVector struct {
	Score int    `cbor:"score,omitempty"`
	Level string `cbor:"level,omitempty"`
}

TrustVector encodes a quantitative or qualitative trust assessment (MAT field 128, ¶0041).

type VerificationResult

type VerificationResult struct {
	Valid      bool   `json:"valid"`
	ArtifactID string `json:"artifact_id"`
	Decision   string `json:"decision"`
	// NotPerformed names every check the inputs did not permit re-evaluating.
	//
	// Valid answers "was anything refuted", not "how much was established", and
	// those diverge: a receipt disclosing almost nothing is Valid because
	// nothing contradicted it. Round 3 found the sharper form — where the party
	// who benefits from a check not running is the party who controls whether it
	// can run, not-performed is a downgrade they select. Individual cases are
	// fixed by making the obligation-bearing ones fail instead (see
	// identitiesAgree), but a relying party still needs to see the shape of what
	// went unchecked without walking Checks itself, and to be able to require a
	// minimum before acting.
	NotPerformed []string `json:"not_performed,omitempty"`
	// Speculative reports that the receipt records a speculative evaluation
	// pending confirmation (¶0078) rather than a settled authorization. It is
	// surfaced as its own field, not left to a caller to dig out of the receipt,
	// because the difference between "this was authorized" and "this was being
	// considered" is the difference a verification result exists to state.
	Speculative bool    `json:"speculative"`
	Checks      []Check `json:"checks"`
}

VerificationResult is the output of the verification state machine. JSON tags match the xap-spec OpenAPI VerificationResult schema (lowercase), so the server's /verify response is contract-accurate.

func (VerificationResult) Failed

func (v VerificationResult) Failed() []string

Failed returns the names of the checks that did not pass.

type Verifier

type Verifier struct {
	Anchors *TrustAnchorSet
}

Verifier performs independent verification of a cryptographic proof structure (¶0095 Execution Receipt Verification State Machine). It is constructed with a trust anchor set and nothing else: verification succeeds — or fails — using only the receipt, optionally the governing MAT and reproduced context, and the public anchors, with zero access to enforcement point internal state (¶0017). This zero-state property is why the type lives in the public SDK.

func NewVerifier

func NewVerifier(anchors *TrustAnchorSet) *Verifier

NewVerifier returns a Verifier over the given anchor set.

func (*Verifier) Verify

func (v *Verifier) Verify(in VerifyInput) VerificationResult

Verify runs the verification state machine over the given input and returns a structured result. It never panics on malformed input; every failure is a non-passing Check with Valid=false.

type VerifyInput

type VerifyInput struct {
	// ReceiptEnvelope is the COSE_Sign1 receipt (required).
	ReceiptEnvelope []byte
	// MATEnvelope is the COSE_Sign1 governing MAT (optional).
	MATEnvelope []byte
	// ReproducedContext is the runtime context reproduced by the verifier
	// (optional). When present, the context digest and constraint outcomes are
	// recomputed and compared.
	ReproducedContext *RuntimeContext
	// PriorReceipt is the immediately preceding receipt in the chain (optional).
	PriorReceipt *SignedReceipt
	// ConfirmedReceipt is the speculative receipt this one claims to settle
	// (optional, ¶0078). Supplying it lets the verifier check the claim rather
	// than read it.
	ConfirmedReceipt *SignedReceipt
	// CommitmentEnvelope is the COSE_Sign1 governing commitment object (optional).
	CommitmentEnvelope []byte
	// Replay is an optional record of receipts this relying party has already
	// ACTED ON, consulted to detect a receipt presented twice.
	//
	// Freshness is the one property that cannot be established from signed
	// artifacts alone: deciding whether something has been seen before means
	// remembering. ¶0017 forbids depending on ENFORCEMENT-POINT state and says
	// nothing about the verifier's own, so a relying party that remembers what
	// it accepted learns nothing from the issuer by doing so.
	//
	// Absent, the check reports NOT PERFORMED — the honest answer for a caller
	// that kept no record.
	Replay ReplaySeenSet
}

VerifyInput carries the receipt under verification plus whatever optional inputs the caller can reproduce. The verifier does as much as the inputs allow: with only the receipt envelope it checks signature, structure, codes, and timing; with the governing MAT it binds the receipt to the artifact and (with a reproduced context) recomputes the context digest and per-constraint outcomes (¶0095); with a prior receipt it checks the chain link (¶0063); with a commitment object it checks commitment binding and digest (¶0084A).

Directories

Path Synopsis
Package canonical implements the protocol's canonicalization function (¶0018, ¶0085): a transform of any protocol value into a canonical byte representation such that semantically equivalent inputs — regardless of map field ordering, integer/float encoding width, or serialization format — produce identical bytes, and therefore identical cryptographic digests.
Package canonical implements the protocol's canonicalization function (¶0018, ¶0085): a transform of any protocol value into a canonical byte representation such that semantically equivalent inputs — regardless of map field ordering, integer/float encoding width, or serialization format — produce identical bytes, and therefore identical cryptographic digests.
cmd
verify-wasm command
Stub so `go build ./...` on non-wasm targets doesn't fail on this directory.
Stub so `go build ./...` on non-wasm targets doesn't fail on this directory.
xap command
Command xap is the reference command-line interface for the Execution Authority Protocol SDK.
Command xap is the reference command-line interface for the Execution Authority Protocol SDK.
Package conformance runs the embedded XAP conformance vectors against the reference SDK and reports, per vector, whether the SDK reproduces the manifest's expected outcome.
Package conformance runs the embedded XAP conformance vectors against the reference SDK and reports, per vector, whether the SDK reproduces the manifest's expected outcome.
examples
recompute-digest command
Example: recompute a runtime context digest from reproduced inputs and compare it to the value a receipt would carry (¶0018, ¶0095).
Example: recompute a runtime context digest from reproduced inputs and compare it to the value a receipt would carry (¶0018, ¶0095).
validate-delegation command
Example: validate a delegation chain against the four monotonic invariants (¶0057).
Example: validate a delegation chain against the four monotonic invariants (¶0057).
verify-receipt command
Example: verify a receipt in ~20 lines, using only public keys — the third-party verification the protocol is built for (¶0017, ¶0095).
Example: verify a receipt in ~20 lines, using only public keys — the third-party verification the protocol is built for (¶0017, ¶0095).

Jump to

Keyboard shortcuts

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