Commit 633230b3 authored by Hubert Chathi's avatar Hubert Chathi
Browse files

use Add+Remove instead of Update

parent 6925a530
......@@ -95,8 +95,9 @@ application's group membership:
~Remove~ proposal is added to remove them from the MLS group.
- for any user who is in both the MLS group and in the application's group,
check if any extremity has a ~KeyPackage~ for that user with a higher
generation number, and if so, an ~Update~ proposal is added with the user's
~KeyPackage~ with the highest generation number.
generation number, and if so, a ~Remove~ proposal is added with the user's
leaf number, and an ~Add~ proposal is added with the user's ~KeyPackage~ with
the highest generation number.
- for any user who is not in the MLS group, but is in the application's group,
an ~Add~ proposal is added. If the user is present in any of the
extremities, then the ~KeyPackage~ with the highest generation number is
......@@ -130,6 +131,8 @@ When another user receives a ~Commit~, they should
Carol's random number generator is good, then this may not be much of a
problem. Bob will also notice this, and can make a new Update to re-add
entropy from his RNG (as long as his Update isn't discarded again).
- we will blank a bunch of nodes, which means that we may have decreased
performance.
* Todo
......
......@@ -33,7 +33,7 @@ import {
MLSCiphertext,
Add,
Commit,
Update,
Remove,
ProposalWrapper,
Sender,
UpdatePath,
......@@ -417,7 +417,7 @@ export class Group {
return this.extremities.size > 1;
}
prepareCommit(): [Epoch, Uint8Array, Update[], [Epoch, Uint8Array][], boolean, Uint8ArrayMap<number>, Uint8ArrayMap<KeyPackage>] {
prepareCommit(): [Epoch, Uint8Array, (Add|Remove)[], [Epoch, Uint8Array][], boolean, Uint8ArrayMap<number>, Uint8ArrayMap<KeyPackage>] {
let baseEpoch: Epoch = -1;
let baseSender: Uint8Array;
......@@ -495,7 +495,7 @@ export class Group {
}
// construct update proposals
const updates: Update[] = [];
const updates: (Add|Remove)[] = [];
for (const [, epochStr, leafNum] of maxGenerations.values()) {
if (epochStr === undefined) {
continue;
......@@ -504,7 +504,8 @@ export class Group {
if (eqUint8Array(identity, keyPackage.credential.identity)) {
updatePathRequired = true;
} else {
updates.push(new Update(keyPackage));
updates.push(new Remove(leafNum));
updates.push(new Add(keyPackage));
}
}
......
......@@ -131,7 +131,7 @@ describe("Group", () => {
groupA.prepareCommit();
expect(updates1).toEqual([]);
expect(resolves1).toEqual([])
expect(resolves1).toEqual([]);
const [, mlsPlaintext1, , ] = await groupA.commit(
[new ProposalWrapper(new Remove(3))],
......@@ -167,7 +167,7 @@ describe("Group", () => {
groupB.prepareCommit();
expect(updates2).toEqual([]);
expect(resolves2).toEqual([])
expect(resolves2).toEqual([]);
const [, mlsPlaintext2, welcome2, ] = await groupB.commit(
[
......@@ -240,7 +240,7 @@ describe("Group", () => {
groupA.prepareCommit();
expect(updates1).toEqual([]);
expect(resolves1).toEqual([])
expect(resolves1).toEqual([]);
const [mlsCiphertext1, , , ] = await groupA.commit(
[new ProposalWrapper(new Remove(3))],
......@@ -347,7 +347,7 @@ describe("Group", () => {
groupA.prepareCommit();
expect(updates1A).toEqual([]);
expect(resolves1A).toEqual([])
expect(resolves1A).toEqual([]);
const [, mlsPlaintext1A, , ] = await groupA.commit(
[],
......@@ -361,7 +361,7 @@ describe("Group", () => {
groupB.prepareCommit();
expect(updates1B).toEqual([]);
expect(resolves1B).toEqual([])
expect(resolves1B).toEqual([]);
const [, mlsPlaintext1B, , ] = await groupB.commit(
[],
......@@ -375,7 +375,7 @@ describe("Group", () => {
groupC.prepareCommit();
expect(updates1C).toEqual([]);
expect(resolves1C).toEqual([])
expect(resolves1C).toEqual([]);
const [, mlsPlaintext1C, , ] = await groupC.commit(
[],
......@@ -389,7 +389,7 @@ describe("Group", () => {
groupD.prepareCommit();
expect(updates1D).toEqual([]);
expect(resolves1D).toEqual([])
expect(resolves1D).toEqual([]);
const [, mlsPlaintext1D, , ] = await groupD.commit(
[],
......@@ -430,8 +430,8 @@ describe("Group", () => {
const [baseEpoch2, baseSender2, updates2, resolves2, updatePathRequired2, ,] =
groupE.prepareCommit();
expect(updates2.length).toEqual(3);
expect(resolves2.length).toEqual(3)
expect(updates2.length).toEqual(6);
expect(resolves2.length).toEqual(3);
const [, mlsPlaintext2, , ] = await groupE.commit(
[],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment