support yk preview

This commit is contained in:
Dag Heyman 2018-04-26 15:02:27 +02:00
parent e8bbd37ac0
commit 67b9c1e70b
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338
2 changed files with 11 additions and 12 deletions

View File

@ -10,8 +10,7 @@ from base64 import b32encode, b64decode
from binascii import a2b_hex, b2a_hex
from ykman.descriptor import get_descriptors
from ykman.util import (
CAPABILITY, TRANSPORT, parse_b32_key)
from ykman.util import (TRANSPORT, parse_b32_key)
from ykman.driver_otp import YkpersError
from ykman.driver_ccid import APDUError
from ykman.oath import (ALGO, OATH_TYPE, OathController, CredentialData,
@ -137,9 +136,10 @@ class Controller(object):
'name': dev.device_name,
'version': version,
'serial': dev.serial or '',
'enabled': [c.name for c in CAPABILITY if c & dev.enabled],
'connections': [
t.name for t in TRANSPORT if t & dev.capabilities]
'usb_interfaces_supported': [
t.name for t in TRANSPORT
if t & dev.config.usb_supported],
'usb_interfaces_enabled': str(dev.mode).split('+')
}
return self._dev_info

View File

@ -12,16 +12,16 @@ Python {
property string name
property var version
property string oathId
property var connections: []
property var supportedUsbInterfaces: []
property var enabledUsbInterfaces: []
property var entries: null
property int nextRefresh: 0
property var enabled: null
property bool yubikeyModuleLoaded: false
property bool yubikeyReady: false
property bool yubikeyBusy: false
property var queue: []
readonly property bool hasOTP: enabled.indexOf('OTP') !== -1
readonly property bool hasCCID: enabled.indexOf('CCID') !== -1
readonly property bool hasOTP: enabledUsbInterfaces.indexOf('OTP') !== -1
readonly property bool hasCCID: enabledUsbInterfaces.indexOf('CCID') !== -1
property bool validated
property bool slot1inUse
property bool slot2inUse
@ -101,11 +101,10 @@ Python {
do_call('yubikey.controller.refresh', [slotMode],
function (dev) {
var usable = dev && dev.usable
name = usable ? dev.name : ''
version = usable ? dev.version : null
enabled = usable ? dev.enabled : []
connections = usable ? dev.connections : (dev ? dev.transports : [])
enabledUsbInterfaces = usable ? dev.usb_interfaces_enabled : []
supportedUsbInterfaces = usable ? dev.usb_interfaces_supported : []
hasDevice = !!usable
})
} else {