UNPKG

ts-mls

Version:

[![CI](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml/badge.svg)](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [![npm version](https://badge.fury.io/js/ts-mls.svg)](https://badge.fury.io/js/ts-mls) [![Coverage Status](https://co

43 lines 1.49 kB
import { encodeLeafNode, decodeLeafNode } from "../../src/leafNode"; import { createRoundtripTest } from "./roundtrip"; const minimalLeafNode = { hpkePublicKey: new Uint8Array([]), signaturePublicKey: new Uint8Array([]), credential: { credentialType: "basic", identity: new Uint8Array([]) }, capabilities: { versions: [], ciphersuites: [], extensions: [], proposals: [], credentials: [], }, leafNodeSource: "update", extensions: [], signature: new Uint8Array([]), }; const nontrivialLeafNode = { hpkePublicKey: new Uint8Array([1, 2, 3]), signaturePublicKey: new Uint8Array([4, 5, 6]), credential: { credentialType: "basic", identity: new Uint8Array([7, 8]) }, capabilities: { versions: ["mls10"], ciphersuites: ["MLS_256_XWING_AES256GCM_SHA512_Ed25519"], extensions: [7], proposals: [71], credentials: ["basic"], }, leafNodeSource: "commit", parentHash: new Uint8Array([9, 10]), extensions: [{ extensionType: "ratchet_tree", extensionData: new Uint8Array([11, 12]) }], signature: new Uint8Array([13, 14]), }; describe("LeafNode roundtrip", () => { const roundtrip = createRoundtripTest(encodeLeafNode, decodeLeafNode); test("roundtrips minimal", () => { roundtrip(minimalLeafNode); }); test("roundtrips nontrivial", () => { roundtrip(nontrivialLeafNode); }); }); //# sourceMappingURL=leafNode.test.js.map