Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Conversation

@timoxley
Copy link
Contributor

@timoxley timoxley commented Feb 25, 2021

  • Adds support for reading and writing streamMessage.newGroupKey.
  • Tests that revoking subscription permissions and rekeying actually removes subscribers from the stream.
  • Expands subscription logging

This PR used to be on top of Persist Groupkeys PR #204 but that PR is going to take some more work. I've reworked this to be on top of master now.

@linear
Copy link

linear bot commented Feb 25, 2021

@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 692d091 to 0a5520f Compare March 8, 2021 14:42
@timoxley timoxley force-pushed the NET-208-revocation branch from 2a3fa16 to 8c59343 Compare March 10, 2021 15:52
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 0a5520f to f471814 Compare March 10, 2021 15:52
@timoxley timoxley force-pushed the NET-208-revocation branch from 8c59343 to 829e07d Compare March 10, 2021 15:54
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from f471814 to 69a53ef Compare March 10, 2021 16:12
@timoxley timoxley force-pushed the NET-208-revocation branch from 829e07d to cf1e73b Compare March 10, 2021 16:12
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 69a53ef to 4a26fda Compare March 10, 2021 16:15
@timoxley timoxley force-pushed the NET-208-revocation branch from cf1e73b to 65f0a5a Compare March 10, 2021 16:23
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 4a26fda to ed74cd6 Compare March 11, 2021 17:27
@timoxley timoxley force-pushed the NET-208-revocation branch 2 times, most recently from dcc795a to 55c9db5 Compare March 11, 2021 18:15
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 787eab5 to e4f3ef2 Compare March 11, 2021 19:52
@timoxley timoxley force-pushed the NET-208-revocation branch from e9db0f1 to a81527c Compare March 11, 2021 20:00
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from e4f3ef2 to e312814 Compare March 11, 2021 20:05
@timoxley timoxley force-pushed the NET-208-revocation branch 2 times, most recently from 692e3da to 17983bc Compare March 11, 2021 20:20
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch 2 times, most recently from 24dd13a to bbe667c Compare March 11, 2021 20:24
@timoxley timoxley force-pushed the NET-208-revocation branch 2 times, most recently from 2fc2465 to 3f25bbb Compare March 11, 2021 20:46
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from bbe667c to c6a4cdc Compare March 11, 2021 20:51
@timoxley timoxley force-pushed the NET-208-revocation branch from 3f25bbb to 01a878b Compare March 11, 2021 20:54
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from c6a4cdc to 485ad88 Compare March 11, 2021 21:04
@timoxley timoxley force-pushed the NET-208-revocation branch from 01a878b to 18c6908 Compare March 11, 2021 21:05
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch from 485ad88 to 596c415 Compare March 12, 2021 13:43
@timoxley timoxley force-pushed the NET-208-revocation branch from f13777c to 2d3972e Compare March 12, 2021 13:43
@timoxley timoxley force-pushed the NET-156-persist-groupkeys branch 2 times, most recently from 806f8f0 to caf282d Compare March 17, 2021 13:22
@timoxley timoxley changed the base branch from NET-156-persist-groupkeys to master March 23, 2021 15:48
@timoxley timoxley requested a review from teogeb March 23, 2021 15:53
return !nextGroupKey && store.size === 0
return nextGroupKeys.length === 0 && store.size === 0
},
useGroupKey() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could be plural as it generates an array of GroupKeys?

Copy link
Contributor Author

@timoxley timoxley Mar 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, sort of, it could probably do with some docs though.

Basically it's giving you the current + (optional) next group key.

If there's two values, it'll encrypt the message with the first, but embed the second in the stream message (encrypted with the first), then the next time you call useGroupKey you will get that second value in the first position, and an empty value second position, until a new group key is assigned. When a new group key is assigned, it'll use the existing key one more time, embedding the next key, then start using the new key from there on.

Something like this:

setGroupKey(keyA)
useGroupKey() // => [keyA, undefined]
useGroupKey() // => [keyA, undefined]
setGroupKey(keyB)
useGroupKey() // => [keyA, keyB]
useGroupKey() // => [keyB, undefined]
useGroupKey() // => [keyB, undefined]
setGroupKey(keyC)
useGroupKey() // => [keyB, keyC]
useGroupKey() // => [keyC, undefined]
// etc

Where useGroupKey is called before encrypting each message.
Iff there's a second value, it will be set as the streamMessage.newGroupKey

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On possibility would be to introduce some helper data type, like GroupKeyQueue. It would encapsulate this e.g. max length handling.

}
})

async function getGroupKey(streamMessage) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getGroupKey definitely has a confusing name now though, since it returns an array of keys, one of which should be the one you're after, or an empty array.

@timoxley timoxley force-pushed the NET-208-revocation branch 3 times, most recently from b4c4a97 to bb743a9 Compare March 29, 2021 19:33
@timoxley timoxley force-pushed the NET-208-revocation branch 2 times, most recently from 6c0814c to ea5a17f Compare May 10, 2021 19:47
@timoxley timoxley force-pushed the NET-208-revocation branch from ea5a17f to e229b81 Compare May 10, 2021 20:38
@timoxley timoxley merged commit ad2db70 into master May 11, 2021
@timoxley timoxley deleted the NET-208-revocation branch May 11, 2021 17:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants