ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [) {
test(`Grease ${cs}`, async () => {
await greaseTest(cs);
});
}
async function greaseTest(cipherSuite) {
const impl = await getCiphersuiteImpl(getCiphersuiteFromName(cipherSuite));
const aliceCredential = { credentialType: "basic", identity: new TextEncoder().encode("alice") };
const greased = greaseExtensions(defaultGreaseConfig);
const caps = {
...defaultCapabilities(),
extensions: greased.map((n) => extensionTypeToNumber(n.extensionType)),
};
const alice = await generateKeyPackage(aliceCredential, caps, defaultLifetime, greased, impl);
const groupId = new TextEncoder().encode("group1");
let aliceGroup = await createGroup(groupId, alice.publicPackage, alice.privatePackage, [], impl);
const bobCredential = { credentialType: "basic", identity: new TextEncoder().encode("bob") };
const bob = await generateKeyPackage(bobCredential, defaultCapabilities(), defaultLifetime, [], impl);
const addBobProposal = {
proposalType: "add",
add: {
keyPackage: bob.publicPackage,
},
};
const addBobCommitResult = await createCommit(aliceGroup, emptyPskIndex, false, [addBobProposal], impl);
aliceGroup = addBobCommitResult.newState;
let bobGroup = await joinGroup(addBobCommitResult.welcome, bob.publicPackage, bob.privatePackage, emptyPskIndex, impl, aliceGroup.ratchetTree);
expect(bobGroup.keySchedule.epochAuthenticator).toStrictEqual(aliceGroup.keySchedule.epochAuthenticator);
await checkHpkeKeysMatch(aliceGroup, impl);
await checkHpkeKeysMatch(bobGroup, impl);
await testEveryoneCanMessageEveryone([aliceGroup, bobGroup], impl);
}
//# sourceMappingURL=grease.test.js.map