File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
apps/webapp/src/script/E2EIdentity
libraries/core/src/messagingProtocols/mls/E2EIdentityService Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -314,14 +314,19 @@ export class E2EIHandler extends TypedEventEmitter<Events> {
314314 } ,
315315 certificateTtl : this . certificateTtl ,
316316 getAllConversations : async ( ) => {
317- if ( ! isCertificateRenewal ) {
318- return Promise . resolve ( [ ] ) ;
317+ if ( is . undefined ( this . core . service ) ) {
318+ return [ ] ;
319319 }
320320 const conversations = await this . core . service . conversation . getConversations ( ) ;
321+
322+ if ( ! is . array ( conversations . found ) ) {
323+ return [ ] ;
324+ }
325+
321326 return conversations . found
322327 . filter ( conversation => is . nonEmptyString ( conversation . group_id ) )
323328 . map ( ( { group_id} ) => ( {
324- group_id,
329+ group_id : group_id ! ,
325330 } ) ) ;
326331 } ,
327332 } ) ;
Original file line number Diff line number Diff line change @@ -276,8 +276,19 @@ export class E2EIServiceInternal {
276276 const newCrlDistributionPoints = await cx . saveX509Credential ( identity , certificate ) ;
277277 for ( const conversation of conversations ) {
278278 if ( Boolean ( conversation . group_id ?. length ) ) {
279- const idAsBytes = Decoder . fromBase64 ( conversation . group_id ) . asBytes ;
280- await cx . e2eiRotate ( new ConversationId ( idAsBytes ) ) ;
279+ try {
280+ const idAsBytes = Decoder . fromBase64 ( conversation . group_id ) . asBytes ;
281+ const conversationId = new ConversationId ( idAsBytes ) ;
282+
283+ // Check if conversation exists before rotating
284+ const conversationExists = await cx . conversationExists ( conversationId ) ;
285+ if ( conversationExists ) {
286+ await cx . e2eiRotate ( conversationId ) ;
287+ }
288+ } catch ( error ) {
289+ // Log error but don't fail the entire enrollment if one conversation fails
290+ this . logger . warn ( 'Failed to rotate conversation' , { groupId : conversation . group_id , error} ) ;
291+ }
281292 } else {
282293 this . logger . error ( 'No group id found in conversation' ) ;
283294 }
You can’t perform that action at this time.
0 commit comments