fido2.client.win_api

Structs based on Microsoft’s WebAuthN API. https://github.com/microsoft/webauthn

Attributes

windll

PBYTE

PCWSTR

PVOID

HRESULT

WEBAUTHN

WEBAUTHN_API_VERSION

WEBAUTHN_STRUCT_VERSIONS

Classes

BytesProperty

Property for structs storing byte arrays as DWORD + PBYTE.

GUID

GUID Type in C++.

WebAuthNUserVerificationRequirement

Maps to WEBAUTHN_USER_VERIFICATION_REQUIREMENT_*.

WebAuthNAttestationConveyancePreference

Maps to WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_*.

WebAuthNAuthenticatorAttachment

Maps to WEBAUTHN_AUTHENTICATOR_ATTACHMENT_*.

WebAuthNCTAPTransport

Maps to WEBAUTHN_CTAP_TRANSPORT_*.

WebAuthNEnterpriseAttestation

Maps to WEBAUTHN_ENTERPRISE_ATTESTATION_*.

WebAuthNLargeBlobSupport

Maps to WEBAUTHN_LARGE_BLOB_SUPPORT_*.

WebAuthNLargeBlobOperation

Maps to WEBAUTHN_LARGE_BLOB_OPERATION_*.

WebAuthNUserVerification

Maps to WEBAUTHN_USER_VERIFICATION_*.

WebAuthNCoseCredentialParameter

Maps to WEBAUTHN_COSE_CREDENTIAL_PARAMETER Struct.

WebAuthNCoseCredentialParameters

Maps to WEBAUTHN_COSE_CREDENTIAL_PARAMETERS Struct.

WebAuthNClientData

Maps to WEBAUTHN_CLIENT_DATA Struct.

WebAuthNRpEntityInformation

Maps to WEBAUTHN_RP_ENTITY_INFORMATION Struct.

WebAuthNUserEntityInformation

Maps to WEBAUTHN_USER_ENTITY_INFORMATION Struct.

WebAuthNCredentialEx

Maps to WEBAUTHN_CREDENTIAL_EX Struct.

WebAuthNCredentialList

Maps to WEBAUTHN_CREDENTIAL_LIST Struct.

WebAuthNHmacSecretSalt

Structure base class

WebAuthNCredWithHmacSecretSalt

Structure base class

WebAuthNHmacSecretSaltValues

Structure base class

WebAuthNCredProtectExtensionIn

Maps to WEBAUTHN_CRED_PROTECT_EXTENSION_IN Struct.

WebAuthNCredBlobExtension

Structure base class

WebAuthNExtension

Maps to WEBAUTHN_EXTENSION Struct.

WebAuthNExtensions

Maps to WEBAUTHN_EXTENSIONS Struct.

WebAuthNCredential

Maps to WEBAUTHN_CREDENTIAL Struct.

WebAuthNCredentials

Maps to WEBAUTHN_CREDENTIALS Struct.

CtapCborHybridStorageLinkedData

Maps to CTAPCBOR_HYBRID_STORAGE_LINKED_DATA Struct.

WebAuthNGetAssertionOptions

Maps to WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS Struct.

WebAuthNAssertion

Maps to WEBAUTHN_ASSERTION Struct.

WebAuthNMakeCredentialOptions

maps to WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS Struct.

WebAuthNCredentialAttestation

Maps to WEBAUTHN_CREDENTIAL_ATTESTATION Struct.

Functions

get_version(class_name)

Get version of struct.

Module Contents

fido2.client.win_api.windll
fido2.client.win_api.PBYTE
fido2.client.win_api.PCWSTR
fido2.client.win_api.PVOID
class fido2.client.win_api.BytesProperty(name)

Property for structs storing byte arrays as DWORD + PBYTE.

Allows for easy reading/writing to struct fields using Python bytes objects.

Parameters:

name (str)

cbName
pbName
class fido2.client.win_api.GUID

Bases: ctypes.Structure

GUID Type in C++.

class fido2.client.win_api.WebAuthNUserVerificationRequirement

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_USER_VERIFICATION_REQUIREMENT_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L335

ANY = 0
REQUIRED = 1
PREFERRED = 2
DISCOURAGED = 3
class fido2.client.win_api.WebAuthNAttestationConveyancePreference

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L340

ANY = 0
NONE = 1
INDIRECT = 2
DIRECT = 3
class fido2.client.win_api.WebAuthNAuthenticatorAttachment

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_AUTHENTICATOR_ATTACHMENT_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L330

ANY = 0
PLATFORM = 1
CROSS_PLATFORM = 2
CROSS_PLATFORM_U2F_V2 = 3
class fido2.client.win_api.WebAuthNCTAPTransport

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_CTAP_TRANSPORT_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L225

