yubikit.core
Submodules
Attributes
Exceptions
An error response from a YubiKey |
|
Invalid response data from the YubiKey |
|
An operation timed out waiting for something |
|
The application is either disabled or not supported on this YubiKey |
|
Attempting an action that is not supported on this YubiKey |
|
An incorrect PIN/PUK was used, with the number of attempts now remaining. |
Classes
3-digit version tuple. |
|
YubiKey physical connection transports. |
|
YubiKey USB interface identifiers. |
|
YubiKey hardware platforms. |
|
A connection to a YubiKey |
|
USB Product ID values for YubiKey devices. |
|
YubiKey device reference |
|
bytes(iterable_of_ints) -> bytes |
Functions
|
Ensure a version is at least min_version. |
|
|
|
Package Contents
- class yubikit.core.TRANSPORT[source]
-
YubiKey physical connection transports.
- USB = 'usb'
- NFC = 'nfc'
- class yubikit.core.USB_INTERFACE[source]
Bases:
enum.IntFlag
YubiKey USB interface identifiers.
- OTP = 1
- FIDO = 2
- CCID = 4
- class yubikit.core.YUBIKEY(*args, **kwds)[source]
Bases:
enum.Enum
YubiKey hardware platforms.
- YKS = 'YubiKey Standard'
- NEO = 'YubiKey NEO'
- SKY = 'Security Key by Yubico'
- YKP = 'YubiKey Plus'
- YK4 = 'YubiKey'
- class yubikit.core.Connection[source]
Bases:
abc.ABC
A connection to a YubiKey
- usb_interface: ClassVar[USB_INTERFACE]
- class yubikit.core.PID[source]
Bases:
enum.IntEnum
USB Product ID values for YubiKey devices.
- YKS_OTP = 16
- NEO_OTP = 272
- NEO_OTP_CCID = 273
- NEO_CCID = 274
- NEO_FIDO = 275
- NEO_OTP_FIDO = 276
- NEO_FIDO_CCID = 277
- NEO_OTP_FIDO_CCID = 278
- SKY_FIDO = 288
- YK4_OTP = 1025
- YK4_FIDO = 1026
- YK4_OTP_FIDO = 1027
- YK4_CCID = 1028
- YK4_OTP_CCID = 1029
- YK4_FIDO_CCID = 1030
- YK4_OTP_FIDO_CCID = 1031
- YKP_OTP_FIDO = 1040
- property usb_interfaces: USB_INTERFACE
- Return type:
- classmethod of(key_type, interfaces)[source]
- Parameters:
key_type (YUBIKEY)
interfaces (USB_INTERFACE)
- Return type:
- supports_connection(connection_type)[source]
- Parameters:
connection_type (type[Connection])
- Return type:
- yubikit.core.T_Connection
- class yubikit.core.YubiKeyDevice(transport, fingerprint)[source]
Bases:
abc.ABC
YubiKey device reference
- Parameters:
transport (TRANSPORT)
fingerprint (Hashable)
- supports_connection(connection_type)[source]
Check if a YubiKeyDevice supports a specific Connection type
- Parameters:
connection_type (type[Connection])
- Return type:
- open_connection(connection_type)[source]
Opens a connection to the YubiKey
- Parameters:
connection_type (Union[type[T_Connection], Callable[Ellipsis, T_Connection]])
- Return type:
T_Connection
- property fingerprint: Hashable
Used to identify that device references from different enumerations represent the same physical YubiKey. This fingerprint is not stable between sessions, or after un-plugging, and re-plugging a device.
- Return type:
Hashable
- exception yubikit.core.BadResponseError[source]
Bases:
CommandError
Invalid response data from the YubiKey
- exception yubikit.core.TimeoutError[source]
Bases:
CommandError
An operation timed out waiting for something
- exception yubikit.core.ApplicationNotAvailableError[source]
Bases:
CommandError
The application is either disabled or not supported on this YubiKey
- exception yubikit.core.NotSupportedError[source]
Bases:
ValueError
Attempting an action that is not supported on this YubiKey
- exception yubikit.core.InvalidPinError(attempts_remaining, message=None)[source]
Bases:
CommandError
,ValueError
An incorrect PIN/PUK was used, with the number of attempts now remaining.
WARNING: This exception currently inherits from ValueError for backwards-compatibility reasons. This will no longer be the case with the next major version of the library.
- attempts_remaining
- yubikit.core.require_version(my_version, min_version, message=None)[source]
Ensure a version is at least min_version.
- class yubikit.core.Tlv(tag_or_data, value=None)[source]
Bases:
bytes
bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object
- Construct an immutable array of bytes from:
an iterable yielding integers in range(256)
a text string encoded using the specified encoding
any object implementing the buffer API.
an integer