Expose swift debug payload#283
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7350d5e. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR exposes a “plaintext bridge payload” JSON builder for native SDKs (Swift and Kotlin) via UniFFI/Rust, enabling integrators to inspect and assert the bridge payload contract before encryption/upload—aligned with the bridgeDebugPayload* naming direction used in JS.
Changes:
- Rust/UniFFI: Add
IDKitBuilder.bridge_debug_payload_json*APIs that serialize the existing request payload builder output (without creating a bridge request and without a timestamp). - Swift & Kotlin: Add builder wrapper methods to surface the new UniFFI APIs (
bridgeDebugPayloadJSON/bridgeDebugPayloadJson, plus preset variants). - Tests: Add Swift and Kotlin tests asserting the identity-check preset payload includes key contract fields and omits
timestamp.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| swift/Tests/IDKitTests/IDKitTests.swift | Adds a Swift test validating the identity-check plaintext bridge payload JSON contract. |
| swift/Sources/IDKit/IDKit.swift | Exposes new Swift IDKitBuilder methods to fetch plaintext bridge payload JSON (constraints + preset). |
| scripts/package-swift.sh | Adjusts Swift XCFramework header/modulemap staging to use ios_build/Headers/ root. |
| rust/core/src/bridge.rs | Implements UniFFI-exposed Rust methods to build/serialize plaintext bridge payload JSON without creating a request. |
| kotlin/bindings/src/test/kotlin/com/worldcoin/idkit/IDKitTests.kt | Adds a Kotlin test validating the identity-check plaintext bridge payload JSON contract. |
| kotlin/bindings/src/main/kotlin/com/worldcoin/idkit/IdKit.kt | Exposes new Kotlin IDKitBuilder methods for plaintext bridge payload JSON (constraints + preset). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…wift gets typed structs instead of raw json added BridgeDebugPayload (and related records) in bridge.rs with parsing from the existing build_request_payload wire json, plus bridge_debug_payload ffi methods on IDKitBuilder. swift now exposes bridgeDebugPayload on IDKit/IDKitBuilder for property access in tests and app code. kept the json-returning helpers as a fallback for logging or if you need the raw wire string. updated swift tests to assert on typed fields instead of JSONSerialization.
…it into expose-swift-debug-payload
…it into expose-swift-debug-payload

Summary
We wanted to expose raw payload fields to Swift developers of IDKit. Moreover, we wanted to expose the fields as native swift structs to catch possible errors at compile time.
Fix
Added UniFFI records in bridge.rs that map from the existing build_request_payload wire JSON via parse helpers, plus new bridge_debug_payload methods on IDKitBuilder. Swift now exposes bridgeDebugPayload on IDKit and IDKitBuilder so devs can dot into fields like proofRequest.proofRequests instead of parsing dictionaries. Kept the JSON-returning helpers as a fallback for logging or if you need the raw wire string. Updated the swift test to assert on typed fields instead of JSONSerialization.
Note
Medium Risk
Changes the shared bridge payload construction API and adds FFI debug surfaces that mirror live request fields; production connect flows are mostly unchanged but mistakes in the debug mapping could mislead integrators.
Overview
Adds offline bridge payload inspection so mobile SDKs can read the plaintext request that would be sent to the wallet bridge—without opening a connection—using typed structs instead of hand-parsing JSON.
In Rust,
build_request_payloadnow returnsBridgeRequestPayloadinternally andbuild_request_payload_jsonis the public JSON entry point (WASMnativePayloadfollows this). New UniFFI records (BridgeDebugPayload, nested proof/identity types) map from the same builder path, andIDKitBuildergainsbridge_debug_payload/bridge_debug_payload_json(plus preset variants).Swift wires this through internal
_bridgeDebugPayload/_bridgeDebugPayloadJSONonIDKitBuilderwith aDebugSpecification(preset vs constraints), plus small helpers for credential identifiers. Kotlin mirrors the same internal surface for bindings tests. Tests assert identity-check fields on typed payloads and that JSON stays aligned.Also adjusts Swift XCFramework packaging so UniFFI headers live at the framework headers root rather than under
IDKit/.Reviewed by Cursor Bugbot for commit e104f1c. Bugbot is set up for automated code reviews on this repo. Configure here.