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

45 lines 1.58 kB
import { encodeGroupInfoTBS, decodeGroupInfoTBS, encodeGroupInfo, decodeGroupInfo, } from "../../src/groupInfo"; import { createRoundtripTest } from "./roundtrip"; const dummyGroupContext = { version: "mls10", cipherSuite: "MLS_256_XWING_AES256GCM_SHA512_Ed25519", groupId: new Uint8Array([1, 2, 3]), epoch: 0n, treeHash: new Uint8Array([4, 5]), confirmedTranscriptHash: new Uint8Array([6]), extensions: [], }; const dummyExtension = { extensionType: "ratchet_tree", extensionData: new Uint8Array([8, 9]) }; const minimalTBS = { groupContext: dummyGroupContext, extensions: [], confirmationTag: new Uint8Array([]), signer: 0, }; const nontrivialTBS = { groupContext: dummyGroupContext, extensions: [dummyExtension], confirmationTag: new Uint8Array([1, 2, 3]), signer: 42, }; describe("GroupInfoTBS roundtrip", () => { const roundtrip = createRoundtripTest(encodeGroupInfoTBS, decodeGroupInfoTBS); test("roundtrips minimal", () => { roundtrip(minimalTBS); }); test("roundtrips nontrivial", () => { roundtrip(nontrivialTBS); }); }); describe("GroupInfo roundtrip", () => { const roundtrip = createRoundtripTest(encodeGroupInfo, decodeGroupInfo); test("roundtrips minimal", () => { const g = { ...minimalTBS, signature: new Uint8Array([]) }; roundtrip(g); }); test("roundtrips nontrivial", () => { const g = { ...nontrivialTBS, signature: new Uint8Array([9, 8, 7]) }; roundtrip(g); }); }); //# sourceMappingURL=groupInfo.test.js.map