Skip to content

Commit 1e05ee3

Browse files
committed
handle upstream change to AttestationObject
1 parent 4250593 commit 1e05ee3

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/fido_mds/metadata_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _verify_attestation_as_type(
6060
fido2_attestation = attestation_type()
6161
try:
6262
fido2_attestation.verify(
63-
statement=attestation.attestation_obj.att_statement,
63+
statement=attestation.attestation_obj.att_stmt,
6464
auth_data=attestation.attestation_obj.auth_data,
6565
client_data_hash=client_data_hash,
6666
)

src/fido_mds/models/webauthn.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
from datetime import datetime
55
from enum import Enum
6-
from typing import List, Optional, Union
6+
from typing import List, Optional, Union, Mapping, Any
77
from uuid import UUID
88

99
from cryptography import x509
1010
from cryptography.x509 import Certificate
1111
from fido2.cose import ES256, PS256, RS1, RS256, CoseKey, EdDSA
12-
from fido2.ctap2 import AttestationObject
1312
from fido2.utils import websafe_decode
13+
from fido2.webauthn import AttestationObject
1414
from 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

124124
class 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

Comments
 (0)