Debian Codegraph @

addons/auth_passkey/_vendor/webauthn/helpers/parse_attestation_statement.py

raw
1 from .structs import AttestationStatement
2
3
4 def parse_attestation_statement(val: dict) -> AttestationStatement:
5 """
6 Turn `response.attestationObject.attStmt` into structured data
7 """
8 attestation_statement = AttestationStatement()
9
10 # Populate optional fields that may exist in the attestation statement
11 if "sig" in val:
12 attestation_statement.sig = val["sig"]
13 if "x5c" in val:
14 attestation_statement.x5c = val["x5c"]
15 if "response" in val:
16 attestation_statement.response = val["response"]
17 if "alg" in val:
18 attestation_statement.alg = val["alg"]
19 if "ver" in val:
20 attestation_statement.ver = val["ver"]
21 if "certInfo" in val:
22 attestation_statement.cert_info = val["certInfo"]
23 if "pubArea" in val:
24 attestation_statement.pub_area = val["pubArea"]
25
26 return attestation_statement