diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index ca584a831b2..be4275d8bb5 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -1362,5 +1362,14 @@ }, "masterPasswordPolicyRequirementsNotMet": { "message": "Your new master password does not meet the policy requirements." + }, + "ok": { + "message": "Ok" + }, + "desktopSyncVerificationTitle": { + "message": "Desktop sync verification" + }, + "desktopIntegrationVerificationText": { + "message": "Please verify that the desktop application shows this fingerprint: " } } diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 0295430661a..537b0222bf5 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -233,7 +233,8 @@ export default class MainBackground { this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService, this.analytics, this.notificationsService, this.systemService, this.vaultTimeoutService, this.environmentService); - this.nativeMessagingBackground = new NativeMessagingBackground(this.storageService, this.cryptoService, this.cryptoFunctionService, this.vaultTimeoutService, this.runtimeBackground); + this.nativeMessagingBackground = new NativeMessagingBackground(this.storageService, this.cryptoService, this.cryptoFunctionService, + this.vaultTimeoutService, this.runtimeBackground, this.i18nService, this.userService, this.messagingService); this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService, this.platformUtilsService, this.analytics, this.vaultTimeoutService); diff --git a/src/background/nativeMessaging.background.ts b/src/background/nativeMessaging.background.ts index afefab21f29..e80f8fc00fa 100644 --- a/src/background/nativeMessaging.background.ts +++ b/src/background/nativeMessaging.background.ts @@ -1,4 +1,6 @@ -import { CryptoService, LogService, VaultTimeoutService } from 'jslib/abstractions'; +import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { MessagingService } from 'jslib/abstractions/messaging.service'; +import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service'; import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { Utils } from 'jslib/misc/utils'; @@ -6,6 +8,8 @@ import { SymmetricCryptoKey } from 'jslib/models/domain'; import { ConstantsService } from 'jslib/services'; import { BrowserApi } from '../browser/browserApi'; import RuntimeBackground from './runtime.background'; +import { UserService } from 'jslib/abstractions/user.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; const MessageValidTimeout = 10 * 1000; const EncryptionAlgorithm = 'sha1'; @@ -22,7 +26,8 @@ export class NativeMessagingBackground { constructor(private storageService: StorageService, private cryptoService: CryptoService, private cryptoFunctionService: CryptoFunctionService, private vaultTimeoutService: VaultTimeoutService, - private runtimeBackground: RuntimeBackground) {} + private runtimeBackground: RuntimeBackground, private i18nService: I18nService, private userService: UserService, + private messagingService: MessagingService) {} connect() { this.port = BrowserApi.connectNative('com.8bit.bitwarden'); @@ -109,6 +114,14 @@ export class NativeMessagingBackground { [this.publicKey, this.privateKey] = await this.cryptoFunctionService.rsaGenerateKeyPair(2048); this.sendUnencrypted({command: 'setupEncryption', publicKey: Utils.fromBufferToB64(this.publicKey)}); + const fingerprint = (await this.cryptoService.getFingerprint(await this.userService.getUserId(), this.publicKey)).join(' '); + + this.messagingService.send('showDialog', { + html: `${this.i18nService.t('desktopIntegrationVerificationText')}

${fingerprint}.`, + title: this.i18nService.t('desktopSyncVerificationTitle'), + confirmText: this.i18nService.t('ok'), + type: 'warning', + }); return new Promise((resolve, reject) => this.secureSetupResolve = resolve); } diff --git a/src/popup/app.component.ts b/src/popup/app.component.ts index 1daee7f854c..5e10d08ecb3 100644 --- a/src/popup/app.component.ts +++ b/src/popup/app.component.ts @@ -241,6 +241,7 @@ export class AppComponent implements OnInit { icon: type as SweetAlertIcon, // required to be any of the SweetAlertIcons to output the iconHtml. iconHtml: iconClasses != null ? `` : undefined, text: msg.text, + html: msg.html, title: msg.title, showCancelButton: (cancelText != null), cancelButtonText: cancelText,