@@ -147,7 +147,7 @@ export class RTCEncryptionManager implements IEncryptionManager {
147
147
148
148
const validSession = this . keyBuffer . disambiguate ( participantId , candidateInboundSession ) ;
149
149
if ( validSession ) {
150
- this . onEncryptionKeysChanged ( validSession . key , index , validSession . participantId ) ;
150
+ this . onEncryptionKeysChanged ( validSession . key , validSession . keyIndex , validSession . participantId ) ;
151
151
this . statistics . counters . roomEventEncryptionKeysReceived += 1 ;
152
152
} else {
153
153
this . logger . info ( `Received an out of order key for ${ userId } :${ deviceId } , dropping it` ) ;
@@ -177,6 +177,11 @@ export class RTCEncryptionManager implements IEncryptionManager {
177
177
sharedWith : [ ] ,
178
178
keyId : 0 ,
179
179
} ;
180
+ this . onEncryptionKeysChanged (
181
+ this . outboundSession . key ,
182
+ this . outboundSession . keyId ,
183
+ getParticipantId ( this . userId , this . deviceId ) ,
184
+ ) ;
180
185
}
181
186
// get current memberships
182
187
const toShareWith : ParticipantDeviceInfo [ ] = this . getMemberships ( )
@@ -254,15 +259,7 @@ export class RTCEncryptionManager implements IEncryptionManager {
254
259
this . logger . trace (
255
260
`key index:${ outboundKey . keyId } sent to ${ outboundKey . sharedWith . map ( ( m ) => `${ m . userId } :${ m . deviceId } ` ) . join ( "," ) } ` ,
256
261
) ;
257
- if ( isFirstKey ) {
258
- this . logger . trace ( `Rollout immediately` ) ;
259
- // rollout immediately
260
- this . onEncryptionKeysChanged (
261
- outboundKey . key ,
262
- outboundKey . keyId ,
263
- getParticipantId ( this . userId , this . deviceId ) ,
264
- ) ;
265
- } else if ( hasKeyChanged ) {
262
+ if ( hasKeyChanged ) {
266
263
// Delay a bit before using this key
267
264
// It is recommended not to start using a key immediately but instead wait for a short time to make sure it is delivered.
268
265
this . logger . trace ( `Delay Rollout for key:${ outboundKey . keyId } ...` ) ;
0 commit comments