-
Notifications
You must be signed in to change notification settings - Fork 9
Read/write streamMessage.newGroupKey & enable key revocation #205
Conversation
NET-208 Add revocation based on monitoring subscriber set
Melchior started on this, but it never got merged. https://github.com/streamr-dev/streamr-client-javascript/pull/130/files |
692d091 to
0a5520f
Compare
2a3fa16 to
8c59343
Compare
0a5520f to
f471814
Compare
8c59343 to
829e07d
Compare
f471814 to
69a53ef
Compare
829e07d to
cf1e73b
Compare
69a53ef to
4a26fda
Compare
cf1e73b to
65f0a5a
Compare
4a26fda to
ed74cd6
Compare
dcc795a to
55c9db5
Compare
787eab5 to
e4f3ef2
Compare
e9db0f1 to
a81527c
Compare
e4f3ef2 to
e312814
Compare
692e3da to
17983bc
Compare
24dd13a to
bbe667c
Compare
2fc2465 to
3f25bbb
Compare
bbe667c to
c6a4cdc
Compare
3f25bbb to
01a878b
Compare
c6a4cdc to
485ad88
Compare
01a878b to
18c6908
Compare
485ad88 to
596c415
Compare
f13777c to
2d3972e
Compare
806f8f0 to
caf282d
Compare
| return !nextGroupKey && store.size === 0 | ||
| return nextGroupKeys.length === 0 && store.size === 0 | ||
| }, | ||
| useGroupKey() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]
// etcWhere useGroupKey is called before encrypting each message.
Iff there's a second value, it will be set as the streamMessage.newGroupKey
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
b4c4a97 to
bb743a9
Compare
6c0814c to
ea5a17f
Compare
…l groupKey change until message after next.
Avoid test assertions in event handlers.
Cleaned up, but still WIP encryption/subscription error handling. Tracking down unhandled error. Fix unhandled rejection in keyexchange. Improve subscription error handling. Update Encryption tests. Passing integration/Encryption.test.js with revoke tests. Fix publish/Encrypt typing.
…tiple if + early return.
ea5a17f to
e229b81
Compare
streamMessage.newGroupKey.This PR used to be on top of
Persist GroupkeysPR #204 but that PR is going to take some more work. I've reworked this to be on top ofmasternow.