1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

Cleanup code

This commit is contained in:
Hinton
2020-10-21 16:48:40 +02:00
parent 9ff0f204d8
commit 77fc0ce55b
4 changed files with 25 additions and 23 deletions

View File

@@ -24,10 +24,13 @@ export class NativeMessagingService {
}
private async messageHandler(rawMessage: any) {
// Request to setup secure encryption
if (rawMessage.command == 'setupEncryption') {
const remotePublicKey = Utils.fromB64ToArray(rawMessage.publicKey).buffer;
const fingerprint = (await this.cryptoService.getFingerprint(await this.userService.getUserId(), remotePublicKey)).join(' ');
// Await confirmation that fingerprint is correct
const submitted = await Swal.fire({
title: this.i18nService.t('verifyBrowserTitle'),
html: `${this.i18nService.t('verifyBrowserDescription')}<br><br><strong>${fingerprint}</strong>`,
@@ -46,7 +49,6 @@ export class NativeMessagingService {
return;
}
// TODO: Add error handler, if it fails we should invalidate the key and send a re-authenticate message to browser
const message = JSON.parse(await this.cryptoService.decryptToUtf8(rawMessage, this.sharedSecret));
if (Math.abs(message.timestamp - Date.now()) > MessageValidTimeout) {
@@ -57,8 +59,7 @@ export class NativeMessagingService {
switch (message.command) {
case 'biometricUnlock':
if (! this.platformUtilService.supportsBiometric()) {
ipcRenderer.send('nativeMessagingSync', )
return this.send({command: 'biometricUnlock', response: 'not supported'})
return this.send({command: 'biometricUnlock', response: 'not supported'});
}
const response = await this.platformUtilService.authenticateBiometric();