File: parse_attestation_statement.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (26 lines) | stat: -rw-r--r-- 876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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