-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make KeyProvider and ParticipantKeyHandler work consistently for shared key and sender key scenarios (e2ee) #850
Conversation
🦋 Changeset detectedLatest commit: ff4e6a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
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.
lg!
this.e2eeManager.setParticipantCryptorEnabled(enabled), | ||
]); | ||
await Promise.all([this.localParticipant.setE2EEEnabled(enabled)]); | ||
if (this.localParticipant.identity !== '') { |
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.
good to be safe here. could this this be true?
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.
localParticipant.identity
gets initialized with an empty string on room creation. As long as we don't know the actual identity, it doesn't make sense to enable the cryptor with a wrong/dummy identity. We do however use the most recent setting for localParticipant.isE2EEEnabled
on SignalConnected
now to enable the cryptor once we know the local participant's identity.
main motivation for these fixes was an inconsistency in setting the local participant's keys, which expected the participantId to be
undefined
. This caused a bug when trying to set individual sender keys instead of using a shared-key provider.Initially this was done because when
setKey
on a KeyProvider was called, we had no way of figuring out whether or not that participant is actually the local participant, until we're connected to the server and have the participant identity info.This PR
enabledEncryptionMap
that tracks whether or not encryption is enabled for a specific participant (previously this was handled as part of theParticipantKeyHandler
)SignalConnected
(the earliest we know the identity without manually parsing the token)initAck
worker message in order not to have to mis-use the existingenable
message for that purposesharedKeyHandler
that handles all key interactions whensharedKey
is set to true. Previously an instance was created for each participant, but in the shared key scenario that makes less sense. the only downside is that ratcheting doesn't work independently now, but I don't really see a reason in the shared key scenario for ratcheting anyways.