Skip to content

Expose V2 Transport Error Kinds#1431

Draft
chavic wants to merge 3 commits intopayjoin:masterfrom
chavic:chavic/ohttp-hpke-error-variants-1273
Draft

Expose V2 Transport Error Kinds#1431
chavic wants to merge 3 commits intopayjoin:masterfrom
chavic:chavic/ohttp-hpke-error-variants-1273

Conversation

@chavic
Copy link
Copy Markdown
Collaborator

@chavic chavic commented Mar 20, 2026

Closes #1273.

This PR exports the v2 transport and crypto failure structure that already existed in core but was still opaque to bindings. Sender and receiver logic already distinguished malformed URLs, expired sessions, HPKE failures, OHTTP encapsulation or decapsulation failures, and bad directory responses, but the FFI boundary collapsed those into generic wrapper objects.

The change adds stable detail snapshots for HPKE, OHTTP encapsulation, and directory response failures, and threads those through the sender and receiver v2 error types. The goal is not to expose every internal enum directly, but to make the meaningful transport families and their useful details available through a stable cross-language API.

The result is that bindings can now tell whether a v2 failure is URL-related, expiration-related, HPKE-related, OHTTP-related, or directory-related, and can inspect enough detail to react appropriately. This also gives later metadata work a structured transport surface to build on instead of opaque errors.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Mar 20, 2026

Pull Request Test Coverage Report for Build 23742597522

Details

  • 140 of 169 (82.84%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 84.236%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/hpke.rs 23 30 76.67%
payjoin/src/core/ohttp.rs 42 49 85.71%
payjoin/src/core/receive/v2/error.rs 31 38 81.58%
payjoin/src/core/send/v2/error.rs 44 52 84.62%
Totals Coverage Status
Change from base Build 23607944477: 0.1%
Covered Lines: 10805
Relevant Lines: 12827

💛 - Coveralls

chavic added 3 commits March 30, 2026 12:40
Add stable kind and detail accessors for sender and receiver
v2 transport errors, including HPKE, OHTTP encapsulation, and
directory response failures.

The core library already distinguishes these failures internally,
but the FFI only exposed opaque wrapper objects. That forced
bindings to branch on display strings and hid useful detail such
as nested decapsulation causes, unexpected status codes, and
payload size limits. This preserves the private internal enums
while giving cross-language callers typed transport diagnostics.
Point the Dart generator dependency at the merged upstream fix\nfor object types ending in Error.\n\nThis replaces the temporary downstream workaround path with the\nupstream uniffi-dart revision that contains the naming fix, so the\nv2 transport bindings keep their original Error names.
Refresh the minimal and recent lockfiles after upgrading\nuniffi-dart to the upstream revision with the Dart naming fix.\n\nThis keeps the branch's resolved dependency graph aligned with the\nCargo.toml change used by CI and local testing.
@chavic chavic force-pushed the chavic/ohttp-hpke-error-variants-1273 branch from 1be621f to 4028da0 Compare March 30, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve OHTTP/HPKE error granularity in FFI bindings

2 participants