diff --git a/webauthn/helpers/parse_backup_flags.py b/webauthn/helpers/parse_backup_flags.py index 05f0868..216e836 100644 --- a/webauthn/helpers/parse_backup_flags.py +++ b/webauthn/helpers/parse_backup_flags.py @@ -1,24 +1,10 @@ from enum import Enum from pydantic import BaseModel -from .structs import AuthenticatorDataFlags +from .structs import AuthenticatorDataFlags, CredentialDeviceType from .exceptions import InvalidBackupFlags -class CredentialDeviceType(str, Enum): - """A determination of the number of devices a credential can be used from - - Members: - `SINGLE_DEVICE`: A credential that is bound to a single device - `MULTI_DEVICE`: A credential that can be used from multiple devices (e.g. passkeys) - - https://w3c.github.io/webauthn/#sctn-credential-backup (L3 Draft) - """ - - SINGLE_DEVICE = "single_device" - MULTI_DEVICE = "multi_device" - - class ParsedBackupFlags(BaseModel): credential_device_type: CredentialDeviceType credential_backed_up: bool diff --git a/webauthn/helpers/structs.py b/webauthn/helpers/structs.py index 1fd801c..23f12ed 100644 --- a/webauthn/helpers/structs.py +++ b/webauthn/helpers/structs.py @@ -56,6 +56,7 @@ def _validate_bytes_fields(cls, v, field: ModelField): # values return v + ################ # # Fundamental data structures @@ -545,3 +546,24 @@ class AuthenticationCredential(WebAuthnBaseModel): type: Literal[ PublicKeyCredentialType.PUBLIC_KEY ] = PublicKeyCredentialType.PUBLIC_KEY + + +################ +# +# Credential Backup State +# +################ + + +class CredentialDeviceType(str, Enum): + """A determination of the number of devices a credential can be used from + + Members: + `SINGLE_DEVICE`: A credential that is bound to a single device + `MULTI_DEVICE`: A credential that can be used from multiple devices (e.g. passkeys) + + https://w3c.github.io/webauthn/#sctn-credential-backup (L3 Draft) + """ + + SINGLE_DEVICE = "single_device" + MULTI_DEVICE = "multi_device"