This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
yubi-lock/yubi_lock/api/yubikey.py

20 lines
420 B
Python
Raw Permalink Normal View History

2016-05-18 22:19:01 +01:00
import yubico
2016-05-19 21:32:01 +01:00
from yubi_lock.api.user import get_username
2016-05-18 22:19:01 +01:00
def get_all_yubikeys(debug):
keys = []
try:
skip = 0
while skip < 255:
key = yubico.find_yubikey(debug=debug, skip=skip)
keys.append(key)
skip += 1
except yubico.yubikey.YubiKeyError:
pass
return keys
2016-05-19 21:32:01 +01:00
def generate_ident(key):
return "{}:{}".format(get_username(), key.serial())