diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index 5e2b755ad4a..75f2659c9df 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -245,6 +245,7 @@ export type OverlayBackgroundExtensionMessageHandlers = { editedCipher: () => void; deletedCipher: () => void; bgSaveCipher: () => void; + updateOverlayCiphers: () => void; fido2AbortRequest: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; }; diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 1f249454393..f55b5c8cc3d 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -191,6 +191,7 @@ export class OverlayBackground implements OverlayBackgroundInterface { editedCipher: () => this.updateOverlayCiphers(), deletedCipher: () => this.updateOverlayCiphers(), bgSaveCipher: () => this.updateOverlayCiphers(), + updateOverlayCiphers: () => this.updateOverlayCiphers(), fido2AbortRequest: ({ sender }) => this.abortFido2ActiveRequest(sender.tab.id), }; private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = { diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 1dfc947b284..852ee3650ab 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -904,6 +904,7 @@ export default class MainBackground { this.accountService, this.logService, this.cipherEncryptionService, + this.messagingService, ); this.folderService = new FolderService( this.keyService, diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 0ad7b57d9b3..4ff2e4d58ee 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -540,6 +540,7 @@ const safeProviders: SafeProvider[] = [ accountService: AccountServiceAbstraction, logService: LogService, cipherEncryptionService: CipherEncryptionService, + messagingService: MessagingServiceAbstraction, ) => new CipherService( keyService, @@ -557,6 +558,7 @@ const safeProviders: SafeProvider[] = [ accountService, logService, cipherEncryptionService, + messagingService, ), deps: [ KeyService, @@ -574,6 +576,7 @@ const safeProviders: SafeProvider[] = [ AccountServiceAbstraction, LogService, CipherEncryptionService, + MessagingServiceAbstraction, ], }), safeProvider({ diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index 1524e4e1b29..a24cce99c6b 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1,9 +1,19 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { combineLatest, filter, firstValueFrom, map, Observable, Subject, switchMap } from "rxjs"; +import { + combineLatest, + filter, + firstValueFrom, + map, + Observable, + Subject, + switchMap, + tap, +} from "rxjs"; import { SemVer } from "semver"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; +import { MessageSender } from "@bitwarden/common/platform/messaging"; // This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop. // eslint-disable-next-line no-restricted-imports import { KeyService } from "@bitwarden/key-management"; @@ -111,6 +121,7 @@ export class CipherService implements CipherServiceAbstraction { private accountService: AccountService, private logService: LogService, private cipherEncryptionService: CipherEncryptionService, + private messageSender: MessageSender, ) {} localData$(userId: UserId): Observable> { @@ -176,6 +187,10 @@ export class CipherService implements CipherServiceAbstraction { ]).pipe( filter(([ciphers, _, keys]) => ciphers != null && keys != null), // Skip if ciphers haven't been loaded yor synced yet switchMap(() => this.getAllDecrypted(userId)), + tap(async (decrypted) => { + await this.searchService.indexCiphers(userId, decrypted); + this.messageSender.send("updateOverlayCiphers"); + }), ); }, this.clearCipherViewsForUser$);