Skip to content

Commit

Permalink
Remove biometric from firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Jan 25, 2021
1 parent a971fc3 commit ab759a4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
12 changes: 1 addition & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function dist(browserName, manifest) {
function distFirefox() {
return dist('firefox', (manifest) => {
delete manifest.content_security_policy;
delete manifest.optional_permissions;
removeShortcuts(manifest);
return manifest;
});
Expand All @@ -75,7 +76,6 @@ function distOpera() {
delete manifest.applications;
delete manifest.content_security_policy;
removeShortcuts(manifest);
moveNativeMessagingToOptional(manifest);
return manifest;
});
}
Expand All @@ -86,7 +86,6 @@ function distChrome() {
delete manifest.content_security_policy;
delete manifest.sidebar_action;
delete manifest.commands._execute_sidebar_action;
moveNativeMessagingToOptional(manifest);
return manifest;
});
}
Expand All @@ -97,7 +96,6 @@ function distEdge() {
delete manifest.content_security_policy;
delete manifest.sidebar_action;
delete manifest.commands._execute_sidebar_action;
moveNativeMessagingToOptional(manifest);
return manifest;
});
}
Expand All @@ -111,14 +109,6 @@ function removeShortcuts(manifest) {
}
}

function moveNativeMessagingToOptional(manifest) {
const index = manifest.permissions.indexOf("nativeMessaging");
index > -1 ? manifest.permissions.splice(index, 1) : false
manifest.optional_permissions = [
"nativeMessaging"
];
}

function distSafariMas(cb) {
return distSafariApp(cb, 'mas');
}
Expand Down
4 changes: 3 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
"http://*/*",
"https://*/*",
"webRequest",
"webRequestBlocking",
"webRequestBlocking"
],
"optional_permissions": [
"nativeMessaging"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
Expand Down
2 changes: 1 addition & 1 deletion src/popup/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<label for="pin">{{'unlockWithPin' | i18n}}</label>
<input id="pin" type="checkbox" (change)="updatePin()" [(ngModel)]="pin">
</div>
<div class="box-content-row box-content-row-checkbox" appBoxRow>
<div class="box-content-row box-content-row-checkbox" appBoxRow *ngIf="supportsBiometric">
<label for="biometric">{{'unlockWithBiometrics' | i18n}}</label>
<input id="biometric" type="checkbox" (change)="updateBiometric()" [(ngModel)]="biometric">
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/popup/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class SettingsComponent implements OnInit {
vaultTimeoutActions: any[];
vaultTimeoutAction: string;
pin: boolean = null;
supportsBiometric: boolean;
biometric: boolean = false;
previousVaultTimeout: number = null;

Expand Down Expand Up @@ -102,6 +103,8 @@ export class SettingsComponent implements OnInit {

const pinSet = await this.vaultTimeoutService.isPinLockSet();
this.pin = pinSet[0] || pinSet[1];

this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
}

Expand Down Expand Up @@ -208,7 +211,7 @@ export class SettingsComponent implements OnInit {
}

async updateBiometric() {
if (this.biometric) {
if (this.biometric && this.supportsBiometric) {

// Request permission to use the optional permission for nativeMessaging
if (!this.platformUtilsService.isFirefox()) {
Expand Down
2 changes: 1 addition & 1 deletion src/services/browserPlatformUtils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
}

supportsBiometric() {
return Promise.resolve(true);
return Promise.resolve(!this.isFirefox() && !this.isSafari());
}

authenticateBiometric() {
Expand Down

0 comments on commit ab759a4

Please sign in to comment.