Capsule v1.5.2
Sealed dict serialization. Consumers can now serialize and deserialize complete sealed records without manual attribute extraction.
Added
Capsule.to_sealed_dict()— Serialize a Capsule including the cryptographic seal envelope (hash,signature,signature_pq,signed_at,signed_by). Returns everything fromto_dict()plus the five seal fields. Use this when building API responses or exporting complete sealed records.to_dict()continues to return only the canonical content (the part that gets hashed).Capsule.from_sealed_dict(data)— Inverse ofto_sealed_dict(). Deserializes both canonical content and seal envelope from a single dict. Missing seal keys default to empty values, so it also accepts plainto_dict()output. Enables full roundtrip:seal → to_sealed_dict → from_sealed_dict → verify.- 21 new tests across 4 test files — unit, integration, FastAPI, and invariant tests.
Fixed
- FastAPI endpoints omitting seal envelope —
GET /capsules/andGET /capsules/{id}were usingto_dict(), which excludes seal fields by design. Responses now useto_sealed_dict()and includehash,signature,signature_pq,signed_at, andsigned_byalongside the capsule content.
Install
pip install qp-capsule==1.5.2