@@ -147,7 +147,7 @@ export class RTCEncryptionManager implements IEncryptionManager {
147147
148148 const validSession = this . keyBuffer . disambiguate ( participantId , candidateInboundSession ) ;
149149 if ( validSession ) {
150- this . onEncryptionKeysChanged ( validSession . key , index , validSession . participantId ) ;
150+ this . onEncryptionKeysChanged ( validSession . key , validSession . keyIndex , validSession . participantId ) ;
151151 this . statistics . counters . roomEventEncryptionKeysReceived += 1 ;
152152 } else {
153153 this . logger . info ( `Received an out of order key for ${ userId } :${ deviceId } , dropping it` ) ;
@@ -177,6 +177,11 @@ export class RTCEncryptionManager implements IEncryptionManager {
177177 sharedWith : [ ] ,
178178 keyId : 0 ,
179179 } ;
180+ this . onEncryptionKeysChanged (
181+ this . outboundSession . key ,
182+ this . outboundSession . keyId ,
183+ getParticipantId ( this . userId , this . deviceId ) ,
184+ ) ;
180185 }
181186 // get current memberships
182187 const toShareWith : ParticipantDeviceInfo [ ] = this . getMemberships ( )
@@ -254,15 +259,7 @@ export class RTCEncryptionManager implements IEncryptionManager {
254259 this . logger . trace (
255260 `key index:${ outboundKey . keyId } sent to ${ outboundKey . sharedWith . map ( ( m ) => `${ m . userId } :${ m . deviceId } ` ) . join ( "," ) } ` ,
256261 ) ;
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 ) {
266263 // Delay a bit before using this key
267264 // It is recommended not to start using a key immediately but instead wait for a short time to make sure it is delivered.
268265 this . logger . trace ( `Delay Rollout for key:${ outboundKey . keyId } ...` ) ;
0 commit comments