eric7.WebBrowser.WebAuth.Fido2Management

Module implementing a manager for FIDO2 security keys.

Global Attributes

None

Classes

Fido2DeviceError Class signaling an issue with the device.
Fido2Management Class implementing a manager for FIDO2 security keys.
Fido2PinError Class signaling an issue with the PIN.

Functions

None


Fido2DeviceError

Class signaling an issue with the device.

Derived from

Exception

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


Fido2Management

Class implementing a manager for FIDO2 security keys.

Signals

deviceConnected()
emitted to indicate a connect to the security key
deviceDisconnected()
emitted to indicate a disconnect from the security key

Derived from

QObject

Class Attributes

FidoExtension2Str
FidoInfoCategories2Str
FidoVersion2Str

Class Methods

None

Methods

Fido2Management Constructor
__initConfig Private method to initialize a configuration object.
__initializeCredentialManager Private method to initialize a credential manager object.
__pinErrorMessage Private method to get a message for a PIN error.
canSetMinimumPinLength Public method to check, if the 'setMinPINLength' function is available.
canToggleAlwaysUv Public method to check, if the 'toggleAlwaysUv' function is available.
changePasskeyUserInfo Public method to change the user info of a stored passkey.
changePin Public method to change the PIN of the connected security key.
connectToDevice Public method to connect to a given security key.
deletePasskey Public method to delete the passkey of the given ID.
disconnectFromDevice Public method to disconnect from the current device.
forcePinChange Public method to force the PIN to be changed to a new value before use.
forcePinChangeSupported Public method to check, if the 'forcePinChange' function is supported by the selected security key.
getAlwaysUv Public method to get the value of the 'alwaysUv' flag of the current security key.
getDevices Public method to get a list of connected security keys.
getMinimumPinLength Public method to get the minimum PIN length defined by the security key.
getPasskeys Public method to get all stored passkeys.
getPinRetries Public method to get the number of PIN retries left and an indication for the need of a power cycle.
getSecurityKeyInfo Public method to get information about the connected security key.
hasPin Public method to check, if the connected security key has a PIN set.
isDeviceLocked Public method to check, if the device is in locked state (i.e.
lockDevice Public method to lock the device (i.e.
pinChangeRequired Public method to check for a forced PIN change.
reconnectToDevice Public method to reconnect the current security key.
resetDevice Public method to reset the connected security key.
setMinimumPinLength Public method to set the minimum PIN length.
setPin Public method to set a PIN for the connected security key.
toggleAlwaysUv Public method to toggle the 'alwaysUv' flag of the selected security key.
unlockDevice Public method to unlock the device (i.e.
verifyPin Public method to verify a given PIN.

Static Methods

None

Fido2Management (Constructor)

Fido2Management(parent=None)

Constructor

parent (QObject (optional))
reference to the parent object (defaults to None)

Fido2Management.__initConfig

__initConfig(pin)

Private method to initialize a configuration object.

pin (str)
PIN to unlock the connected security key
Return:
reference to the configuration object
Return Type:
Config
Raises Fido2DeviceError:
raised to indicate an issue with the selected security key
Raises Fido2PinError:
raised to indicate an issue with the PIN

Fido2Management.__initializeCredentialManager

__initializeCredentialManager(pin)

Private method to initialize a credential manager object.

pin (str)
PIN to unlock the connected security key
Return:
reference to the credential manager object
Return Type:
CredentialManagement
Raises Fido2DeviceError:
raised to indicate an issue with the selected security key
Raises Fido2PinError:
raised to indicate an issue with the PIN

Fido2Management.__pinErrorMessage

__pinErrorMessage(err)

Private method to get a message for a PIN error.

err (CtapError)
reference to the exception object
Return:
message for the given PIN error
Return Type:
str

Fido2Management.canSetMinimumPinLength

canSetMinimumPinLength()

Public method to check, if the 'setMinPINLength' function is available.

Return:
flag indicating availability
Return Type:
bool

Fido2Management.canToggleAlwaysUv

canToggleAlwaysUv()

Public method to check, if the 'toggleAlwaysUv' function is available.

Return:
flag indicating availability
Return Type:
bool

Fido2Management.changePasskeyUserInfo

changePasskeyUserInfo(pin, credentialId, userId, userName, displayName)

Public method to change the user info of a stored passkey.

pin (str)
PIN to unlock the connected security key
credentialId (fido2.webauthn.PublicKeyCredentialDescriptor)
ID of the passkey to change
userId (bytes)
ID of the user
userName (str)
user name to set
displayName (str)
display name to set

Fido2Management.changePin

changePin(oldPin, newPin)

Public method to change the PIN of the connected security key.

oldPin (str)
current PIN
newPin (str)
new PIN
Return:
flag indicating success and a message
Return Type:
tuple of (bool, str)

Fido2Management.connectToDevice

connectToDevice(device)

Public method to connect to a given security key.

device (CtapHidDevice)
reference to the security key device class

Fido2Management.deletePasskey

deletePasskey(pin, credentialId)

Public method to delete the passkey of the given ID.

pin (str)
PIN to unlock the connected security key
credentialId (fido2.webauthn.PublicKeyCredentialDescriptor)
ID of the passkey to be deleted

Fido2Management.disconnectFromDevice

disconnectFromDevice()

Public method to disconnect from the current device.

Fido2Management.forcePinChange

forcePinChange(pin)

Public method to force the PIN to be changed to a new value before use.

pin (str)
PIN to unlock the connected security key

Fido2Management.forcePinChangeSupported

forcePinChangeSupported()

Public method to check, if the 'forcePinChange' function is supported by the selected security key.

Return:
flag indicating support
Return Type:
bool

Fido2Management.getAlwaysUv

getAlwaysUv()

Public method to get the value of the 'alwaysUv' flag of the current security key.

Return:
return value of the 'alwaysUv' flag
Return Type:
bool

Fido2Management.getDevices

getDevices()

Public method to get a list of connected security keys.

Return:
list of connected security keys
Return Type:
list of CtapHidDevice

Fido2Management.getMinimumPinLength

getMinimumPinLength()

Public method to get the minimum PIN length defined by the security key.

Return:
minimum length for the PIN
Return Type:
int

Fido2Management.getPasskeys

getPasskeys(pin)

Public method to get all stored passkeys.

pin (str)
PIN to unlock the connected security key
Return:
tuple containing a dictionary containing the stored passkeys grouped by Relying Party ID, the count of used credential slots and the count of available credential slots
Return Type:
tuple of [dict[str, list[dict[str, Any]]], int, int]

Fido2Management.getPinRetries

getPinRetries()

Public method to get the number of PIN retries left and an indication for the need of a power cycle.

Return:
tuple containing the number of retries left and a flag indicating a power cycle is required. A retry value of -1 indicates, that no PIN was set yet.
Return Type:
tuple of (int, bool)

Fido2Management.getSecurityKeyInfo

getSecurityKeyInfo()

Public method to get information about the connected security key.

Return:
dictionary containing the info data
Return Type:
dict[str, list[tuple[str, str]]]

Fido2Management.hasPin

hasPin()

Public method to check, if the connected security key has a PIN set.

Return:
flag indicating that a PIN has been set or None in case no device was connected yet or it does not support PIN
Return Type:
bool or None

Fido2Management.isDeviceLocked

isDeviceLocked()

Public method to check, if the device is in locked state (i.e. the stored PIN is None).

Return:
flag indicating the locked state
Return Type:
bool

Fido2Management.lockDevice

lockDevice()

Public method to lock the device (i.e. delete the stored PIN).

Fido2Management.pinChangeRequired

pinChangeRequired()

Public method to check for a forced PIN change.

Return:
flag indicating a forced PIN change is required
Return Type:
bool

Fido2Management.reconnectToDevice

reconnectToDevice()

Public method to reconnect the current security key.

Fido2Management.resetDevice

resetDevice()

Public method to reset the connected security key.

Return:
flag indicating success and a message
Return Type:
tuple of (bool, str)

Fido2Management.setMinimumPinLength

setMinimumPinLength(pin, minLength)

Public method to set the minimum PIN length.

pin (str)
PIN to unlock the connected security key
minLength (int)
minimum PIN length
Raises Fido2PinError:
raised to indicate an issue with the PIN length

Fido2Management.setPin

setPin(pin)

Public method to set a PIN for the connected security key.

pin (str)
PIN to be set
Return:
flag indicating success and a message
Return Type:
tuple of (bool, str)

Fido2Management.toggleAlwaysUv

toggleAlwaysUv(pin)

Public method to toggle the 'alwaysUv' flag of the selected security key.

pin (str)
PIN to unlock the connected security key

Fido2Management.unlockDevice

unlockDevice(pin)

Public method to unlock the device (i.e. store the PIN for later use).

pin (str)
PIN to be stored

Fido2Management.verifyPin

verifyPin(pin)

Public method to verify a given PIN.

A successful verification of the PIN will reset the "retries" counter.

pin (str)
PIN to be verified
Return:
flag indicating successful verification and a verification message
Return Type:
tuple of (bool, str)
Up


Fido2PinError

Class signaling an issue with the PIN.

Derived from

Exception

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up