import { type KeyObject } from "node:crypto"; import type { JsonObject } from "@decionis/agent-safe-pipeline"; import type { ClaimAttestationClaims } from "./VerifyingProvider.js"; /** * The effect receipt: the provider's half of the evidence (the Verifying * Provider Profile, VP-3). * * The attestation let this provider refuse what the authority never claimed. * The receipt closes the other direction: after effecting, or refusing, the * claimed request, the provider signs a compact JWS under its own key naming * the grant it acted under, the claim it answered and what it did, and * returns it in `x-agent-safe-effect-receipt`. The executor forwards it * unread at finalization; the authority verifies it against the public key * the organisation registered for this provider and records it with the * commit evidence, so the dossier carries the provider's signature over the * effect and not only the executor's report of it. * * Every field the receipt binds comes from the attestation the provider has * already verified, which is the point: `sub` is the grant, `decision_id` * and `dossier_id` are the decision's, and `claim_token_digest` is copied * from the attestation of this very claim, which is how the authority ties * the receipt to the claim being finalized without the claim token ever * reaching the provider. The header and the payload are serialised in RFC * 8785 canonical form, so every implementation of this profile signs the * same bytes for the same receipt and the conformance vectors can say so. */ export declare const EFFECT_RECEIPT_TYPE = "decionis-effect-receipt+jwt"; /** The response header the receipt travels in. */ export declare const EFFECT_RECEIPT_HEADER = "x-agent-safe-effect-receipt"; export type EffectStatus = "EFFECTED" | "REFUSED" | "INDETERMINATE"; export interface EffectReceiptEffect { /** What the provider did with the claimed request. A signed refusal is evidence too. */ readonly status: EffectStatus; /** The provider's own reference for the effect: a ledger entry, an order id. */ readonly reference?: string; /** * The digest of the effect as the provider observed it, in the terms the * grant committed to (`expected_effect_digest`). Equality is what confirms * the effect at the authority. */ readonly digest?: string; /** When the effect took place, RFC 3339. */ readonly effected_at: string; } /** The attestation claims a receipt is built from: what the provider verified before effecting. */ export type AttestedClaim = Pick & { readonly binding: Pick; }; export interface EffectReceiptInput { /** The provider's Ed25519 private key, or its PKCS#8 PEM. Never leaves the provider. */ readonly key: KeyObject | string; /** The `kid` the organisation registered this key under at the authority. */ readonly kid: string; /** The `iss` registered with the key. */ readonly issuer: string; /** The authority the receipt is for: its issuer, `https://decionis.com` for the hosted one. */ readonly audience: string; /** The claims of the attestation this provider verified, as `verifyProviderRequest` returned them. */ readonly attestation: AttestedClaim; /** The idempotency key of the request effected, when the provider records it. */ readonly idempotencyKey?: string; readonly effect: EffectReceiptEffect; /** `iat`, as an epoch second. */ readonly issuedAt: number; /** Unique per receipt. */ readonly jti: string; } export declare class EffectReceiptError extends Error { readonly code: string; constructor(code: string); } /** The payload of the receipt, before it is signed; what the authority reads. */ export declare function effectReceiptClaims(input: EffectReceiptInput): JsonObject; /** The `header.payload` the signature covers: both segments RFC 8785 canonical, base64url. */ export declare function effectReceiptSigningInput(input: EffectReceiptInput): string; /** The receipt: a compact EdDSA JWS the provider returns in `x-agent-safe-effect-receipt`. */ export declare function signEffectReceipt(input: EffectReceiptInput): string; //# sourceMappingURL=EffectReceipt.d.ts.map