auto-opening yubikeys with other files

This commit is contained in:
antelle 2020-05-14 18:31:26 +02:00
parent 2075e82381
commit 1b279119cb
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
1 changed files with 13 additions and 4 deletions

View File

@ -800,6 +800,11 @@ class AppModel {
if (params) {
this.saveFileFingerprint(file, params.password);
}
if (this.settings.yubiKeyAutoOpen) {
if (this.attachedYubiKeysCount > 0 && !this.files.some(f => f.external)) {
this.tryOpenOtpDeviceInBackground();
}
}
}
fileClosed(file) {
@ -1221,13 +1226,17 @@ class AppModel {
const hasOpenFiles = this.files.some(file => file.active && !file.external);
if (isNewYubiKey && hasOpenFiles && !this.openingOtpDevice) {
this.appLogger.debug('Auto-opening a YubiKey');
this.openOtpDevice(err => {
this.appLogger.debug('YubiKey auto-open complete', err);
});
this.tryOpenOtpDeviceInBackground();
}
}
tryOpenOtpDeviceInBackground() {
this.appLogger.debug('Auto-opening a YubiKey');
this.openOtpDevice(err => {
this.appLogger.debug('YubiKey auto-open complete', err);
});
}
openOtpDevice(callback) {
this.openingOtpDevice = true;
const device = new YubiKeyOtpModel();