Install
json‑seal is a small, dependency‑free package built on the WebCrypto API.
It works in modern Node runtimes with SubtleCrypto support and in all evergreen browsers.
npm install json-seal
Other install methods
# yarn
yarn add json-seal
# pnpm
pnpm add json-seal
# bun
bun add json-seal
Deno
Use the npm compatibility layer:
import {
generateKeyPair,
signPayload,
verifyBackup
} from "npm:json-seal";
Browser (no bundler)
Use an import map to load json‑seal directly:
<script type="importmap">
{
"imports": {
"json-seal": "https://esm.sh/json-seal"
}
}
</script>
<script type="module">
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);
</script>
No build steps, frameworks, or external cryptography libraries are required.