ANY = 0
USB = 1
NFC = 2
BLE = 4
TEST = 8
INTERNAL = 16
FLAGS_MASK = 31
class fido2.client.win_api.WebAuthNEnterpriseAttestation

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_ENTERPRISE_ATTESTATION_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L401

NONE = 0
VENDOR_FACILITATED = 1
PLATFORM_MANAGED = 2
class fido2.client.win_api.WebAuthNLargeBlobSupport

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_LARGE_BLOB_SUPPORT_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L405

NONE = 0
REQUIRED = 1
PREFERRED = 2
class fido2.client.win_api.WebAuthNLargeBlobOperation

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_LARGE_BLOB_OPERATION_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L478

NONE = 0
GET = 1
SET = 2
DELETE = 3
class fido2.client.win_api.WebAuthNUserVerification

Bases: _FromString, enum.IntEnum

Maps to WEBAUTHN_USER_VERIFICATION_*.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L482

ANY = 0
OPTIONAL = 1
OPTIONAL_WITH_CREDENTIAL_ID_LIST = 2
REQUIRED = 3
class fido2.client.win_api.WebAuthNCoseCredentialParameter(cred_params)

Bases: ctypes.Structure

Maps to WEBAUTHN_COSE_CREDENTIAL_PARAMETER Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L185

Parameters:

cred_params (Mapping[str, Any]) – Dict of Credential parameters.

dwVersion
pwszCredentialType
lAlg
class fido2.client.win_api.WebAuthNCoseCredentialParameters(params)

Bases: ctypes.Structure

Maps to WEBAUTHN_COSE_CREDENTIAL_PARAMETERS Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L191

Parameters:

params (Sequence[Mapping[str, Any]]) – List of Credential parameter dicts.

cCredentialParameters
pCredentialParameters
class fido2.client.win_api.WebAuthNClientData(client_data_json)

Bases: ctypes.Structure

Maps to WEBAUTHN_CLIENT_DATA Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L153

Parameters:

client_data_json (bytes) – ClientData serialized as JSON bytes.

client_data_json
dwVersion
pwszHashAlgId = 'SHA-256'
class fido2.client.win_api.WebAuthNRpEntityInformation(rp)

Bases: ctypes.Structure

Maps to WEBAUTHN_RP_ENTITY_INFORMATION Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L98

Parameters:

rp (Mapping[str, Any]) – Dict of RP information.

dwVersion
pwszId
pwszName
pwszIcon
class fido2.client.win_api.WebAuthNUserEntityInformation(user)

Bases: ctypes.Structure

Maps to WEBAUTHN_USER_ENTITY_INFORMATION Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L127

Parameters:

user (Mapping[str, Any]) – Dict of User information.

id
dwVersion
pwszName
pwszIcon
pwszDisplayName
class fido2.client.win_api.WebAuthNCredentialEx(cred)

Bases: ctypes.Structure

Maps to WEBAUTHN_CREDENTIAL_EX Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L250

Parameters:

cred (Mapping[str, Any]) – Dict of Credential Descriptor data.

id
dwVersion
pwszCredentialType
dwTransports
class fido2.client.win_api.WebAuthNCredentialList(credentials)

Bases: ctypes.Structure

Maps to WEBAUTHN_CREDENTIAL_LIST Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L261

Parameters:

credentials (Sequence[Mapping[str, Any]]) – List of dict of Credential Descriptor data.

cCredentials
ppCredentials
class fido2.client.win_api.WebAuthNHmacSecretSalt(first, second=None)

Bases: ctypes.Structure

Structure base class

Parameters:
first
second
class fido2.client.win_api.WebAuthNCredWithHmacSecretSalt(cred_id, salt)

Bases: ctypes.Structure

Structure base class

Parameters:
cred_id
pHmacSecretSalt
class fido2.client.win_api.WebAuthNHmacSecretSaltValues(global_salt, credential_salts=[])

Bases: ctypes.Structure

Structure base class

Parameters:
cCredWithHmacSecretSaltList
pCredWithHmacSecretSaltList
class fido2.client.win_api.WebAuthNCredProtectExtensionIn(cred_protect, require_cred_protect)

Bases: ctypes.Structure

Maps to WEBAUTHN_CRED_PROTECT_EXTENSION_IN Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L493

Parameters:
dwCredProtect
bRequireCredProtect
class fido2.client.win_api.WebAuthNCredBlobExtension(blob)

Bases: ctypes.Structure

Structure base class

Parameters:

blob (bytes)

cred_blob
class fido2.client.win_api.WebAuthNExtension(identifier, value)

Bases: ctypes.Structure

Maps to WEBAUTHN_EXTENSION Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L317

Parameters:
  • identifier (str)

  • value (Any)

pwszExtensionIdentifier
cbExtension
pvExtension
class fido2.client.win_api.WebAuthNExtensions(extensions)

Bases: ctypes.Structure

Maps to WEBAUTHN_EXTENSIONS Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L324

Parameters:

extensions (Sequence[WebAuthNExtension])

