| 1 |
from enum import Enum |
| 2 |
from dataclasses import dataclass, field |
| 3 |
from typing import List, Literal, Optional, Union |
| 4 |
|
| 5 |
from .cose import COSEAlgorithmIdentifier |
| 6 |
|
| 7 |
|
| 8 |
################ |
| 9 |
# |
| 10 |
# Fundamental data structures |
| 11 |
# |
| 12 |
################ |
| 13 |
|
| 14 |
|
| 15 |
class AuthenticatorTransport(str, Enum): |
| 16 |
"""How an authenticator communicates to the client/browser. |
| 17 |
|
| 18 |
Members: |
| 19 |
`USB`: USB wired connection |
| 20 |
`NFC`: Near Field Communication |
| 21 |
`BLE`: Bluetooth Low Energy |
| 22 |
`INTERNAL`: Direct connection (read: a platform authenticator) |
| 23 |
`CABLE`: Cloud Assisted Bluetooth Low Energy |
| 24 |
`HYBRID`: A combination of (often separate) data-transport and proximity mechanisms |
| 25 |
|
| 26 |
https://www.w3.org/TR/webauthn-2/#enum-transport |
| 27 |
""" |
| 28 |
|
| 29 |
USB = "usb" |
| 30 |
NFC = "nfc" |
| 31 |
BLE = "ble" |
| 32 |
INTERNAL = "internal" |
| 33 |
CABLE = "cable" |
| 34 |
HYBRID = "hybrid" |
| 35 |
|
| 36 |
|
| 37 |
class AuthenticatorAttachment(str, Enum): |
| 38 |
"""How an authenticator is connected to the client/browser. |
| 39 |
|
| 40 |
Members: |
| 41 |
`PLATFORM`: A non-removable authenticator, like TouchID or Windows Hello |
| 42 |
`CROSS_PLATFORM`: A "roaming" authenticator, like a YubiKey |
| 43 |
|
| 44 |
https://www.w3.org/TR/webauthn-2/#enumdef-authenticatorattachment |
| 45 |
""" |
| 46 |
|
| 47 |
PLATFORM = "platform" |
| 48 |
CROSS_PLATFORM = "cross-platform" |
| 49 |
|
| 50 |
|
| 51 |
class ResidentKeyRequirement(str, Enum): |
| 52 |
"""The Relying Party's preference for the authenticator to create a dedicated "client-side" credential for it. Requiring an authenticator to store a dedicated credential should not be done lightly due to the limited storage capacity of some types of authenticators. |
| 53 |
|
| 54 |
Members: |
| 55 |
`DISCOURAGED`: The authenticator should not create a dedicated credential |
| 56 |
`PREFERRED`: The authenticator can create and store a dedicated credential, but if it doesn't that's alright too |
| 57 |
`REQUIRED`: The authenticator MUST create a dedicated credential. If it cannot, the RP is prepared for an error to occur. |
| 58 |
|
| 59 |
https://www.w3.org/TR/webauthn-2/#enum-residentKeyRequirement |
| 60 |
""" |
| 61 |
|
| 62 |
DISCOURAGED = "discouraged" |
| 63 |
PREFERRED = "preferred" |
| 64 |
REQUIRED = "required" |
| 65 |
|
| 66 |
|
| 67 |
class UserVerificationRequirement(str, Enum): |
| 68 |
"""The degree to which the Relying Party wishes to verify a user's identity. |
| 69 |
|
| 70 |
Members: |
| 71 |
`REQUIRED`: User verification must occur |
| 72 |
`PREFERRED`: User verification would be great, but if not that's okay too |
| 73 |
`DISCOURAGED`: User verification should not occur, but it's okay if it does |
| 74 |
|
| 75 |
https://www.w3.org/TR/webauthn-2/#enumdef-userverificationrequirement |
| 76 |
""" |
| 77 |
|
| 78 |
REQUIRED = "required" |
| 79 |
PREFERRED = "preferred" |
| 80 |
DISCOURAGED = "discouraged" |
| 81 |
|
| 82 |
|
| 83 |
class AttestationConveyancePreference(str, Enum): |
| 84 |
"""The Relying Party's interest in receiving an attestation statement. |
| 85 |
|
| 86 |
Members: |
| 87 |
`NONE`: The Relying Party isn't interested in receiving an attestation statement |
| 88 |
`INDIRECT`: The Relying Party is interested in an attestation statement, but the client is free to generate it as it sees fit |
| 89 |
`DIRECT`: The Relying Party is interested in an attestation statement generated directly by the authenticator |
| 90 |
`ENTERPRISE`: The Relying Party is interested in a statement with identifying information. Typically used within organizations |
| 91 |
|
| 92 |
https://www.w3.org/TR/webauthn-2/#enum-attestation-convey |
| 93 |
""" |
| 94 |
|
| 95 |
NONE = "none" |
| 96 |
INDIRECT = "indirect" |
| 97 |
DIRECT = "direct" |
| 98 |
ENTERPRISE = "enterprise" |
| 99 |
|
| 100 |
|
| 101 |
class PublicKeyCredentialType(str, Enum): |
| 102 |
"""The type of credential that should be returned by an authenticator. There's but a single member because this is a specific subclass of a higher-level `CredentialType` that can be of other types. |
| 103 |
|
| 104 |
Members: |
| 105 |
`PUBLIC_KEY`: The literal string `"public-key"` |
| 106 |
|
| 107 |
https://www.w3.org/TR/webauthn-2/#enumdef-publickeycredentialtype |
| 108 |
""" |
| 109 |
|
| 110 |
PUBLIC_KEY = "public-key" |
| 111 |
|
| 112 |
|
| 113 |
class AttestationFormat(str, Enum): |
| 114 |
"""The "syntax" of an attestation statement. Formats should be registered with the IANA and include documented signature verification steps. |
| 115 |
|
| 116 |
Members: |
| 117 |
`PACKED` |
| 118 |
`TPM` |
| 119 |
`ANDROID_KEY` |
| 120 |
`ANDROID_SAFETYNET` |
| 121 |
`FIDO_U2F` |
| 122 |
`APPLE` |
| 123 |
`NONE` |
| 124 |
|
| 125 |
https://www.iana.org/assignments/webauthn/webauthn.xhtml |
| 126 |
""" |
| 127 |
|
| 128 |
PACKED = "packed" |
| 129 |
TPM = "tpm" |
| 130 |
ANDROID_KEY = "android-key" |
| 131 |
ANDROID_SAFETYNET = "android-safetynet" |
| 132 |
FIDO_U2F = "fido-u2f" |
| 133 |
APPLE = "apple" |
| 134 |
NONE = "none" |
| 135 |
|
| 136 |
|
| 137 |
class ClientDataType(str, Enum): |
| 138 |
"""Specific values included in authenticator registration and authentication responses to help avoid certain types of "signature confusion attacks". |
| 139 |
|
| 140 |
Members: |
| 141 |
`WEBAUTHN_CREATE`: The string "webauthn.create". Synonymous with `navigator.credentials.create()` in the browser |
| 142 |
`WEBAUTHN_GET`: The string "webauthn.get". Synonymous with `navigator.credentials.get()` in the browser |
| 143 |
|
| 144 |
https://www.w3.org/TR/webauthn-2/#dom-collectedclientdata-type |
| 145 |
""" |
| 146 |
|
| 147 |
WEBAUTHN_CREATE = "webauthn.create" |
| 148 |
WEBAUTHN_GET = "webauthn.get" |
| 149 |
|
| 150 |
|
| 151 |
class TokenBindingStatus(str, Enum): |
| 152 |
""" |
| 153 |
https://www.w3.org/TR/webauthn-2/#dom-tokenbinding-status |
| 154 |
""" |
| 155 |
|
| 156 |
PRESENT = "present" |
| 157 |
SUPPORTED = "supported" |
| 158 |
|
| 159 |
|
| 160 |
@dataclass |
| 161 |
class TokenBinding: |
| 162 |
""" |
| 163 |
https://www.w3.org/TR/webauthn-2/#dictdef-tokenbinding |
| 164 |
""" |
| 165 |
|
| 166 |
status: TokenBindingStatus |
| 167 |
id: Optional[str] = None |
| 168 |
|
| 169 |
|
| 170 |
@dataclass |
| 171 |
class PublicKeyCredentialRpEntity: |
| 172 |
"""Information about the Relying Party. |
| 173 |
|
| 174 |
Attributes: |
| 175 |
`name`: A user-readable name for the Relying Party |
| 176 |
(optional) `id`: A unique, constant value assigned to the Relying Party. Authenticators use this value to associate a credential with a particular Relying Party user |
| 177 |
|
| 178 |
https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialrpentity |
| 179 |
""" |
| 180 |
|
| 181 |
name: str |
| 182 |
id: Optional[str] = None |
| 183 |
|
| 184 |
|
| 185 |
@dataclass |
| 186 |
class PublicKeyCredentialUserEntity: |
| 187 |
"""Information about a user of a Relying Party. |
| 188 |
|
| 189 |
Attributes: |
| 190 |
`id`: An "opaque byte sequence" that uniquely identifies a user. Typically something like a UUID, but never user-identifying like an email address. Cannot exceed 64 bytes. These bytes should be stored internally alongside your normal user identifier and only used for WebAuthn. |
| 191 |
`name`: A value which a user can see to determine which account this credential is associated with. A username or email address is fine here. |
| 192 |
`display_name`: A user-friendly representation of a user, like a full name. |
| 193 |
|
| 194 |
https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialuserentity |
| 195 |
""" |
| 196 |
|
| 197 |
id: bytes |
| 198 |
name: str |
| 199 |
display_name: str |
| 200 |
|
| 201 |
|
| 202 |
@dataclass |
| 203 |
class PublicKeyCredentialParameters: |
| 204 |
"""Information about a cryptographic algorithm that may be used when creating a credential. |
| 205 |
|
| 206 |
Attributes: |
| 207 |
`type`: The literal string `"public-key"` |
| 208 |
`alg`: A numeric indicator of a particular algorithm |
| 209 |
|
| 210 |
https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialparameters |
| 211 |
""" |
| 212 |
|
| 213 |
type: Literal["public-key"] |
| 214 |
alg: COSEAlgorithmIdentifier |
| 215 |
|
| 216 |
|
| 217 |
@dataclass |
| 218 |
class PublicKeyCredentialDescriptor: |
| 219 |
"""Information about a generated credential. |
| 220 |
|
| 221 |
Attributes: |
| 222 |
`type`: The literal string `"public-key"` |
| 223 |
`id`: The sequence of bytes representing the credential's ID |
| 224 |
(optional) `transports`: The types of connections to the client/browser the authenticator supports |
| 225 |
|
| 226 |
https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialdescriptor |
| 227 |
""" |
| 228 |
|
| 229 |
id: bytes |
| 230 |
type: Literal[PublicKeyCredentialType.PUBLIC_KEY] = PublicKeyCredentialType.PUBLIC_KEY |
| 231 |
transports: Optional[List[AuthenticatorTransport]] = None |
| 232 |
|
| 233 |
|
| 234 |
@dataclass |
| 235 |
class AuthenticatorSelectionCriteria: |
| 236 |
"""A Relying Party's requirements for the types of authenticators that may interact with the client/browser. |
| 237 |
|
| 238 |
Attributes: |
| 239 |
(optional) `authenticator_attachment`: How the authenticator can be connected to the client/browser |
| 240 |
(optional) `resident_key`: Whether the authenticator should be able to store a credential on itself |
| 241 |
(optional) `require_resident_key`: DEPRECATED, set a value for `resident_key` instead |
| 242 |
(optional) `user_verification`: How the authenticator should be capable of determining user identity |
| 243 |
|
| 244 |
https://www.w3.org/TR/webauthn-2/#dictdef-authenticatorselectioncriteria |
| 245 |
""" |
| 246 |
|
| 247 |
authenticator_attachment: Optional[AuthenticatorAttachment] = None |
| 248 |
resident_key: Optional[ResidentKeyRequirement] = None |
| 249 |
require_resident_key: Optional[bool] = False |
| 250 |
user_verification: Optional[ |
| 251 |
UserVerificationRequirement |
| 252 |
] = UserVerificationRequirement.PREFERRED |
| 253 |
|
| 254 |
|
| 255 |
@dataclass |
| 256 |
class CollectedClientData: |
| 257 |
"""Decoded ClientDataJSON |
| 258 |
|
| 259 |
Attributes: |
| 260 |
`type`: Either `"webauthn.create"` or `"webauthn.get"`, for registration and authentication ceremonies respectively |
| 261 |
`challenge`: The challenge passed to the authenticator within the options |
| 262 |
`origin`: The base domain with protocol on which the registration or authentication ceremony took place (e.g. "https://foo.bar") |
| 263 |
(optional) `cross_origin`: Whether or not the the registration or authentication ceremony took place on a different origin (think within an <iframe>) |
| 264 |
(optional) `token_binding`: Information on the state of the Token Binding protocol |
| 265 |
|
| 266 |
https://www.w3.org/TR/webauthn-2/#dictdef-collectedclientdata |
| 267 |
""" |
| 268 |
|
| 269 |
type: ClientDataType |
| 270 |
challenge: bytes |
| 271 |
origin: str |
| 272 |
cross_origin: Optional[bool] = None |
| 273 |
token_binding: Optional[TokenBinding] = None |
| 274 |
|
| 275 |
|
| 276 |
################ |
| 277 |
# |
| 278 |
# Registration |
| 279 |
# |
| 280 |
################ |
| 281 |
|
| 282 |
|
| 283 |
@dataclass |
| 284 |
class PublicKeyCredentialCreationOptions: |
| 285 |
"""Registration Options. |
| 286 |
|
| 287 |
Attributes: |
| 288 |
`rp`: Information about the Relying Party |
| 289 |
`user`: Information about the user |
| 290 |
`challenge`: A unique byte sequence to be returned by the authenticator. Helps prevent replay attacks |
| 291 |
`pub_key_cred_params`: Cryptographic algorithms supported by the Relying Party when verifying signatures |
| 292 |
(optional) `timeout`: How long the client/browser should give the user to interact with an authenticator |
| 293 |
(optional) `exclude_credentials`: A list of credentials associated with the user to prevent them from re-enrolling one of them |
| 294 |
(optional) `authenticator_selection`: Additional qualities about the authenticators the user can use to complete registration |
| 295 |
(optional) `attestation`: The Relying Party's desire for a declaration of an authenticator's provenance via attestation statement |
| 296 |
|
| 297 |
https://www.w3.org/TR/webauthn-2/#dictdef-publickeycredentialcreationoptions |
| 298 |
""" |
| 299 |
|
| 300 |
rp: PublicKeyCredentialRpEntity |
| 301 |
user: PublicKeyCredentialUserEntity |
| 302 |
challenge: bytes |
| 303 |
pub_key_cred_params: List[PublicKeyCredentialParameters] |
| 304 |
timeout: Optional[int] = None |
| 305 |
exclude_credentials: Optional[List[PublicKeyCredentialDescriptor]] = None |
| 306 |
authenticator_selection: Optional[AuthenticatorSelectionCriteria] = None |
| 307 |
attestation: AttestationConveyancePreference = AttestationConveyancePreference.NONE |
| 308 |
|
| 309 |
|
| 310 |
@dataclass |
| 311 |
class AuthenticatorAttestationResponse: |
| 312 |
"""The `response` property on a registration credential. |
| 313 |
|
| 314 |
Attributes: |
| 315 |
`client_data_json`: Information the authenticator collects about the client/browser it communicates with |
| 316 |
`attestation_object`: Encoded information about an attestation |
| 317 |
(optional) `transports`: The authenticator's supported methods of communication with a client/browser |
| 318 |
|
| 319 |
https://www.w3.org/TR/webauthn-2/#authenticatorattestationresponse |
| 320 |
""" |
| 321 |
|
| 322 |
client_data_json: bytes |
| 323 |
attestation_object: bytes |
| 324 |
# Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation |
| 325 |
transports: Optional[List[AuthenticatorTransport]] = None |
| 326 |
|
| 327 |
|
| 328 |
@dataclass |
| 329 |
class RegistrationCredential: |
| 330 |
"""A registration-specific subclass of PublicKeyCredential returned from `navigator.credentials.create()` |
| 331 |
|
| 332 |
Attributes: |
| 333 |
`id`: The Base64URL-encoded representation of raw_id |
| 334 |
`raw_id`: A byte sequence representing the credential's unique identifier |
| 335 |
`response`: The authenticator's attesation data |
| 336 |
`type`: The literal string `"public-key"` |
| 337 |
|
| 338 |
https://www.w3.org/TR/webauthn-2/#publickeycredential |
| 339 |
""" |
| 340 |
|
| 341 |
id: str |
| 342 |
raw_id: bytes |
| 343 |
response: AuthenticatorAttestationResponse |
| 344 |
authenticator_attachment: Optional[AuthenticatorAttachment] = None |
| 345 |
type: Literal[PublicKeyCredentialType.PUBLIC_KEY] = PublicKeyCredentialType.PUBLIC_KEY |
| 346 |
|
| 347 |
|
| 348 |
@dataclass |
| 349 |
class AttestationStatement: |
| 350 |
"""A collection of all possible fields that may exist in an attestation statement. Combinations of these fields are specific to a particular attestation format. |
| 351 |
|
| 352 |
https://www.w3.org/TR/webauthn-2/#sctn-defined-attestation-formats |
| 353 |
|
| 354 |
TODO: Decide if this is acceptable, or if we want to split this up into multiple |
| 355 |
format-specific classes that define only the fields that are present for a given |
| 356 |
attestation format. |
| 357 |
""" |
| 358 |
|
| 359 |
sig: Optional[bytes] = None |
| 360 |
x5c: Optional[List[bytes]] = None |
| 361 |
response: Optional[bytes] = None |
| 362 |
alg: Optional[COSEAlgorithmIdentifier] = None |
| 363 |
ver: Optional[str] = None |
| 364 |
cert_info: Optional[bytes] = None |
| 365 |
pub_area: Optional[bytes] = None |
| 366 |
|
| 367 |
|
| 368 |
@dataclass |
| 369 |
class AuthenticatorDataFlags: |
| 370 |
"""Flags the authenticator will set about information contained within the `attestationObject.authData` property. |
| 371 |
|
| 372 |
Attributes: |
| 373 |
`up`: [U]ser was [P]resent |
| 374 |
`uv`: [U]ser was [V]erified |
| 375 |
`be`: [B]ackup [E]ligible |
| 376 |
`bs`: [B]ackup [S]tate |
| 377 |
`at`: [AT]tested credential is included |
| 378 |
`ed`: [E]xtension [D]ata is included |
| 379 |
|
| 380 |
https://www.w3.org/TR/webauthn-2/#flags |
| 381 |
""" |
| 382 |
|
| 383 |
up: bool |
| 384 |
uv: bool |
| 385 |
be: bool |
| 386 |
bs: bool |
| 387 |
at: bool |
| 388 |
ed: bool |
| 389 |
|
| 390 |
|
| 391 |
@dataclass |
| 392 |
class AttestedCredentialData: |
| 393 |
"""Information about a credential. |
| 394 |
|
| 395 |
Attributes: |
| 396 |
`aaguid`: A 128-bit identifier indicating the type and vendor of the authenticator |
| 397 |
`credential_id`: The ID of the private/public key pair generated by the authenticator |
| 398 |
`credential_public_key`: The public key generated by the authenticator |
| 399 |
|
| 400 |
https://www.w3.org/TR/webauthn-2/#attested-credential-data |
| 401 |
""" |
| 402 |
|
| 403 |
aaguid: bytes |
| 404 |
credential_id: bytes |
| 405 |
credential_public_key: bytes |
| 406 |
|
| 407 |
|
| 408 |
@dataclass |
| 409 |
class AuthenticatorData: |
| 410 |
"""Context the authenticator provides about itself and the environment in which the registration or authentication ceremony took place. |
| 411 |
|
| 412 |
Attributes: |
| 413 |
`rp_id_hash`: A SHA-256 hash of the website origin on which the registration or authentication ceremony took place |
| 414 |
`flags`: Properties about the user and registration, where applicable |
| 415 |
`sign_count`: The number of times the credential was used |
| 416 |
(optional) `attested_credential_data`: Information about the credential created during a registration ceremony |
| 417 |
(optional) `extensions`: CBOR-encoded extension data corresponding to extensions specified in the registration or authentication ceremony options |
| 418 |
|
| 419 |
https://www.w3.org/TR/webauthn-2/#sctn-attestation |
| 420 |
https://www.w3.org/TR/webauthn-2/#sctn-attested-credential-data |
| 421 |
""" |
| 422 |
|
| 423 |
rp_id_hash: bytes |
| 424 |
flags: AuthenticatorDataFlags |
| 425 |
sign_count: int |
| 426 |
attested_credential_data: Optional[AttestedCredentialData] = None |
| 427 |
extensions: Optional[bytes] = None |
| 428 |
|
| 429 |
|
| 430 |
@dataclass |
| 431 |
class AttestationObject: |
| 432 |
"""Information about an attestation, including a statement and authenticator data. |
| 433 |
|
| 434 |
Attributes: |
| 435 |
`fmt`: The attestation statement's format |
| 436 |
`att_stmt`: An attestation statement to be verified according to the format |
| 437 |
`auth_data`: Contextual information provided by authenticator |
| 438 |
|
| 439 |
https://www.w3.org/TR/webauthn-2/#sctn-attestation |
| 440 |
""" |
| 441 |
|
| 442 |
fmt: AttestationFormat |
| 443 |
auth_data: AuthenticatorData |
| 444 |
att_stmt: AttestationStatement = field(default_factory=AttestationStatement) |
| 445 |
|
| 446 |
|
| 447 |
################ |
| 448 |
# |
| 449 |
# Authentication |
| 450 |
# |
| 451 |
################ |
| 452 |
|
| 453 |
|
| 454 |
@dataclass |
| 455 |
class PublicKeyCredentialRequestOptions: |
| 456 |
"""Authentication Options. |
| 457 |
|
| 458 |
Attributes: |
| 459 |
`challenge`: A unique byte sequence to be returned by the authenticator. Helps prevent replay attacks |
| 460 |
(optional) `timeout`: How long the client/browser should give the user to interact with an authenticator |
| 461 |
(optional) `rp_id`: The unique, constant identifier assigned to the Relying Party |
| 462 |
(optional) `allow_credentials`: A list of credentials associated with the user that they can use to complete the authentication |
| 463 |
(optional) `user_verification`: How the authenticator should be capable of determining user identity |
| 464 |
|
| 465 |
https://www.w3.org/TR/webauthn-2/#dictionary-assertion-options |
| 466 |
""" |
| 467 |
|
| 468 |
challenge: bytes |
| 469 |
timeout: Optional[int] = None |
| 470 |
rp_id: Optional[str] = None |
| 471 |
allow_credentials: Optional[List[PublicKeyCredentialDescriptor]] = None |
| 472 |
user_verification: Optional[ |
| 473 |
UserVerificationRequirement |
| 474 |
] = UserVerificationRequirement.PREFERRED |
| 475 |
|
| 476 |
|
| 477 |
@dataclass |
| 478 |
class AuthenticatorAssertionResponse: |
| 479 |
"""The `response` property on an authentication credential. |
| 480 |
|
| 481 |
Attributes: |
| 482 |
`client_data_json`: Information the authenticator collects about the client/browser it communicates with |
| 483 |
`authenticator_data`: Contextual information provided by authenticator |
| 484 |
`signature`: A byte sequence signed by the authenticator's private key, to be verified with a user's public key |
| 485 |
(optional) `user_handle`: The user ID specified for the user during attestation |
| 486 |
|
| 487 |
https://www.w3.org/TR/webauthn-2/#authenticatorassertionresponse |
| 488 |
""" |
| 489 |
|
| 490 |
client_data_json: bytes |
| 491 |
authenticator_data: bytes |
| 492 |
signature: bytes |
| 493 |
user_handle: Optional[bytes] = None |
| 494 |
|
| 495 |
|
| 496 |
@dataclass |
| 497 |
class AuthenticationCredential: |
| 498 |
"""An authentication-specific subclass of PublicKeyCredential. Returned from `navigator.credentials.get()` |
| 499 |
|
| 500 |
Attributes: |
| 501 |
`id`: The Base64URL-encoded representation of raw_id |
| 502 |
`raw_id`: A byte sequence representing the credential's unique identifier |
| 503 |
`response`: The authenticator's assertion data |
| 504 |
`type`: The literal string `"public-key"` |
| 505 |
|
| 506 |
https://www.w3.org/TR/webauthn-2/#publickeycredential |
| 507 |
""" |
| 508 |
|
| 509 |
id: str |
| 510 |
raw_id: bytes |
| 511 |
response: AuthenticatorAssertionResponse |
| 512 |
authenticator_attachment: Optional[AuthenticatorAttachment] = None |
| 513 |
type: Literal[PublicKeyCredentialType.PUBLIC_KEY] = PublicKeyCredentialType.PUBLIC_KEY |
| 514 |
|
| 515 |
|
| 516 |
################ |
| 517 |
# |
| 518 |
# Credential Backup State |
| 519 |
# |
| 520 |
################ |
| 521 |
|
| 522 |
|
| 523 |
class CredentialDeviceType(str, Enum): |
| 524 |
"""A determination of the number of devices a credential can be used from |
| 525 |
|
| 526 |
Members: |
| 527 |
`SINGLE_DEVICE`: A credential that is bound to a single device |
| 528 |
`MULTI_DEVICE`: A credential that can be used from multiple devices (e.g. passkeys) |
| 529 |
|
| 530 |
https://w3c.github.io/webauthn/#sctn-credential-backup (L3 Draft) |
| 531 |
""" |
| 532 |
|
| 533 |
SINGLE_DEVICE = "single_device" |
| 534 |
MULTI_DEVICE = "multi_device" |