33
44from datetime import datetime
55from enum import Enum
6- from typing import List , Optional , Union
6+ from typing import List , Optional , Union , Mapping , Any
77from uuid import UUID
88
99from cryptography import x509
1010from cryptography .x509 import Certificate
1111from fido2 .cose import ES256 , PS256 , RS1 , RS256 , CoseKey , EdDSA
12- from fido2 .ctap2 import AttestationObject
1312from fido2 .utils import websafe_decode
13+ from fido2 .webauthn import AttestationObject
1414from pydantic import BaseModel , Field , validator
1515
1616__author__ = 'lundberg'
@@ -99,7 +99,7 @@ def validate_aaguid(cls, v: bytes) -> UUID:
9999 return UUID (bytes = v )
100100
101101 @validator ('public_key' , pre = True )
102- def validate_public_key (cls , v : bytes ) -> UUID :
102+ def validate_public_key (cls , v : Mapping [ int , Any ] ) -> CoseKey :
103103 return CoseKey .parse (v )
104104
105105
@@ -123,10 +123,8 @@ def validate_flags(cls, v: int) -> AuthenticatorFlags:
123123
124124class Attestation (AttestationConfig ):
125125 fmt : AttestationFormat
126- att_statement : AttestationStatement = Field (alias = 'attStmt' )
127- auth_data : AuthenticatorData = Field (alias = 'authData' )
128- ep_att : Optional [bytes ]
129- large_blob_key : Optional [bytes ]
126+ att_statement : AttestationStatement
127+ auth_data : AuthenticatorData
130128 raw_attestation_obj : bytes
131129
132130 @property
@@ -148,8 +146,12 @@ def attestation_obj(self) -> AttestationObject:
148146
149147 @classmethod
150148 def from_attestation_object (cls , data : AttestationObject ) -> Attestation :
151- d = dict ((k .string_key , v ) for k , v in data .data .items ())
152- d ['raw_attestation_obj' ] = bytes (data )
149+ d = {
150+ 'fmt' : data .fmt ,
151+ 'att_statement' : data .att_stmt ,
152+ 'auth_data' : data .auth_data ,
153+ 'raw_attestation_obj' : bytes (data ),
154+ }
153155 return cls .parse_obj (d )
154156
155157 @classmethod
0 commit comments