File: parse_attestation_object.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 (24 lines) | stat: -rw-r--r-- 802 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
from .parse_attestation_statement import parse_attestation_statement
from .parse_authenticator_data import parse_authenticator_data
from .structs import AttestationObject
from .parse_cbor import parse_cbor


def parse_attestation_object(val: bytes) -> AttestationObject:
    """
    Decode and peel apart the CBOR-encoded blob `response.attestationObject` into
    structured data.
    """
    attestation_dict = parse_cbor(val)

    decoded_attestation_object = AttestationObject(
        fmt=attestation_dict["fmt"],
        auth_data=parse_authenticator_data(attestation_dict["authData"]),
    )

    if "attStmt" in attestation_dict:
        decoded_attestation_object.att_stmt = parse_attestation_statement(
            attestation_dict["attStmt"]
        )

    return decoded_attestation_object