ykman.base

Exceptions

CancelledException

Raised when the caller cancels an operation.

Classes

REINSERT_STATUS

Create a collection of name/value pairs.

YkmanDevice

YubiKey device reference, with optional PID

Module Contents

class ykman.base.REINSERT_STATUS(*args, **kwds)[source]

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

REMOVE = 1
REINSERT = 2
exception ykman.base.CancelledException[source]

Bases: Exception

Raised when the caller cancels an operation.

class ykman.base.YkmanDevice(transport, fingerprint, pid)[source]

Bases: yubikit.core.YubiKeyDevice

YubiKey device reference, with optional PID

Parameters:
property pid: yubikit.core.PID | None

Return the PID of the YubiKey, if available.

Return type:

yubikit.core.PID | None

reinsert(reinsert_cb=None, event=None)[source]

Wait for the user to remove and reinsert the YubiKey.

This may be required to perform certain operations, such as FIDO reset.

This method will attempt to verify that the same YubiKey is reinserted, but it will only fail when this is definitely not the case (eg. if the serial number does not match).

Parameters:
Return type:

None

and should be reinserted. :param event: Optional event to cancel (throws CancelledException).

__repr__()[source]