cExtensions
pExtensions
class fido2.client.win_api.WebAuthNCredential(cred)

Bases: ctypes.Structure

Maps to WEBAUTHN_CREDENTIAL Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L212

Parameters:

cred (Mapping[str, Any]) – Dict of Credential Descriptor data.

id
pwszCredentialType
class fido2.client.win_api.WebAuthNCredentials(credentials)

Bases: ctypes.Structure

Maps to WEBAUTHN_CREDENTIALS Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L219

Parameters:

credentials (Sequence[Mapping[str, Any]]) – List of dict of Credential Descriptor data.

cCredentials
pCredentials
class fido2.client.win_api.CtapCborHybridStorageLinkedData

Bases: ctypes.Structure

Maps to CTAPCBOR_HYBRID_STORAGE_LINKED_DATA Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L356

contact_id
public_key
class fido2.client.win_api.WebAuthNGetAssertionOptions(timeout=0, attachment=WebAuthNAuthenticatorAttachment.ANY, uv_requirement=WebAuthNUserVerificationRequirement.DISCOURAGED, credentials=[], cancellationId=None, cred_large_blob_operation=WebAuthNLargeBlobOperation.NONE, cred_large_blob=None, hmac_secret_salts=None, extensions=[], flags=0, u2f_appid=None, u2f_appid_used=None)

Bases: ctypes.Structure

Maps to WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L452

Parameters:
  • timeout (int) – Time that the operation is expected to complete within. This is used as guidance, and can be overridden by the platform.

  • attachment (int) – Platform vs Cross-Platform Authenticators.

  • uv_requirement (int) – User Verification Requirement.

  • credentials (Sequence[Mapping[str, Any]]) – Allowed Credentials List.

  • cancellationId (GUID | None)

  • cred_large_blob_operation (int)

  • cred_large_blob (bytes | None)

  • hmac_secret_salts (WebAuthNHmacSecretSaltValues | None)

  • extensions (Sequence[WebAuthNExtension])

  • flags (int)

  • u2f_appid (str | None)

  • u2f_appid_used (ctypes.wintypes.BOOL | None)

cred_large_blob
json_ext
dwVersion
dwTimeoutMilliseconds = 0
dwAuthenticatorAttachment
dwUserVerificationRequirement
dwFlags = 0
class fido2.client.win_api.WebAuthNAssertion

Bases: ctypes.Structure

Maps to WEBAUTHN_ASSERTION Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L616

auth_data
signature
user_id
cred_large_blob
unsigned_extension_outputs
class fido2.client.win_api.WebAuthNMakeCredentialOptions(timeout=0, require_resident_key=False, attachment=WebAuthNAuthenticatorAttachment.ANY, uv_requirement=WebAuthNUserVerificationRequirement.DISCOURAGED, attestation_convoyence=WebAuthNAttestationConveyancePreference.ANY, credentials=[], cancellationId=None, enterprise_attestation=WebAuthNEnterpriseAttestation.NONE, large_blob_support=WebAuthNLargeBlobSupport.NONE, prefer_resident_key=False, enable_prf=False, extensions=[])

Bases: ctypes.Structure

maps to WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L394

Parameters:
  • timeout (int) – Time that the operation is expected to complete within.This is used as guidance, and can be overridden by the platform.

  • require_resident_key (bool) – Require key to be resident or not.

  • attachment (int) – Platform vs Cross-Platform Authenticators.

  • user_verification_requirement – User Verification Requirement.

  • attestation_convoyence (int) – Attestation Conveyance Preference.

  • credentials (Sequence[Mapping[str, Any]]) – Credentials used for exclusion.

  • uv_requirement (int)

  • cancellationId (GUID | None)

  • enterprise_attestation (int)

  • large_blob_support (int)

  • prefer_resident_key (bool)

  • enable_prf (bool)

  • extensions (Sequence[WebAuthNExtension])

json_ext
dwVersion
dwTimeoutMilliseconds = 0
bRequireResidentKey = False
dwAuthenticatorAttachment
dwUserVerificationRequirement
dwAttestationConveyancePreference
class fido2.client.win_api.WebAuthNCredentialAttestation

Bases: ctypes.Structure

Maps to WEBAUTHN_CREDENTIAL_ATTESTATION Struct.

https://github.com/microsoft/webauthn/blob/master/webauthn.h#L582

auth_data
attestation
attestation_object
credential_id
unsigned_extension_outputs
fido2.client.win_api.HRESULT
fido2.client.win_api.WEBAUTHN
fido2.client.win_api.WEBAUTHN_API_VERSION
fido2.client.win_api.WEBAUTHN_STRUCT_VERSIONS: Mapping[int, Mapping[str, int]]
fido2.client.win_api.get_version(class_name)

Get version of struct.

Parameters:

class_name (str) – Struct class name.

Returns:

Version of Struct to use.

Return type:

int