fido2.webauthn
Classes
bytes(iterable_of_ints) -> bytes |
|
bytes(iterable_of_ints) -> bytes |
|
Binary encoding of the authenticator data. |
|
Binary CBOR encoded attestation object. |
|
bytes(iterable_of_ints) -> bytes |
|
Enum of strings for WebAuthn types. |
|
Enum of strings for WebAuthn types. |
|
Enum of strings for WebAuthn types. |
|
Enum of strings for WebAuthn types. |
|
Enum of strings for WebAuthn types. |
|
Enum of strings for WebAuthn types. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
A data class with members also accessible as a JSON-serializable Mapping. |
|
Holds extension output from a call to MakeCredential or GetAssertion. |
Module Contents
- class fido2.webauthn.Aaguid(data)[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
- Parameters:
data (bytes)
- class fido2.webauthn.AttestedCredentialData(_)[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
- Parameters:
_ (bytes)
- public_key: fido2.cose.CoseKey
- classmethod create(aaguid, credential_id, public_key)[source]
Create an AttestedCredentialData by providing its components.
- Parameters:
aaguid (bytes) – The AAGUID of the authenticator.
credential_id (bytes) – The binary ID of the credential.
public_key (fido2.cose.CoseKey) – A COSE formatted public key.
- Returns:
The attested credential data.
- Return type:
- classmethod unpack_from(data)[source]
Unpack an AttestedCredentialData from a byte string, returning it and any remaining data.
- Parameters:
data (bytes) – A binary string containing an attested credential data.
- Returns:
The parsed AttestedCredentialData, and any remaining data from the input.
- Return type:
Tuple[AttestedCredentialData, bytes]
- class fido2.webauthn.AuthenticatorData(_)[source]
Bases:
bytes
Binary encoding of the authenticator data.
- Parameters:
_ (bytes) – The binary representation of the authenticator data.
- Variables:
rp_id_hash – SHA256 hash of the RP ID.
flags – The flags of the authenticator data, see AuthenticatorData.FLAG.
counter – The signature counter of the authenticator.
credential_data – Attested credential data, if available.
extensions – Authenticator extensions, if available.
- class FLAG[source]
Bases:
enum.IntFlag
Authenticator data flags
See https://www.w3.org/TR/webauthn/#sec-authenticator-data for details
- UP = 1
- UV = 4
- BE = 8
- BS = 16
- AT = 64
- ED = 128
- USER_PRESENT = 1
- USER_VERIFIED = 4
- BACKUP_ELIGIBILITY = 8
- BACKUP_STATE = 16
- ATTESTED = 64
- EXTENSION_DATA = 128
- flags: AuthenticatorData
- credential_data: AttestedCredentialData | None
- classmethod create(rp_id_hash, flags, counter, credential_data=b'', extensions=None)[source]
Create an AuthenticatorData instance.
- Parameters:
rp_id_hash (bytes) – SHA256 hash of the RP ID.
flags (AuthenticatorData) – Flags of the AuthenticatorData.
counter (int) – Signature counter of the authenticator data.
credential_data (bytes) – Authenticated credential data (only if attested credential data flag is set).
extensions (Optional[Mapping]) – Authenticator extensions (only if ED flag is set).
- Returns:
The authenticator data.
- class fido2.webauthn.AttestationObject(_)[source]
Bases:
bytes
Binary CBOR encoded attestation object.
- Parameters:
_ (bytes) – The binary representation of the attestation object.
- Variables:
fmt – The type of attestation used.
auth_data – The attested authenticator data.
att_statement – The attestation statement.
- auth_data: AuthenticatorData
- classmethod create(fmt, auth_data, att_stmt)[source]
- Parameters:
fmt (str)
auth_data (AuthenticatorData)
att_stmt (Mapping[str, Any])
- Return type:
- classmethod from_ctap1(app_param, registration)[source]
Create an AttestationObject from a CTAP1 RegistrationData instance.
- Parameters:
app_param (bytes) – SHA256 hash of the RP ID used for the CTAP1 request.
registration (RegistrationData) – The CTAP1 registration data.
- Returns:
The attestation object, using the “fido-u2f” format.
- Return type:
- class fido2.webauthn.CollectedClientData(_)[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
- Parameters:
_ (bytes)
- class TYPE[source]
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- CREATE = 'webauthn.create'
- GET = 'webauthn.get'
- class fido2.webauthn.AttestationConveyancePreference[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- NONE = 'none'
- INDIRECT = 'indirect'
- DIRECT = 'direct'
- ENTERPRISE = 'enterprise'
- class fido2.webauthn.UserVerificationRequirement[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- REQUIRED = 'required'
- PREFERRED = 'preferred'
- DISCOURAGED = 'discouraged'
- class fido2.webauthn.ResidentKeyRequirement[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- REQUIRED = 'required'
- PREFERRED = 'preferred'
- DISCOURAGED = 'discouraged'
- class fido2.webauthn.AuthenticatorAttachment[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- PLATFORM = 'platform'
- CROSS_PLATFORM = 'cross-platform'
- class fido2.webauthn.AuthenticatorTransport[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- USB = 'usb'
- NFC = 'nfc'
- BLE = 'ble'
- HYBRID = 'hybrid'
- INTERNAL = 'internal'
- class fido2.webauthn.PublicKeyCredentialType[source]
Bases:
_StringEnum
Enum of strings for WebAuthn types.
Unrecognized values are treated as missing.
- PUBLIC_KEY = 'public-key'
- class fido2.webauthn.PublicKeyCredentialRpEntity[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- class fido2.webauthn.PublicKeyCredentialUserEntity[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- class fido2.webauthn.PublicKeyCredentialParameters[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- type: PublicKeyCredentialType
- class fido2.webauthn.PublicKeyCredentialDescriptor[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- type: PublicKeyCredentialType
- transports: Sequence[AuthenticatorTransport] | None = None
- class fido2.webauthn.AuthenticatorSelectionCriteria[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- authenticator_attachment: AuthenticatorAttachment | None = None
- resident_key: ResidentKeyRequirement | None = None
- user_verification: UserVerificationRequirement | None = None
- class fido2.webauthn.PublicKeyCredentialCreationOptions[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- pub_key_cred_params: Sequence[PublicKeyCredentialParameters]
- exclude_credentials: Sequence[PublicKeyCredentialDescriptor] | None = None
- authenticator_selection: AuthenticatorSelectionCriteria | None = None
- attestation: AttestationConveyancePreference | None = None
- class fido2.webauthn.PublicKeyCredentialRequestOptions[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- allow_credentials: Sequence[PublicKeyCredentialDescriptor] | None = None
- user_verification: UserVerificationRequirement | None = None
- class fido2.webauthn.AuthenticatorAttestationResponse[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- client_data: CollectedClientData
- attestation_object: AttestationObject
- class fido2.webauthn.AuthenticatorAssertionResponse[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- client_data: CollectedClientData
- authenticator_data: AuthenticatorData
- class fido2.webauthn.RegistrationResponse[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- response: AuthenticatorAttestationResponse
- authenticator_attachment: AuthenticatorAttachment | None = None
- client_extension_results: AuthenticationExtensionsClientOutputs | None = None
- type: PublicKeyCredentialType | None = None
- class fido2.webauthn.AuthenticationResponse[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- response: AuthenticatorAssertionResponse
- authenticator_attachment: AuthenticatorAttachment | None = None
- client_extension_results: AuthenticationExtensionsClientOutputs | None = None
- type: PublicKeyCredentialType | None = None
- class fido2.webauthn.CredentialCreationOptions[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- public_key: PublicKeyCredentialCreationOptions
- class fido2.webauthn.CredentialRequestOptions[source]
Bases:
_WebAuthnDataObject
A data class with members also accessible as a JSON-serializable Mapping.
- public_key: PublicKeyCredentialRequestOptions
- class fido2.webauthn.AuthenticationExtensionsClientOutputs(outputs)[source]
Bases:
Mapping
[str
,Any
]Holds extension output from a call to MakeCredential or GetAssertion.
When accessed as a dict, all bytes values will be serialized to base64url encoding, capable of being serialized to JSON.
When accessed using attributes, richer types will instead be returned.
- Parameters:
outputs (Mapping[str, Any])