import { type ContextItem, type DisclosureMode, type ContextProvenanceAttestation } from './types.js'; /** Input to buildCPA. Items are a flat list across all channels; each * item's channel decides its partition. */ export interface BuildCpaInput { privateKey: string; action_ref: string; producer_did: string; attested_at: string; mode: DisclosureMode; items: ContextItem[]; /** * Inclusion-mode-only selection policy: the set of ctx_ids to DISCLOSE. * For each disclosed ctx_id, buildCPA includes that leaf (with its * `content` if the input item carried one) in its partition's `leaves` * and adds the leaf's inclusion proof to `inclusion_proofs`. ctx_ids not * present in any partition are ignored. Convention: a single flat set of * ctx_ids across all channels (ctx_id is the disclosure selector). * * Ignored in full-set mode (full-set always discloses ALL leaves). * Omitted/empty in inclusion mode preserves Phase-0 count-only behavior * (no `leaves`, hidden_leaf_count = leaf_count). */ disclose?: Set | string[]; /** * Optional hash-bound reference to an external producer attestation, * carried inside the signed bytes when supplied. Added to the unsigned * shape by CONDITIONAL SPREAD, never as an explicitly-undefined key * (strict JCS would render that as null and change the bytes); an * omitting CPA keeps its exact prior canonical form. See * src/v2/producer-attestation. */ producer_attestation?: import('../producer-attestation/types.js').CpaProducerAttestationRef; } /** * Build and sign a CPA from a flat list of context items. * * full-set: each present partition carries leaves = ALL its leaves and no * context_profile. * inclusion: each present partition carries context_profile * { channel, hidden_leaf_count = leaf_count - disclosed }. Phase 0 * builds inclusion CPAs count-only (no disclosed leaves, so * hidden_leaf_count = leaf_count); Phase 1 adds disclosed subsets with * inclusion proofs. * * producer_pubkey is derived from the private key. The signature covers * canonicalizeJCS({...cpa, signature:''}). */ export declare function buildCPA(input: BuildCpaInput): ContextProvenanceAttestation; /** * Content address over the FULLY SIGNED CPA: * cpa_ref = sha256( utf8(SIGN_TAG) || utf8(canonicalizeJCS(signedCpa)) ) * Returns 64-hex lowercase. */ export declare function computeCpaRef(signedCpa: ContextProvenanceAttestation): string; /** * Carry the content address of a signed CPA as a one-field object, ready * to spread onto a receipt body BEFORE the receipt is signed. The verifier * later re-derives computeCpaRef(cpa) and checks equality against the * receipt's cpa_ref (the receipt -> CPA binding direction). */ export declare function carryCpaRef(cpa: ContextProvenanceAttestation): { cpa_ref: string; }; /** * Pure binder: return a NEW object equal to `receipt` plus a `cpa_ref` * field. Does not mutate the input and does not (re)sign anything; the * caller signs the resulting body with its own receipt machinery. Keeping * this pure keeps the primitive offline and side-effect free. */ export declare function bindCpaRefToReceipt(receipt: T, cpa_ref: string): T & { cpa_ref: string; }; //# sourceMappingURL=cpa.d.ts.map