/** Digest identity form used everywhere a contract artifact is referenced: `sha256:`. */ export declare const DIGEST_PREFIX: "sha256:"; /** True iff `s` is a well-formed `sha256:` artifact digest. */ export declare function isContractDigest(s: string): boolean; /** True iff the string is well-formed UTF-16 (no unpaired surrogate). A lone surrogate has NO * UTF-8 byte encoding — encoders silently substitute U+FFFD, so two distinct malformed strings * can collapse to one byte sequence; anything digest- or wire-bound must refuse them. */ export declare function isWellFormedUnicode(s: string): boolean; /** RFC 8785 canonical JSON text of a value (strict: I-JSON enforced, no undefined→null). */ export declare function canonicalJson(value: unknown): string; /** Content address of a contract artifact: `sha256:` over its RFC 8785 form (SPEC §13.7). */ export declare function contractDigest(value: unknown): string; /** `sha256:` over RAW bytes (a string digests as its UTF-8 encoding), NEVER re-canonicalized: * the digest form for artifacts carried as opaque bytes — the §13.3 `auth` slot (`authDigest`, * digested exactly as carried) and the §13.4 raw stored submission bytes (`submissionDigest`). * A string input MUST be well-formed UTF-16: a lone surrogate has no UTF-8 encoding, the * encoder would substitute U+FFFD, and two DISTINCT carried values would silently share one * digest — the opposite of "exactly as carried". Throws instead. */ export declare function rawDigest(data: Uint8Array | string): string; /** Verify OPAQUE bytes against their advertised `sha256:` digest, and return them unchanged. * * The counterpart to {@link rawDigest}, as {@link verifyArtifact} is to {@link contractDigest} — * and deliberately NOT the same function. `verifyArtifact` parses its input as JSON and * re-canonicalizes it; artifact bytes are opaque (an image, a tarball, a truncated file) and must * never be parsed, both because parsing would reject legitimate content and because a digest over * a re-serialization is not a digest over what was carried. * * This runs on every fetch, before any byte reaches a caller. Digest-verify on READ is what * catches the truncation class: a store that hands back a short object is otherwise * indistinguishable from a small one. */ export declare function verifyRawBytes(bytes: Uint8Array, digest: string): Uint8Array; /** Verify fetched artifact BYTES against their advertised digest (verify-on-read, SPEC §13.7): * content addressing, not store ACLs, is the tamper boundary. The bytes must parse as JSON and * re-canonicalize to the digest; anything else throws. Returns the parsed artifact. * For opaque (non-JSON) bytes use {@link verifyRawBytes}. */ export declare function verifyArtifact(bytes: Uint8Array, digest: string): unknown; //# sourceMappingURL=canonical.d.ts.map