Skip to content

Commit

Permalink
Serialize lists of dataclasses to cbor
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Oct 9, 2024
1 parent c45a1ae commit dc315ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fido2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def _to_cbor(self) -> CborType:
value = getattr(self, f.name)
if hasattr(value, "_to_cbor"):
value = value._to_cbor()
elif isinstance(value, list) and all(hasattr(v, "_to_cbor") for v in value):
value = [v._to_cbor() for v in value]
if value is not None:
data[f.name] = value
return data
Expand Down

0 comments on commit dc315ba

Please sign in to comment.