Skip to content

feat(e2ee): add end-to-end HTTP payload encryption package#29

Merged
vitalvas merged 3 commits into
mainfrom
feat/e2ee-package
Jun 14, 2026
Merged

feat(e2ee): add end-to-end HTTP payload encryption package#29
vitalvas merged 3 commits into
mainfrom
feat/e2ee-package

Conversation

@vitalvas

@vitalvas vitalvas commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds e2ee, a new package implementing end-to-end encryption for HTTP API payloads per draft-vasylenko-e2ee-http. It protects request and response bodies independently of, and in addition to, TLS, so TLS-terminating intermediaries (CDNs, reverse proxies, load balancers) cannot read or tamper with payloads.

What's included

  • Crypto (Go standard library only): X25519 key agreement (RFC 7748), HKDF-SHA256 directional request/response keys (RFC 5869), AES-128/192/256-GCM envelope nonce || ciphertext || tag (NIST SP 800-38D).
  • E2EE-Session structured field (RFC 9651) with deterministic canonical serialization bound into the AES-GCM AAD, preventing intermediary tampering and response substitution.
  • Key discovery: /.well-known/encryption-keys JSON key set (ServerKeySet.Handler, FetchKeySet), validity windows, max_skew, fingerprints, and overlapping-key rotation.
  • Client: encrypting http.RoundTripper, fresh ephemeral key per request by default with an optional reusable Session, and response echo validation.
  • Server: mux middleware implementing the draft's full validation order; pluggable ReplayCache interface with an in-memory default.
  • Errors: RFC 9457 Problem Details with urn:ietf:params:e2ee:error:<code> types; internal errors never leaked.

Reuse

Reuses sibling kasper packages instead of reimplementing them: muxhandlers.ProblemDetails / WriteProblemDetails for RFC 9457, and mux.ResponseJSON + mux.ContentType* constants for JSON responses and media types. No new external dependencies (only the already-present github.com/google/uuid).

Testing

  • 100% statement coverage, race-clean.
  • yake run passes: golangci-lint 0 issues and all Go policy checks (string-concat, stdlib-wrapper, signature complexity, composite-literal, test-file naming, coverage).

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@vitalvas
vitalvas merged commit 1b2adc7 into main Jun 14, 2026
6 checks passed
@vitalvas
vitalvas deleted the feat/e2ee-package branch June 14, 2026 01:10
@jax-auto jax-auto Bot locked as resolved and limited conversation to collaborators Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant