json-seal

Lightweight, portable JSON data integrity - without the complexity.

json-seal signs structured JSON data. It canonicalizes a JavaScript value into deterministic JSON text, encodes it as UTF-8 bytes, and signs those bytes using WebCrypto. It is not a generic byte-signing library.

import {
  generateKeyPair,
  signPayload,
  verifyBackup
} from "json-seal";

const { publicKey, privateKey } = await generateKeyPair();

const sealed = await signPayload({ message: "hello" }, privateKey, publicKey);
const result = await verifyBackup(sealed);

json-seal creates a cryptographically signed, tamper-evident envelope around any JSON-serializable value. It implements the full RFC 8785 JSON Canonicalization Scheme and uses RSA-PSS signatures to guarantee both integrity and authenticity.