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.
- TypeScript
- Go
const document = validateDocument(input);
const canonical = serializeDocument(document);
TypeScript accepts unknown at the boundary and returns a normalized Document.
if err := keyhold.Validate(document); err != nil { return err }
canonical, err := keyhold.Serialize(document)
Go validates an already-decoded Document and reports failure through error.
See Document format for the fields and invariants shared by both SDKs.