import type { DenialReason as FoundationDenialReason } from '../types.js'; export { CYCLES_PROTOCOL_VERSION, CYCLES_EVIDENCE_SCHEMA_VERSION, RAIL_BUDGET_RESERVATION_PERMIT_CLAIM_TYPE, RAIL_BUDGET_RESERVATION_RELEASE_CLAIM_TYPE, RAIL_BUDGET_RESERVATION_DENIAL_CLAIM_TYPE, } from './types.js'; import type { CyclesDenial, CyclesDenialDetail, CyclesEvidenceView, CyclesPermitReceipt, CyclesReleaseReceipt, CyclesVerifyResult, SignCyclesDenialInput, SignCyclesPermitReceiptInput, SignCyclesReleaseReceiptInput, VerifyCyclesOptions } from './types.js'; import type { EvidenceDescriptorInput, EvidenceResolutionResult, FetchedCyclesEvidenceEnvelope } from './evidence-resolution.js'; /** * Maps a Cycles denial signal (extracted from a CyclesEvidence view) * to an APS Tier-1 denial reason, preserving the full Cycles-side * detail Tier-2 in `cycles.denial_detail`. * * Returns `null` if the evidence view does not represent a denial * (artifact_type=decide-ALLOW, reserve-ALLOW, commit, release). * * Denial paths: * (A) HTTP 4xx/5xx — artifact_type=error. ErrorCode source. * (B) /v1/decide DENY — artifact_type=decide. DecisionReasonCode source. * (C) dry_run=true reserve DENY — artifact_type=reserve. * DecisionReasonCode source. (Non-dry reserve DENY is a wire- * shape impossibility per cycles-protocol-v0.yaml:978 and is * rejected at the CyclesEvidence schema layer.) */ export declare function mapCyclesDenialToFoundation(evidence: CyclesEvidenceView): { denial_reason: FoundationDenialReason; cycles: { denial_detail: CyclesDenialDetail; }; } | null; export declare function signCyclesPermitReceipt(input: SignCyclesPermitReceiptInput, signerPrivateKeyHex: string): CyclesPermitReceipt; /** Verify a Cycles permit receipt (sync). With `options.evidence`, also * checks the receipt↔envelope hash binding (see `_checkEvidenceJoin`). * NOTE: `valid: true` does NOT assert the envelope's own Ed25519 * authenticity or signer authority — that is the v0.2 item (#43). Pin * `expected_signer` for issuer trust until then. */ export declare function verifyCyclesPermitReceipt(receipt: CyclesPermitReceipt, options?: VerifyCyclesOptions): CyclesVerifyResult; /** Verify a Cycles permit receipt (async, DID-URI signers). Join-integrity * caveat as in `verifyCyclesPermitReceipt`: `valid: true` does NOT assert * the envelope's own Ed25519 authenticity (v0.2 — #43). */ export declare function verifyCyclesPermitReceiptWithDID(receipt: CyclesPermitReceipt, options?: VerifyCyclesOptions): Promise; export declare function signCyclesReleaseReceipt(input: SignCyclesReleaseReceiptInput, signerPrivateKeyHex: string): CyclesReleaseReceipt; /** Verify a Cycles release receipt (sync). With `options.evidence`, also * checks the receipt↔envelope hash binding (see `_checkEvidenceJoin`). * NOTE: `valid: true` does NOT assert the envelope's own Ed25519 * authenticity or signer authority — that is the v0.2 item (#43). Pin * `expected_signer` for issuer trust until then. */ export declare function verifyCyclesReleaseReceipt(receipt: CyclesReleaseReceipt, options?: VerifyCyclesOptions): CyclesVerifyResult; /** Verify a Cycles release receipt (async, DID-URI signers). Join-integrity * caveat as in `verifyCyclesReleaseReceipt`: `valid: true` does NOT assert * the envelope's own Ed25519 authenticity (v0.2 — #43). */ export declare function verifyCyclesReleaseReceiptWithDID(receipt: CyclesReleaseReceipt, options?: VerifyCyclesOptions): Promise; export declare function signCyclesDenial(input: SignCyclesDenialInput, signerPrivateKeyHex: string): CyclesDenial; /** Verify a Cycles denial (sync). With `options.evidence`, also checks the * receipt↔envelope hash binding (see `_checkEvidenceJoin`). NOTE: * `valid: true` does NOT assert the envelope's own Ed25519 authenticity or * signer authority — that is the v0.2 item (#43). Pin `expected_signer` * for issuer trust until then. */ export declare function verifyCyclesDenial(denial: CyclesDenial, options?: VerifyCyclesOptions): CyclesVerifyResult; /** Verify a Cycles denial (async, DID-URI signers). Join-integrity caveat * as in `verifyCyclesDenial`: `valid: true` does NOT assert the envelope's * own Ed25519 authenticity (v0.2 — #43). */ export declare function verifyCyclesDenialWithDID(denial: CyclesDenial, options?: VerifyCyclesOptions): Promise; /** * Combined verify + evidence-resolution result. `verify` is the existing * receipt verdict (signature, ttl, accountability shape - unchanged). * `evidence` is the claimed-vs-resolved verdict for the CyclesEvidence * envelope. `descriptor` is the mechanical input the W2-A1 verifier * descriptor consumes for the external-evidence axis. * * A green `verify` with a `signature_only` `descriptor.observation_basis` * is the explicit "claims an envelope at hash H, signature-checked only" * state. `counterparty_resolved` is "envelope at H fetched and matched". */ export interface CyclesVerifyWithEvidenceResult { verify: CyclesVerifyResult; evidence: EvidenceResolutionResult; descriptor: EvidenceDescriptorInput; /** Signer-authority disposition for the FETCHED envelope's own Ed25519 * signature (#43): one of authentic / binding_only / signer_resolution_failed * / signer_authority_failed / signature_invalid. `authentic` only when a key * resolved from the server's JWK Set under the issuance-time window verifies * the envelope (after its evidence_id re-derives). */ authority: CyclesEvidenceAuthorityResult; } /** * Signer-authority verdict for a CyclesEvidence envelope. The five DISTINCT * dispositions of the cycles-evidence-v0.1 verification model (kept separate on * purpose — a forgery, an unreachable key directory, and a valid-but-unresolved * signature are different events): * * - `authentic` — signature verifies under the window-selected key * resolved from the server's JWK Set (validity AND * authority). * - `binding_only` — signature cryptographically VALID against the * named raw-hex signer, but JWKS authority was not * resolved (no resolver / v0.1 posture). Only ever * returned after a successful signature check. * - `signer_resolution_failed` — the DID method / JWK Set could not be reached * or parsed (network/availability). Establishes * NOTHING about the bytes; NOT a forgery. * - `signer_authority_failed` — the set resolved, but no single authorized * key covers the envelope (hash-bind mismatch, no * window-covering key, absent, or ambiguous). * - `signature_invalid` — the envelope's `evidence_id` does not re-derive, * or the bytes do not verify under the resolved * key (tamper). * * CONTRACT — what `authentic` is NOT. `authentic` means only: signed by the * named signer's window-valid key. It is NOT an authorization decision (it does * not say the signer was permitted to issue this) and NOT a freshness guarantee * (a valid envelope replays as `authentic` for any `issued_at_ms` inside the * key window — see scope limits below). `binding_only` is weaker still: the * signature is self-consistent with a NAMED key that carries no resolved * identity or authority. The failure mode worth naming is a consumer treating * EITHER disposition as "trusted counterparty" — authority lives in the * caller's own allowed-signer set (assert the surfaced `signerDid`, or pin it * via `options.expectedEvidenceSigner`), never in the disposition alone. * * SCOPE LIMITS (verify-at-issuance design, stated so callers handle them): * 1. Replay. A valid envelope verifies as `authentic` every time within the * key window — disposition carries no once-only guarantee. Callers MUST * deduplicate on `evidence_id` to detect replay. * 2. Window, not wall clock. Key selection gates the key's * `[cycles_nbf_ms, cycles_exp_ms)` against the envelope's own * `issued_at_ms`, not the current time. Revocation safety therefore leans * on the SERVER dropping a revoked key from its published JWK Set: a * still-published key verifies for ANY backdated `issued_at_ms` inside its * window. `options.maxEvidenceClockSkewMs` adds an opt-in drift bound as * cheap defense-in-depth. */ export interface CyclesEvidenceAuthorityResult { disposition: 'authentic' | 'binding_only' | 'signer_resolution_failed' | 'signer_authority_failed' | 'signature_invalid'; reason?: string; /** kid of the resolved key, when authentic. */ resolvedKid?: string; /** The CRYPTOGRAPHICALLY VERIFIED `signer_did` of the envelope, surfaced on * `authentic` and `binding_only` (the two dispositions reached only after a * passing signature check) so the caller can assert it against its own * allowed-signer set. Absent on every non-verified disposition. NOTE this is * the signer the bytes verified UNDER; on `binding_only` that authority is * unresolved, so presence here is identity, not endorsement. */ signerDid?: string; } export declare function verifyCyclesPermitReceiptWithEvidence(receipt: CyclesPermitReceipt, options?: VerifyCyclesOptions): Promise; export declare function verifyCyclesReleaseReceiptWithEvidence(receipt: CyclesReleaseReceipt, options?: VerifyCyclesOptions): Promise; /** * Verify a FETCHED CyclesEvidence envelope's own signer authority directly * (#43), independent of any APS receipt. Resolves `signer_did` to a public key * via the caller-supplied `cyclesKeyResolver` (did:cycles sha256-binding + * window-gated selection, or raw-hex match), re-derives `evidence_id`, and * verifies the envelope's Ed25519 signature, returning one of the five * dispositions (authentic / binding_only / signer_resolution_failed / * signer_authority_failed / signature_invalid). The conformance surface a * consumer (e.g. against the Cycles golden vectors) runs. */ export declare function verifyCyclesEvidenceSignerAuthority(envelope: FetchedCyclesEvidenceEnvelope, options?: VerifyCyclesOptions): Promise; export declare function verifyCyclesDenialWithEvidence(denial: CyclesDenial, options?: VerifyCyclesOptions): Promise; /** Re-export the resolver type for callers wiring the async paths. */ export type { CyclesResolveDidDocument } from './types.js'; export { resolveEvidenceRef, recomputeEvidenceContentHash, toEvidenceDescriptorInput, } from './evidence-resolution.js'; export type { EvidenceResolver, EvidenceFetchResult, EvidenceResolutionResult, EvidenceResolutionStatus, EvidenceFailurePolicy, ResolveEvidenceConfig, FetchedCyclesEvidenceEnvelope, EvidenceDescriptorInput, EvidenceObservationBasis, } from './evidence-resolution.js'; //# sourceMappingURL=index.d.ts.map