Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26 lines (22 sloc)
876 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from .structs import AttestationStatement | |
| def parse_attestation_statement(val: dict) -> AttestationStatement: | |
| """ | |
| Turn `response.attestationObject.attStmt` into structured data | |
| """ | |
| attestation_statement = AttestationStatement() | |
| # Populate optional fields that may exist in the attestation statement | |
| if "sig" in val: | |
| attestation_statement.sig = val["sig"] | |
| if "x5c" in val: | |
| attestation_statement.x5c = val["x5c"] | |
| if "response" in val: | |
| attestation_statement.response = val["response"] | |
| if "alg" in val: | |
| attestation_statement.alg = val["alg"] | |
| if "ver" in val: | |
| attestation_statement.ver = val["ver"] | |
| if "certInfo" in val: | |
| attestation_statement.cert_info = val["certInfo"] | |
| if "pubArea" in val: | |
| attestation_statement.pub_area = val["pubArea"] | |
| return attestation_statement |