import type { ActionIntent, PolicyDecision, PolicyReceipt } from '../types/policy.js'; import type { Delegation } from '../types/passport.js'; import type { ExecutionEnvelope, EnvelopeVerification, EvaluationMethod, EnvelopeVerdict, RevocationStatus } from '../types/execution-envelope.js'; /** * Create a cross-engine signed execution envelope from APS primitives. * * Maps our 3-signature chain to the standardized envelope format: * - ActionIntent → action_id, agent_did * - PolicyDecision → decision block * - PolicyReceipt → attestation block * - Delegation → capability_ref block */ export declare function createExecutionEnvelope(opts: { intent: ActionIntent; decision: PolicyDecision; receipt: PolicyReceipt; delegation: Delegation; /** Task/run context ID */ runId: string; /** Agent's DID (e.g., did:aps:publickey) */ agentDid: string; /** Evaluator's DID */ evaluatorDid: string; /** Whether the delegation chain is currently active */ revocationStatus: RevocationStatus; /** Delegation chain depth */ chainDepth: number; /** Evaluation method for this decision */ evaluationMethod: EvaluationMethod; /** Signer's private key (for envelope signature) */ signerPrivateKey: string; /** Signer's public key */ signerPublicKey: string; }): ExecutionEnvelope; /** The relying party's expectation of what this envelope is about. Every * field is optional and every one supplied is compared exactly; a field left * out is not checked, and `contextChecked` reports whether any were. * * These are the questions an envelope cannot answer about itself. An envelope * is a signed statement that SOME agent was permitted SOME action under SOME * policy; that it is the agent, action and policy this caller is about to act * on is the caller's to state. */ export interface ExpectedEnvelopeContext { agentDid?: string; runId?: string; actionId?: string; actionRef?: string; /** Every scope the envelope claims must appear here. Extra entries in the * caller's set are fine; an envelope scope outside it is not. */ allowedScope?: string[]; policyRef?: string; evaluatorDid?: string; verdict?: EnvelopeVerdict; } /** Everything a relying party must bring for an envelope to be verifiable. * * All four are required, in the types as well as at runtime, because the * contract cannot return `valid: true` without them: the envelope's own key * is its claim about itself, the evaluator's signed bytes are not in the * envelope at all, and an envelope is a statement about SOME agent and SOME * action until the caller says which. `maxDecisionAgeMs` is the one genuinely * optional member: a freshness window is a policy choice, and a caller that * states none is not claiming freshness. */ export interface VerifyEnvelopeOptions { /** Public keys this relying party accepts as envelope signers. Normalized * through the same helper every other trust-anchor option in the SDK uses, * so a malformed value is a configuration error rather than either "no * anchors" or "all anchors". An empty list means this verifier holds no * anchors; it does not mean trust anyone. */ trustedSignerPublicKeys: string[]; /** The PolicyDecision the envelope's decision block projects. Required to * establish the evaluator signature: the envelope carries a hash, and * Ed25519 here is not prehashed, so the signed bytes exist nowhere else. */ originalDecision: PolicyDecision; /** The evaluator key this relying party accepts. */ evaluatorPublicKey: string; /** What this envelope is expected to be about. At least one member must be * stated; an object with none reports `contextChecked: false` and fails. */ expected: ExpectedEnvelopeContext; /** Maximum age of the decision in milliseconds. Optional: a relying party * that states no window makes no freshness claim. */ maxDecisionAgeMs?: number; } /** * Verify a cross-engine signed execution envelope. * * SCOPE OF CLAIM. * Establishes, when `valid` is true: the envelope's bytes are unaltered and * were signed by one of the keys the caller named; the evaluator signature * it carries is the signature of the caller's evaluator key over the * decision the caller supplied; the envelope's decision block projects * that decision faithfully; the capability was active at emission; the * decision was evaluated inside the caller's freshness window; and every * expected-context field the caller stated matched. * Does NOT establish: that the delegation is unrevoked NOW — * `revocation_status` is a literal the emitter typed at emission and is * not a live check; that the evaluator was entitled to permit this action; * that the action described actually happened; or that * `evaluation_method` is the method the decision recorded, which is a * separate caller parameter at construction and is bound to nothing. * * WHY THE DECISION HAS TO BE PASSED IN. The envelope carries * `decision.decision_hash`, not the decision. `evaluator_signature` is * `PolicyDecision.signature`, made over the canonical form of the decision * with the signature member removed. Of that preimage's twelve members the * envelope carries three exactly (evaluated_at, floorVersion as policy_ref, * intentId as action_id), one lossily, and not at all: decisionId, * evaluatorId, evaluatorPublicKey, expiresAt, reason, principlesEvaluated. * The last two are free text. And decision_hash is over the decision INCLUDING * its signature, so it commits to a different string than the signature does; * it could not substitute even if the bytes were otherwise recoverable, since * this SDK's Ed25519 is not prehashed and verify() needs the message. So the * bytes cannot be reconstructed from the envelope by anyone, and a verifier * that reports them as verified is reporting something it did not do. * * Previously it did exactly that: `evaluatorSignatureValid` was * `!!envelope.decision.evaluator_signature`, and supplying an evaluator key * made it strictly worse, because the branch that key opened set the flag to * true unconditionally. The string "not-a-signature" passed. It is now * 'unresolved' with no decision supplied, and the overall result fails. */ export declare function verifyExecutionEnvelope(envelope: ExecutionEnvelope, opts: VerifyEnvelopeOptions): EnvelopeVerification; /** * Create a minimal envelope from non-APS sources. * For engines that don't have the full 3-signature chain, * this accepts raw fields directly. */ export declare function createMinimalEnvelope(opts: { agentDid: string; runId: string; actionId: string; scope: string[]; revocationStatus: RevocationStatus; decisionHash: string; policyRef: string; evaluationMethod: EvaluationMethod; verdict: 'permit' | 'deny' | 'narrow' | 'audit'; evaluatedAt: string; evaluatorDid: string; evaluatorSignature: string; receiptHash: string; signerPrivateKey: string; signerPublicKey: string; }): ExecutionEnvelope; //# sourceMappingURL=execution-envelope.d.ts.map