ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [) {
test(`RatchetTree extension ${cs}`, async () => {
await ratchetTreeExtension(cs);
});
}
async function ratchetTreeExtension(cipherSuite) {
const impl = await getCiphersuiteImpl(getCiphersuiteFromName(cipherSuite));
const aliceCredential = { credentialType: "basic", identity: new TextEncoder().encode("alice") };
const alice = await generateKeyPackage(aliceCredential, defaultCapabilities(), defaultLifetime, [], 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 charlieCredential = { credentialType: "basic", identity: new TextEncoder().encode("charlie") };
const charlie = await generateKeyPackage(charlieCredential, defaultCapabilities(), defaultLifetime, [], impl);
const addBobProposal = {
proposalType: "add",
add: {
keyPackage: bob.publicPackage,
},
};
const addCharlieProposal = {
proposalType: "add",
add: {
keyPackage: charlie.publicPackage,
},
};
const addBobAndCharlieCommitResult = await createCommit(aliceGroup, emptyPskIndex, false, [addBobProposal, addCharlieProposal], impl, true);
aliceGroup = addBobAndCharlieCommitResult.newState;
let bobGroup = await joinGroup(addBobAndCharlieCommitResult.welcome, bob.publicPackage, bob.privatePackage, emptyPskIndex, impl);
expect(bobGroup.keySchedule.epochAuthenticator).toStrictEqual(aliceGroup.keySchedule.epochAuthenticator);
let charlieGroup = await joinGroup(addBobAndCharlieCommitResult.welcome, charlie.publicPackage, charlie.privatePackage, emptyPskIndex, impl);
expect(charlieGroup.keySchedule.epochAuthenticator).toStrictEqual(aliceGroup.keySchedule.epochAuthenticator);
await checkHpkeKeysMatch(aliceGroup, impl);
await checkHpkeKeysMatch(bobGroup, impl);
await checkHpkeKeysMatch(charlieGroup, impl);
await testEveryoneCanMessageEveryone([aliceGroup, bobGroup, charlieGroup], impl);
}
//# sourceMappingURL=ratchetTreeExtension.test.js.map