# JavaScript and other languages The envelope format is specified independently of Python, so envelopes can be sealed and opened anywhere. ## JavaScript `interop/javascript` is a second implementation of the format, written from the specification alone, with no dependencies. Every primitive comes from WebCrypto, so it runs in Node.js 20 and later, Deno, Bun, Cloudflare Workers, and browsers. It opens envelopes with the same verification as Python (key commitment, recipient-manifest MAC, context commitment, and every record) before returning any plaintext, and seals one-shot envelopes that Python opens. ```js import { openEnvelope } from "./src/envelope-reader.mjs"; const TRUSTED_KEYS = new Set(["arn:aws:kms:eu-west-1:111122223333:key/1234abcd"]); const plaintext = await openEnvelope(envelopeBytes, { context: { tenant: "acme", purpose: "invoice-archive" }, unwrap: async (recipient, protectedBytes) => { if (!TRUSTED_KEYS.has(recipient.keyId)) return undefined; // skip untrusted keys return myKeyService.unwrap(recipient.keyId, recipient.wrappedKey, protectedBytes); }, }); ``` The JavaScript modules leave wrapping and unwrapping to a callback, so the callback decides which keys are trusted: skip every recipient whose key you do not trust, as the Python `Protector` does. Range reads and rewrap remain Python-only. The repository checks that both implementations return the same plaintext or the same error code for thousands of random, tampered, truncated, and extended envelopes, in both directions. See the [module's README](https://github.com/Psychevus/cryptography-suite/tree/main/interop/javascript). ## Any language: the conformance suite An implementation in another language can measure itself against the [conformance suite](https://github.com/Psychevus/cryptography-suite/tree/main/conformance): 248 envelopes, each with the outcome it must produce (a plaintext or an error code), sealed for a test provider that takes a few lines to write. An adapter is any command that prints one outcome per case: ```console python tools/conformance.py run -- ``` The Python and JavaScript implementations agree on every case. The [specification](../v4/spec/envelope-format.md) gives every byte of the format, and its [test vectors](https://github.com/Psychevus/cryptography-suite/blob/main/docs/v4/spec/vectors/envelope-v4.0.json) every intermediate value: derived keys, commitments, and the recipient MAC.