Skip to main content

Validate and serialize

Validation is strict: unknown fields, duplicate JSON keys, non-canonical encodings, unsupported versions, and mismatched public keys are rejected. Serialization emits one canonical JSON representation.

const document = validateDocument(input);
const canonical = serializeDocument(document);

TypeScript accepts unknown at the boundary and returns a normalized Document.

See Document format for the fields and invariants shared by both SDKs.