Skip to content

Commit

Permalink
Add types to constructors of webauthn data objects (close #205)
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Mar 5, 2024
1 parent de1be49 commit f1952ae
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fido2/webauthn.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@


class Aaguid(bytes):
def __init__(self, data):
if len(data) != 16:
def __init__(self, data: bytes):
if len(self) != 16:
raise ValueError("AAGUID must be 16 bytes")

def __bool__(self):
Expand Down Expand Up @@ -84,7 +84,7 @@ class AttestedCredentialData(bytes):
credential_id: bytes
public_key: CoseKey

def __init__(self, _):
def __init__(self, _: bytes):
super().__init__()

parsed = AttestedCredentialData._parse(self)
Expand Down Expand Up @@ -196,7 +196,7 @@ class FLAG(IntFlag):
credential_data: Optional[AttestedCredentialData]
extensions: Optional[Mapping]

def __init__(self, _):
def __init__(self, _: bytes):
super().__init__()

reader = ByteBuffer(self)
Expand Down Expand Up @@ -288,7 +288,7 @@ class AttestationObject(bytes): # , Mapping[str, Any]):
auth_data: AuthenticatorData
att_stmt: Mapping[str, Any]

def __init__(self, _):
def __init__(self, _: bytes):
super().__init__()

data = cast(Mapping[str, Any], cbor.decode(bytes(self)))
Expand Down Expand Up @@ -344,7 +344,7 @@ class TYPE(str, Enum):
origin: str
cross_origin: bool = False

def __init__(self, *args):
def __init__(self, _: bytes):
super().__init__()

data = json.loads(self.decode())
Expand Down

0 comments on commit f1952ae

Please sign in to comment.