mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
Make checking fingerprint optional
This commit is contained in:
parent
72c6f52ae2
commit
47b6934699
@ -24,6 +24,7 @@ export class NativeMessagingBackground {
|
|||||||
|
|
||||||
private resolver: any = null;
|
private resolver: any = null;
|
||||||
private privateKey: ArrayBuffer = null;
|
private privateKey: ArrayBuffer = null;
|
||||||
|
private publicKey: ArrayBuffer = null;
|
||||||
private secureSetupResolve: any = null;
|
private secureSetupResolve: any = null;
|
||||||
private sharedSecret: SymmetricCryptoKey;
|
private sharedSecret: SymmetricCryptoKey;
|
||||||
private appId: string;
|
private appId: string;
|
||||||
@ -89,6 +90,12 @@ export class NativeMessagingBackground {
|
|||||||
confirmText: this.i18nService.t('ok'),
|
confirmText: this.i18nService.t('ok'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
|
case 'verifyFingerprint': {
|
||||||
|
if (this.sharedSecret == null) {
|
||||||
|
this.showFingerprintDialog();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Ignore since it belongs to another device
|
// Ignore since it belongs to another device
|
||||||
if (message.appId !== this.appId) {
|
if (message.appId !== this.appId) {
|
||||||
@ -208,17 +215,10 @@ export class NativeMessagingBackground {
|
|||||||
|
|
||||||
private async secureCommunication() {
|
private async secureCommunication() {
|
||||||
const [publicKey, privateKey] = await this.cryptoFunctionService.rsaGenerateKeyPair(2048);
|
const [publicKey, privateKey] = await this.cryptoFunctionService.rsaGenerateKeyPair(2048);
|
||||||
|
this.publicKey = publicKey;
|
||||||
this.privateKey = privateKey;
|
this.privateKey = privateKey;
|
||||||
|
|
||||||
this.sendUnencrypted({command: 'setupEncryption', publicKey: Utils.fromBufferToB64(publicKey)});
|
this.sendUnencrypted({command: 'setupEncryption', publicKey: Utils.fromBufferToB64(publicKey)});
|
||||||
const fingerprint = (await this.cryptoService.getFingerprint(await this.userService.getUserId(), publicKey)).join(' ');
|
|
||||||
|
|
||||||
this.messagingService.send('showDialog', {
|
|
||||||
html: `${this.i18nService.t('desktopIntegrationVerificationText')}<br><br><strong>${fingerprint}</strong>`,
|
|
||||||
title: this.i18nService.t('desktopSyncVerificationTitle'),
|
|
||||||
confirmText: this.i18nService.t('ok'),
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => this.secureSetupResolve = resolve);
|
return new Promise((resolve, reject) => this.secureSetupResolve = resolve);
|
||||||
}
|
}
|
||||||
@ -232,4 +232,15 @@ export class NativeMessagingBackground {
|
|||||||
|
|
||||||
this.port.postMessage({appId: this.appId, message: message});
|
this.port.postMessage({appId: this.appId, message: message});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async showFingerprintDialog() {
|
||||||
|
const fingerprint = (await this.cryptoService.getFingerprint(await this.userService.getUserId(), this.publicKey)).join(' ');
|
||||||
|
|
||||||
|
this.messagingService.send('showDialog', {
|
||||||
|
html: `${this.i18nService.t('desktopIntegrationVerificationText')}<br><br><strong>${fingerprint}</strong>`,
|
||||||
|
title: this.i18nService.t('desktopSyncVerificationTitle'),
|
||||||
|
confirmText: this.i18nService.t('ok'),
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user