fido2.ctap2.bio
Exceptions
Common base class for all non-exit exceptions. |
Classes
Helper object to perform fingerprint enrollment. |
|
Implementation of a draft specification of the bio enrollment API. |
Module Contents
- class fido2.ctap2.bio.BioEnrollment(ctap, modality)[source]
- Parameters:
ctap (fido2.ctap2.base.Ctap2)
modality (MODALITY)
- class RESULT[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- MODALITY = 1
- FINGERPRINT_KIND = 2
- MAX_SAMPLES_REQUIRED = 3
- TEMPLATE_ID = 4
- LAST_SAMPLE_STATUS = 5
- REMAINING_SAMPLES = 6
- TEMPLATE_INFOS = 7
- class TEMPLATE_INFO[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- ID = 1
- NAME = 2
- class MODALITY[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- FINGERPRINT = 1
- static is_supported(info)[source]
- Parameters:
info (fido2.ctap2.base.Info)
- Return type:
- ctap
- modality
- exception fido2.ctap2.bio.CaptureError(code)[source]
Bases:
Exception
Common base class for all non-exit exceptions.
- Parameters:
code (int)
- code
- class fido2.ctap2.bio.FPEnrollmentContext(bio, timeout=None)[source]
Helper object to perform fingerprint enrollment.
- Parameters:
bio (FPBioEnrollment) – An instance of FPBioEnrollment.
timeout (Optional[int]) – Optional timeout for fingerprint captures (ms).
- Variables:
remaining – The number of (estimated) remaining samples needed.
template_id – The ID of the new template (only available after the initial sample has been captured).
- timeout
- capture(event=None, on_keepalive=None)[source]
Capture a fingerprint sample.
This call will block for up to timeout milliseconds (or indefinitely, if timeout not specified) waiting for the user to scan their fingerprint to collect one sample.
- Returns:
None, if more samples are needed, or the template ID if enrollment is completed.
- Parameters:
event (Optional[threading.Event])
on_keepalive (Optional[Callable[[int], None]])
- Return type:
Optional[bytes]
- class fido2.ctap2.bio.FPBioEnrollment(ctap, pin_uv_protocol, pin_uv_token)[source]
Bases:
BioEnrollment
Implementation of a draft specification of the bio enrollment API. WARNING: This specification is not final and this class is likely to change.
NOTE: The get_fingerprint_sensor_info method does not require authentication, and can be used by setting pin_uv_protocol and pin_uv_token to None.
- Parameters:
ctap (fido2.ctap2.base.Ctap2) – An instance of a CTAP2 object.
pin_uv_protocol (fido2.ctap2.pin.PinProtocol) – The PIN/UV protocol version used.
pin_uv_token (bytes) – A valid PIN/UV Auth Token for the current CTAP session.
- class CMD[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- ENROLL_BEGIN = 1
- ENROLL_CAPTURE_NEXT = 2
- ENROLL_CANCEL = 3
- ENUMERATE_ENROLLMENTS = 4
- SET_NAME = 5
- REMOVE_ENROLLMENT = 6
- GET_SENSOR_INFO = 7
- class PARAM[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- TEMPLATE_ID = 1
- TEMPLATE_NAME = 2
- TIMEOUT_MS = 3
- class FEEDBACK[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- FP_GOOD = 0
- FP_TOO_HIGH = 1
- FP_TOO_LOW = 2
- FP_TOO_LEFT = 3
- FP_TOO_RIGHT = 4
- FP_TOO_FAST = 5
- FP_TOO_SLOW = 6
- FP_POOR_QUALITY = 7
- FP_TOO_SKEWED = 8
- FP_TOO_SHORT = 9
- FP_MERGE_FAILURE = 10
- FP_EXISTS = 11
- FP_DATABASE_FULL = 12
- NO_USER_ACTIVITY = 13
- NO_UP_TRANSITION = 14
- pin_uv_protocol
- pin_uv_token
- get_fingerprint_sensor_info()[source]
Get fingerprint sensor info.
- Returns:
A dict containing FINGERPRINT_KIND and MAX_SAMPLES_REQUIRES.
- Return type:
Mapping[int, Any]
- enroll_begin(timeout=None, event=None, on_keepalive=None)[source]
Start fingerprint enrollment.
Starts the process of enrolling a new fingerprint, and will wait for the user to scan their fingerprint once to provide an initial sample.
- Parameters:
timeout (Optional[int]) – Optional timeout in milliseconds.
event (Optional[threading.Event])
on_keepalive (Optional[Callable[[int], None]])
- Returns:
A tuple containing the new template ID, the sample status, and the number of samples remaining to complete the enrollment.
- Return type:
Tuple[bytes, FPBioEnrollment, int]
- enroll_capture_next(template_id, timeout=None, event=None, on_keepalive=None)[source]
Continue fingerprint enrollment.
Continues enrolling a new fingerprint and will wait for the user to scan their fingerpring once to provide a new sample. Once the number of samples remaining is 0, the enrollment is completed.
- Parameters:
template_id (bytes) – The template ID returned by a call to enroll_begin.
timeout (Optional[int]) – Optional timeout in milliseconds.
event (Optional[threading.Event])
on_keepalive (Optional[Callable[[int], None]])
- Returns:
A tuple containing the sample status, and the number of samples remaining to complete the enrollment.
- Return type:
Tuple[FPBioEnrollment, int]
- enroll(timeout=None)[source]
Convenience wrapper for doing fingerprint enrollment.
See FPEnrollmentContext for details. :return: An initialized FPEnrollmentContext.
- Parameters:
timeout (Optional[int])
- Return type:
- enumerate_enrollments()[source]
Get a dict of enrolled fingerprint templates which maps template ID’s to their friendly names.