/** * @nexart/codemode-sdk — Canonical JSON (versioned, consensus surface) * * Two canonicalisation modes exist and BOTH are permanently supported by * verifiers. Mode is bound to `protocolVersion` (which is carried inside every * signed receipt), so the choice is authenticated. Unknown/unsupported * protocolVersion FAILS CLOSED (throws) — it is never silently defaulted. * * • nexart-v1 (protocolVersion 1.2.0) — original NexArt canonicalisation. FROZEN. * • jcs-v1 (protocolVersion 1.3.0) — RFC 8785 (JSON Canonicalization Scheme). * * The two are byte-for-byte identical for every JSON-safe value (proven by the * conformance harness against the `canonicalize` reference oracle). This module * is kept in lockstep with @nexart/ai-execution's canonicalJson.ts — the node * signer and both SDK verifiers MUST agree byte-for-byte. * * nexart-v1 rules: * - Object keys are sorted lexicographically (UTF-16 code unit order) * - No trailing commas, no whitespace * - Arrays preserve insertion order * - null, boolean, number, string are encoded as standard JSON literals * - Undefined values and function-valued properties are omitted */ /** Canonicalisation modes. One per supported protocolVersion. */ export type CanonicalMode = 'nexart-v1' | 'jcs-v1'; /** Every protocolVersion literal this build understands. */ export type SupportedProtocolVersion = '1.2.0' | '1.3.0'; /** Single source of truth: which protocolVersion uses which canonicalisation. */ export declare const PROTOCOL_CANONICAL_MODE: Readonly>; /** Every protocolVersion this build understands. Verifiers fail closed on anything else. */ export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly string[]; export declare function isSupportedProtocolVersion(protocolVersion: unknown): protocolVersion is SupportedProtocolVersion; /** Resolve the mode for a protocolVersion. FAIL-CLOSED: unknown version throws. */ export declare function canonicalModeForProtocol(protocolVersion: unknown): CanonicalMode; /** Canonicalise using the mode bound to `protocolVersion`. Fail-closed on unknown version. */ export declare function canonicalJsonForProtocol(value: unknown, protocolVersion: unknown): string; export declare function toCanonicalJson(value: unknown): string; export declare function canonicalizeJcs(value: unknown): string; //# sourceMappingURL=canonicalJson.d.ts.map