ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [) {
test(`Resumption ${cs}`, async () => {
await resumption(cs);
});
}
async function resumption(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 addBobProposal = {
proposalType: "add",
add: {
keyPackage: bob.publicPackage,
},
};
const commitResult = await createCommit(aliceGroup, emptyPskIndex, false, [addBobProposal], impl);
aliceGroup = commitResult.newState;
let bobGroup = await joinGroup(commitResult.welcome, bob.publicPackage, bob.privatePackage, emptyPskIndex, impl, aliceGroup.ratchetTree);
const bobNewKeyPackage = await generateKeyPackage(bobCredential, defaultCapabilities(), defaultLifetime, [], impl);
const aliceNewKeyPackage = await generateKeyPackage(aliceCredential, defaultCapabilities(), defaultLifetime, [], impl);
const newGroupId = new TextEncoder().encode("new-group1");
const branchCommitResult = await branchGroup(aliceGroup, aliceNewKeyPackage.publicPackage, aliceNewKeyPackage.privatePackage, [bobNewKeyPackage.publicPackage], newGroupId, impl);
aliceGroup = branchCommitResult.newState;
bobGroup = await joinGroupFromBranch(bobGroup, branchCommitResult.welcome, bobNewKeyPackage.publicPackage, bobNewKeyPackage.privatePackage, aliceGroup.ratchetTree, impl);
await testEveryoneCanMessageEveryone([aliceGroup, bobGroup], impl);
await checkHpkeKeysMatch(aliceGroup, impl);
await checkHpkeKeysMatch(bobGroup, impl);
}
//# sourceMappingURL=resumption.test.js.map