| 1 |
from .parse_attestation_statement import parse_attestation_statement |
| 2 |
from .parse_authenticator_data import parse_authenticator_data |
| 3 |
from .structs import AttestationObject |
| 4 |
from .parse_cbor import parse_cbor |
| 5 |
|
| 6 |
|
| 7 |
def parse_attestation_object(val: bytes) -> AttestationObject: |
| 8 |
""" |
| 9 |
Decode and peel apart the CBOR-encoded blob `response.attestationObject` into |
| 10 |
structured data. |
| 11 |
""" |
| 12 |
attestation_dict = parse_cbor(val) |
| 13 |
|
| 14 |
decoded_attestation_object = AttestationObject( |
| 15 |
fmt=attestation_dict["fmt"], |
| 16 |
auth_data=parse_authenticator_data(attestation_dict["authData"]), |
| 17 |
) |
| 18 |
|
| 19 |
if "attStmt" in attestation_dict: |
| 20 |
decoded_attestation_object.att_stmt = parse_attestation_statement( |
| 21 |
attestation_dict["attStmt"] |
| 22 |
) |
| 23 |
|
| 24 |
return decoded_attestation_object |