@@ -20,7 +20,7 @@ export class Decrypt {
2020 private keyExchange : SubscriberKeyExchange ,
2121 private streamRegistryCached : StreamRegistryCached ,
2222 private destroySignal : DestroySignal ,
23- @ inject ( LitProtocolKeyStore ) private readonly litProtocolKeyStore : LitProtocolKeyStore ,
23+ private readonly litProtocolKeyStore : LitProtocolKeyStore ,
2424 @inject ( LoggerFactory ) loggerFactory : LoggerFactory ,
2525 @inject ( StreamrClientEventEmitter ) private eventEmitter : StreamrClientEventEmitter ,
2626 @inject ( ConfigInjectionToken ) private config : Pick < StrictStreamrClientConfig , 'decryption' >
@@ -49,26 +49,26 @@ export class Decrypt {
4949 const groupKeyId = streamMessage . groupKeyId !
5050
5151 let groupKey = await this . groupKeyStore . get ( groupKeyId , streamMessage . getStreamId ( ) )
52- if ( groupKey === undefined ) {
52+ if ( groupKey === undefined ) { // 1st try lit protocol
5353 groupKey = await this . litProtocolKeyStore . get ( streamMessage . getStreamId ( ) , groupKeyId )
5454 if ( groupKey !== undefined ) {
5555 await this . groupKeyStore . add ( groupKey , streamMessage . getStreamId ( ) )
5656 }
5757 }
58- if ( groupKey === undefined ) {
58+ if ( groupKey === undefined ) { // 2nd try group-key exchange
5959 await this . keyExchange . requestGroupKey (
6060 streamMessage . groupKeyId ,
6161 streamMessage . getPublisherId ( ) ,
6262 streamMessage . getStreamPartID ( )
6363 )
6464 try {
6565 const groupKeys = await waitForEvent (
66- // TODO remove "as any" type casing in NET-889
67- this . eventEmitter as any ,
68- 'addGroupKey' ,
69- this . config . decryption . keyRequestTimeout ,
70- ( storedGroupKey : GroupKey ) => storedGroupKey . id === groupKeyId ,
71- this . destroySignal . abortSignal )
66+ // TODO remove "as any" type casing in NET-889
67+ this . eventEmitter as any ,
68+ 'addGroupKey' ,
69+ this . config . decryption . keyRequestTimeout ,
70+ ( storedGroupKey : GroupKey ) => storedGroupKey . id === groupKeyId ,
71+ this . destroySignal . abortSignal )
7272 groupKey = groupKeys [ 0 ] as GroupKey
7373 } catch ( e : any ) {
7474 if ( this . destroySignal . isDestroyed ( ) ) {
0 commit comments