From 006df9f44d01a5e51c05a432655e3d236b5ebb09 Mon Sep 17 00:00:00 2001 From: Dag Heyman Date: Mon, 25 Sep 2017 10:24:44 +0200 Subject: [PATCH] refactor: remove dead get_features code --- py/yubikey.py | 6 ------ qml/YubiKey.qml | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/py/yubikey.py b/py/yubikey.py index 3c1612c3..f00114cb 100644 --- a/py/yubikey.py +++ b/py/yubikey.py @@ -16,8 +16,6 @@ from ykman.oath import OathController, Credential, SW from qr import qrparse from qr import qrdecode -NON_FEATURE_CAPABILITIES = [CAPABILITY.CCID, CAPABILITY.NFC] - def as_json(f): def wrapped(*args): @@ -37,10 +35,6 @@ class Controller(object): if isinstance(func, types.MethodType): setattr(self, f, as_json(func)) - def get_features(self): - return [ - c.name for c in CAPABILITY if c not in NON_FEATURE_CAPABILITIES] - def count_devices(self): return len(list(get_descriptors())) diff --git a/qml/YubiKey.qml b/qml/YubiKey.qml index 1601b73e..ec52d253 100644 --- a/qml/YubiKey.qml +++ b/qml/YubiKey.qml @@ -11,7 +11,6 @@ Python { property string name property string version property string oathId - property var features: [] property var connections: [] property var credentials: [] property int nextRefresh: 0 @@ -34,15 +33,10 @@ Python { addImportPath(urlPrefix + '/py') importModule('yubikey', function () { ready = true - do_call('yubikey.controller.get_features', [], - function (res) { - features = res - for (var i in queue) { - do_call(queue[i][0], queue[i][1], - queue[i][2]) - } - queue = [] - }) + for (var i in queue) { + do_call(queue[i][0], queue[i][1], queue[i][2]) + } + queue = [] }) }) }) @@ -168,7 +162,8 @@ Python { for (var i = 0; i < creds.length; i++) { var cred = creds[i] // Update min expiration - if (cred.expiration && cred.expiration < minExpiration && cred.period === 30) { + if (cred.expiration && cred.expiration < minExpiration + && cred.period === 30) { minExpiration = cred.expiration } // Touch credentials should only be replaced by user @@ -207,7 +202,6 @@ Python { return credentials[i] } } - } function credentialExists(longName) { @@ -243,7 +237,7 @@ Python { function calculate(credential, copyAfterUpdate) { var now = Math.floor(Date.now() / 1000) do_call('yubikey.controller.calculate', [credential, now, passwordKey], - function(cred) { + function (cred) { updateSingleCredential(cred, copyAfterUpdate) }) } @@ -251,7 +245,7 @@ Python { function calculateSlotMode(slot, digits, copyAfterUpdate) { var now = Math.floor(Date.now() / 1000) do_call('yubikey.controller.calculate_slot_mode', [slot, digits, now], - function(cred) { + function (cred) { updateSingleCredential(cred, copyAfterUpdate) }) }