Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tuf/api/dsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def from_bytes(cls, data: bytes) -> SimpleEnvelope[T]:
except Exception as e:
raise DeserializationError from e

return envelope
return cast(SimpleEnvelope[T], envelope)

def to_bytes(self) -> bytes:
"""Return envelope as JSON bytes.
Expand Down
5 changes: 4 additions & 1 deletion tuf/api/serialization/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def serialize(self, signed_obj: Signed) -> bytes:
"""
try:
signed_dict = signed_obj.to_dict()
canonical_bytes = encode_canonical(signed_dict).encode("utf-8")
canon_str = encode_canonical(signed_dict)
# encode_canonical cannot return None if output_function is not set
assert canon_str is not None # noqa: S101
canonical_bytes = canon_str.encode("utf-8")

except Exception as e:
raise SerializationError from e
Expand Down