Skip to content

Capsule v1.5.2

Choose a tag to compare

@bradleygauthier bradleygauthier released this 18 Mar 04:18
· 18 commits to main since this release
a8fb0b2

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 from to_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 of to_sealed_dict(). Deserializes both canonical content and seal envelope from a single dict. Missing seal keys default to empty values, so it also accepts plain to_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 envelopeGET /capsules/ and GET /capsules/{id} were using to_dict(), which excludes seal fields by design. Responses now use to_sealed_dict() and include hash, signature, signature_pq, signed_at, and signed_by alongside the capsule content.

Install

pip install qp-capsule==1.5.2