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

38 lines 1.58 kB
import { encodeAuthenticatedContent, decodeAuthenticatedContent } from "../../src/authenticatedContent"; import { createRoundtripTest } from "./roundtrip"; describe("AuthenticatedContent roundtrip", () => { const roundtrip = createRoundtripTest(encodeAuthenticatedContent, decodeAuthenticatedContent); test("roundtrips minimal", () => { roundtrip({ wireformat: "mls_public_message", content: { contentType: "application", groupId: new Uint8Array([1]), epoch: 0n, sender: { senderType: "member", leafIndex: 0 }, authenticatedData: new Uint8Array([2]), applicationData: new Uint8Array([3]), }, auth: { contentType: "application", signature: new Uint8Array([4, 5, 6]) }, }); }); test("roundtrips nontrivial", () => { roundtrip({ wireformat: "mls_private_message", content: { contentType: "commit", groupId: new Uint8Array([7, 8, 9]), epoch: 123n, sender: { senderType: "external", senderIndex: 1 }, authenticatedData: new Uint8Array([10, 11, 12]), commit: { proposals: [], path: undefined }, }, auth: { contentType: "commit", signature: new Uint8Array([13, 14, 15, 16]), confirmationTag: new Uint8Array([17, 18, 19]), }, }); }); }); //# sourceMappingURL=authenticatedContent.test.js.map