Skip to content

fix: match figma relay section on pubky auth - #1502

Merged
jvsena42 merged 7 commits into
masterfrom
fix/pubky-auth-relay-url
Nov 27, 2026
Merged

jvsena42 merged 7 commits into
masterfrom
fix/pubky-auth-relay-url

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Twin: synonymdev/bitkit-android#2075

Changes the relay section of the Pubky auth approval sheet to the Figma "Authorize paykit" frame: RELAY label, globe icon, full relay URL with its path. iOS showed only the origin under "AUTHORIZATION RELAY". Related: synonymdev/bitkit-android#1505.

Description

  • PubkyAuthRequest.relayOrigin becomes relayDisplayUrl: scheme, lower-cased host, port, path and query of the request's relay URL. User info and fragment are left out, so https://trusted.example@relay.example/ cannot pass for trusted.example. It is read the way the Pubky SDK's URL parser reads it; a relay that cannot be read that way with certainty (backslash, non-ASCII, percent-encoded or numeric host, no host) makes the request invalid, so the section is never missing for a request that has a relay.
  • PubkyAuthApprovalSheet: the section moves below the requested permissions, with a divider between sections, and shows the caption, a 16pt globe icon and the URL in the same row layout as the permission rows. The URL wraps instead of truncating and is selectable. The accessibility id stays PubkyAuthRelayOrigin (shared with Android).
  • pubky_auth__authorization_relay changes from "AUTHORIZATION RELAY" to "RELAY" in English and the 14 other locales.
  • open-signin-link.xml expects the full relay URL.
  • New rejection: a request with an unreadable relay is refused as an invalid request (before this PR such a relay was silently not shown). Nothing else about approval or signing changes.

Out of Scope

  • PubkyAuthApprovalSheet.swift: the rest of the "Authorize paykit" frame (folder/permission icon header, swipe to authorize, avatar in the header). Only the relay block, the section order and the dividers are taken from it.
  • Dimming the relay path and query so the host stands out: Figma draws one text style.
  • Localizable.strings: the unused pubky_auth__watch_only_intro_relay translations left behind by 47aa7a8cd.

Design

Authorize paykit in the Auth (paykit) flow: the Relay block (Section Header, 16px globe icon, 4px gap, URL in Body S semibold). Figma shows a one-line URL and no long-URL state; long URLs wrap.

Preview

Pending device run.

QA Notes

Setup

Debug simulator build (regtest), wallet onboarded, a Pubky profile created in Bitkit. The links below are dummy requests: do not tap Authorize.

xcrun simctl openurl <UDID> "bitkit://pubky-auth/signin?caps=/pub/locks.app/:rw&relay=https%3A%2F%2Fhttprelay.pubky.app%2Finbox%2F&secret=e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3s&cid=locks.test&cpk=5jsjx1o6fzu6aeeo697r3i5rx15zq41kikcye8wtwdqm4nb4tryo"

Journeys

  • J1: updated open-signin-link.xml — the relay (PubkyAuthRelayOrigin) shows https://httprelay.pubky.app/inbox/ next to a globe icon under the RELAY label, below the requested permissions

Manual Tests

  • 1. Same link with a long relay path → the URL wraps, nothing is cut off, long-press offers Copy — J1 covers only the short URL
  • 2. Same link with relay=https%3A%2F%2Ftrusted.example%40httprelay.pubky.app%2Finbox%2F → https://httprelay.pubky.app/inbox/, no trusted.example@
  • 3. Same link with relay=https%3A%2F%2Fevil.example%5C%40httprelay.pubky.app%2Flink → the sheet shows https://evil.example/@httprelay.pubky.app/link, or the invalid-request toast; never a URL starting with https://httprelay.pubky.app
  • 4. Same link with relay=https%3A%2F%2Fhttprelay.pubky.app%2Fa%7Cb%2F%5Bc%5D%2F → the RELAY section is present (or the invalid-request toast); never a sheet without it

Automated Checks

  • updated PubkyAuthRequestTests.swift — the relay display URL keeps scheme, lower-cased host, port, path and query and drops user info and fragment; relays with a backslash, raw IDN, percent-encoded or numeric host, or no host are unreadable and make a Ring signup request invalid; a request has a relay display URL whenever it has a relay

Evidence

Device screenshots: pending device run

Local checks at d7042c1bf:

  • xcodebuild test -scheme Bitkit -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 17' -only-testing:BitkitTests — 4634 passed, 5 failed. The 5 failures are AddressTypeIntegrationTests (3) and UtxoSelectionTests (2), which need a local regtest electrs ("LocalRegtest funds the local bitcoind, but the node syncs from ssl://electrs.bitkit.stag0…"); they do not touch this change. PubkyAuthRequestTests and PubkyAuthApprovalSheetTests passed.
  • swiftformat --lint on the changed Swift files — 0 files require formatting.
  • node scripts/validate-translations.js — 0 errors.

After review round 2: xcodebuild test with -only-testing for PubkyAuthRequestTests, PubkyAuthApprovalSheetTests and PubkyAuthURLSchemeTests — TEST SUCCEEDED; swiftformat --lint clean. The full BitkitTests run above was at d7042c1bf.

Gaps

  • No simulator run of the app yet; J1 and cases 1–4 are unverified on a device.
  • The 5 local-regtest integration tests above did not run meaningfully on this machine.
  • The section-level check is at the model level (a request with a relay always yields a display URL); there is no UI test for the sheet.

Review

An independent review (fresh agent, no implementation context) found two HIGH, three MEDIUM and several LOW items. All were checked against the code before changing anything.

  • H1/H2, relay shown differently from where the SDK sends, or not shown at all. The first version read the relay with the platform URL parser (URLComponents), which disagrees with the Rust url crate that delivers the grant: a backslash before @, raw IDN and numeric hosts displayed another host, and characters such as | or [ made the section disappear while the request stayed approvable. Fixed: displayRelay extracts the authority the WHATWG way (text between :// and the first /, ? or #, everything through the last @ dropped) and accepts only what Rust leaves unchanged: printable ASCII without backslash or space, a plain host or bracketed IPv6, and no numeric host other than a dotted IPv4. A request whose relay is set but cannot be read this way is now an invalid request, so the sheet never opens for it. The section shows whenever a request has a relay.
  • M1/M2, overlap with the spk PR. This PR's tests no longer use the memberwise PubkyAuthRequest initializer, which fix: refuse pubky auth requests for another pubky #1492 extends with expectedSigner; they call displayRelay and parse(url:). The two PRs still touch neighbouring lines in the same files.
  • M3, tests. Added cases for backslash, IDN (raw and punycode), | and brackets in the path, IPv6, trailing dot, percent-encoded host, numeric hosts, the Ring signup raw path, and "relay set but unreadable" (invalid, not hidden).
  • LOW, section order. RELAY now sits below the requested permissions with a divider between sections, as in Figma. The divider has 12 above and below, the padding the Figma Relay and Details frames use.
  • LOW, dimming the path. Not done: Figma draws the URL in one text style.
  • LOW, RTL. Left to the device run.

Round 2 found no HIGH.

  • MEDIUM, dot segments on the Ring signup path. Real: the raw relay was shown as written while the url crate delivers to the resolved path. A relay with a . or .. path segment, in any %2e spelling, is now unreadable, so the request is invalid.
  • LOW, show only what the crate keeps. Also unreadable now: ports above 65535, zero-padded ports, the scheme's default port, non-canonical IPv6, and the characters the crate percent-encodes (narrowed per component in the review round below). A relay without a path is shown with the root path the crate adds (https://host/).
  • LOW, tests. Added @ in the query and after #, upper-case scheme, port 0, port above 65535, default port, dot segments, non-canonical IPv6 and localhost:port.

Round 3 found no HIGH or MEDIUM and no behaviour bugs, only test gaps. Added rows for <, > and a backtick, %2e and .%2E segments, a default port on an IPv6 host, port 65535, upper-case and IPv4-mapped IPv6, and ..;x / ..%2f segments that are not dot segments. The targeted test class passed.

Merge order. This PR and #1492 edit neighbouring lines of the same files. Merge this PR first; #1492 then needs a rebase, keeping both sides of each conflict.

Review round, 2026-11-27.

  • piotr-iohk LOW (inline thread) and ovi-reviewer MEDIUM (review on 02355e40d), relay check too strict: real, fixed in 01415bed7 (twin of fix: show relay on pubky auth approval bitkit-android#2075 08420a11c). The filter rejected ', ^, {, } and a backtick anywhere, although rust-url 2.5.8 keeps ', ^, |, [, ] unchanged in a path and {, }, ^, backtick, | and \ unchanged in an http(s) query. The check is now per component: the path rejects ", <, >, backtick, {, } and \ (its PATH set, plus the backslash it turns into /); the query rejects ", <, > and ' (SPECIAL_QUERY); a backslash before the query is rejected. My earlier statement that the filter only affected raw Ring signup relays was wrong and is removed.
  • New tests: a row per character and component, accepted and rejected. PubkyAuthRequestTests and PubkyAuthApprovalSheetTests pass (93 tests, read from the result bundle); swiftformat clean.
  • Not re-driven on a device: the reviewer's Case 14 (/inbox/?token={abc}, /inbox/o'connor, /inbox/a^b, backtick and backslash in the query) needs a run on this head.

Models used

  • Planning/scoping: claude-fable-5-2 (reasoning: Not exposed)
  • Implementation: claude-fable-5-2 (reasoning: Not exposed)
  • Review: claude-fable-5-2 (reasoning: Not exposed)
  • Review rounds: 3

Metadata note: the sessions report the model id but no reasoning setting; the reviewer model is as reported by the coordinating session.

Device check at 01415be

iPhone 17 simulator (iOS 26.5), Debug build installed over the same wallet with a profile. Authorize never tapped; each sheet cancelled. Links open through the system "Open in Bitkit?" prompt, which I accepted.

Case Result Notes Screenshot
1 relay shown PASS RELAY caption, globe icon, https://httprelay.pubky.app/inbox/, below the permissions. ios r6 auth relay case 1
14 punctuation PASS (5 of 5) RELAY shows ...?token={abc}, .../o'connor, .../a^b, ...?token=a`b, ...?token=a\b; the sheet opened each time. ios r6 case 14 braces ios r6 case 14 apostrophe ios r6 case 14 caret

🤖 Generated with Claude Code

Review round, 2026-11-27 (merge)

  • Merged origin/master in c9332b956 after the twin PR merged. Both sides of the conflicts are kept.
  • New test testExpectedSignerAndRelayRulesHoldTogether (PubkyAuthApprovalSheetTests) checks that spk refusal and the relay rules work together.
  • Auth test classes pass after the merge.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jvsena42 jvsena42 self-assigned this Nov 26, 2026
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
jvsena42 and others added 2 commits November 26, 2026 13:32
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 26, 2026 17:29
@jvsena42
jvsena42 requested review from a team, ovitrif and piotr-iohk and removed request for a team November 26, 2026 17:29
@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable new issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issue was found.

Summary

Updates the Pubky approval sheet to show the relay’s full address beside a globe icon.

  • Pubky requests are rejected when their relay address cannot be shown clearly.
  • The approval sheet shows the full relay address below the requested permissions.

The previous-review merge bases differed, so the full PR was reviewed. Tests and simulator captures were not run in this Linux environment.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mas..." · Reviewed by Greptile

@talosmachina talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings. Replaces the relay origin with the full relay URL (relayDisplayUrl), refuses a request whose relay cannot be shown the way the SDK's URL parser reads it, and restyles the section to the Figma block below the permissions. Reviewed 7115c8d, full tier.

What I checked, and 4 candidates I ruled out

Read in full: the diff of PubkyAuthRequest.swift (displayRelay, isUnchangedRelayHostPort, isCanonicalIpv6), approvalDetails and relaySection in PubkyAuthApprovalSheet.swift, the updated PubkyAuthRequestTests.swift, open-signin-link.xml
Call sites traced: relayDisplayUrl (sheet only), makeRequest from parse(url:) and parseSignup
CI: SwiftFormat, translations validate and Greptile green; Run Tests, Run Integration Tests and build-local pending.
Build: Not built here: iOS does not build on Linux, so this review is reasoned from the code and from CI.

Ruled out

  • User info disguising the host: the authority is cut at the first /, ? or # and everything through its last @ is dropped, so https://trusted.example@relay/ shows relay, and a backslash is refused before that split.
  • An approvable request with no relay shown: makeRequest throws invalidUrl when relay is set and displayRelay returns nil; the only empty relay is the non-authorizing signup, which delivers nothing.
  • Control or bidi characters in the shown URL: only printable ASCII passes displayRelay, and the text also goes through pubkyAuthLiteralText.
  • Divider layout: dividers appear only between two present sections (permissions/relay/details), so no leading or trailing divider in any combination.

Merge confidence: 4/5, CI has not finished (Run Tests pending); the parser is covered by the new PubkyAuthRequestTests cases.

Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: Not exposed (the run reports the model id only)

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA review

Scope: full PR diff against its merge base, at 7115c8d.

No new actionable code findings.

No new actionable code findings across the relay parsing/validation model, approval sheet layout, 15 locale updates, journey spec, and changelog fragment. PubkyAuthRequest.displayRelay(_:) aligns with WHATWG URL parsing used by the pinned Rust SDKs (paykit-rs at 0b9c63d, bitkit-core at 045c7ff), strips userinfo and fragments, rejects ambiguous or SDK-rewritten relay forms fail-closed in makeRequest, and guarantees relayDisplayUrl is non-nil whenever relay is non-empty. PubkyAuthApprovalSheet preserves the PubkyAuthRelayOrigin accessibility identifier, renders the section cleanly across permissions/relay/details combinations without stray dividers, and sanitizes text via pubkyAuthLiteralText.

Parity and companion checks: Compared against the Android twin synonymdev/bitkit-android#2075 at 02355e4: displayRelay validation rules, section order (permissions -> divider -> relay -> divider -> details), 12pt/12dp divider padding, 16pt/16dp white globe icon, wrapping selectable URL with PubkyAuthRelayOrigin, and localized labels match across platforms. Android additionally checks relayDisplayUrl when re-parsing authUrl in its ViewModel; iOS passes the immutable parsed PubkyAuthRequest on PubkyAuthApprovalSheetItem directly into PubkyService.approveAuthRequest / approveSignupAuth. Checked synonymdev/bitkit-e2e-tests and confirmed no Appium selectors or assertions reference PubkyAuthRelayOrigin or AUTHORIZATION RELAY.

Validation and limitations: Ran node scripts/validate-translations.js locally on 7115c8d (0 errors) and verified displayRelay / IPv4 / IPv6 / dot-segment edge cases independently. On CI at 7115c8d, SwiftFormat and validate passed, while Run Tests, Run Integration Tests, and build-local are still in progress. Native Xcode compilation/unit tests could not run on this Linux host, and visual parity against the linked Figma frame was not verified via Figma MCP.

Recommended before device testing

  • Wait for Run Tests, Run Integration Tests, and build-local to finish green on 7115c8d.
  • During manual test 4 (relay=https%3A%2F%2Fhttprelay.pubky.app%2Fa%7Cb%2F%5Bc%5D%2F), double-check the rendered glyph for | since displayRelay preserves | while the PR preview note reported seeing /.

Suggested additional test cases

  • iOS — RTL layout (Arabic): Switch device/simulator language to Arabic (ar), open the dummy bitkit://pubky-auth/signin link from Setup, and verify المُرحّل, the globe icon, and https://httprelay.pubky.app/inbox/ render cleanly without clipping or text overlap.
  • iOS — Combined Paykit access + watch-only and direct signup dividers:
    • Open bitkit://pubky-auth/setup with caps=/pub/paykit/:rw and x-bitkit-claim=paykit-access-v1.watch-only-account-v1, tap Approve on the Earn intro, and verify the section order is REQUESTED PERMISSIONS -> divider -> RELAY -> divider -> DETAILS (PubkyAuthPaykitAccess), then cancel.
    • On a wallet without a Pubky identity, paste pubkyauth://direct_signup?hs=5jsjx1o6fzu6aeeo697r3i5rx15zq41kikcye8wtwdqm4nb4tryo in Scan -> Paste and verify the signup sheet renders with no RELAY section and no stray divider.
  • iOS — Ring signup fail-closed relay rejection: On a wallet without a Pubky identity, paste a pubkyring://signup link whose relay has a dot segment or default port (e.g., relay=https%3A%2F%2Frelay.example%2Finbox%2F..%2Fother%2F or relay=https%3A%2F%2Frelay.example%3A443%2Finbox%2F) via Scan -> Paste, and verify PubkyAuthInvalidRequestToast appears and the approval sheet does not open.

Device testing: not performed in this review. The author reports a Debug simulator run on iPhone 17 Pro (iOS 26.5) at 7115c8d passing preview cases 1–9 and 11–13 (with long-press Copy and RTL unverified).

Reviewer model: gemini-4-neon
Reasoning effort: high

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ✅ Approve

Findings: None.

QA for 7115c8d:

Debug regtest build on iPhone 17 Pro, iOS 27.0, dark mode. Dummy requests were cancelled before authorization.

Open and cancel a grant sign-in request ✅ J1: cold launch shows the full relay below permissions, stays open after five seconds, cancels, and rejects a duplicate secret.

J12x.2x.mp4

Copy a long relay URL ✅ Manual 1: the URL wraps without clipping and long-press offers Copy; selected text copied exactly, checked through the clipboard.

The complete URL also matched its accessibility label.

long2x.2x.mp4

Render a pipe and brackets in the relay path ✅ Manual 4: the section stays visible and renders /a|b/[c]/ literally.

pipe2x.2x.mp4

Read the relay in Arabic ✅ The Arabic label, globe and complete URL render without clipping or overlap.

rtl2x.2x.mp4

Show relay between permissions and Paykit details ✅ The combined watch-only and Paykit request shows both dividers in the expected order and cancels.

combined2x.2x.mp4

Figma reference on the left, implementation on the right. Comparison covers the relay block, section order and dividers. It uses the attached Figma image; the live Figma frame was unavailable.

Figma relay block and iOS implementation
Show direct signup without a relay ✅ A wallet without a Pubky identity shows no relay section or stray divider; Cancel returns Home.

signup2x.2x.mp4

Reject ambiguous Ring signup relays ✅ Raw dot-segment and default-port relays show “Invalid auth request” without opening consent.

rejection2x.2x.mp4

Check: build, parsing and translations ✅ Exact-head simulator build, focused Pubky auth tests, SwiftFormat and translation validation passed.

Ran PubkyAuthRequestTests, PubkyAuthApprovalSheetTests and PubkyAuthURLSchemeTests.

Not repeated: manual 2 (userinfo), manual 3 (backslash), host/port normalization, IDN and large-text checks rely on the author’s same-head evidence. The additional device checks above cover the gaps identified in the QA review. Signing and relay delivery were not exercised; they are outside this display/validation change. Other locales were validated structurally, with English and Arabic viewed on-device.

Pair PR: synonymdev/bitkit-android#2075 at 02355e4 matches the relay validation and section layout; Android was compared in code.

Full review of all 20 changed files in edce3cd..7115c8d, including both SDK grant and raw Ring signup paths.


Reviewed by gpt-6.1-sol-high

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@jvsena42
jvsena42 marked this pull request as draft November 27, 2026 08:23
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 27, 2026 09:28
@piotr-iohk

Copy link
Copy Markdown
Collaborator

@jvsena42 please resolve conflicts.

@ovitrif ovitrif added this to the 3.3.0 milestone Nov 27, 2026
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Moved to 3.3.0: this PR closes no issue, and its twin synonymdev/bitkit-android#2075 closes synonymdev/bitkit-android#1505, which is in 3.3.0.

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ✅ Approve

Findings: None. The component-specific filters accept punctuation the SDK preserves while continuing to reject ambiguous relay destinations.

QA for 01415be: Debug regtest build on iPhone 17 Pro, iOS 27.0, dark mode. Dummy requests were cancelled before authorization.

Validate raw Ring relay components ✅ Case 15: authority/path backslashes and a query apostrophe stay invalid; preserved query punctuation opens consent with the expected relay.

Opened raw pubkyring://signup links through Scan → Paste on a wallet without a Pubky identity:

  • An authority backslash, a path backslash and a query apostrophe each showed “Invalid auth request” without consent; all three also logged invalidUrl.
  • https://relay.example/inbox/?token=a\b opened consent with the URL unchanged.
  • https://relay.example?x={y}?a\b opened consent as https://relay.example/?x={y}?a\b, adding only the root slash.

Both accepted URLs matched PubkyAuthRelayOrigin in accessibility snapshots and cancelled back to Home. Profile still offered initial setup, checked in its accessibility snapshot.

case15-2x.2x.mp4

Check: build and Pubky auth validation ✅ The exact-head simulator build, focused auth tests and SwiftFormat passed.

Ran PubkyAuthRequestTests, PubkyAuthApprovalSheetTests and PubkyAuthURLSchemeTests, plus SwiftFormat 0.64.6 on both changed Swift files.

Not repeated: Case 14's five formerly rejected punctuation forms rely on the author's device evidence at 01415be. J1, long-URL selection/copy, pipe/bracket rendering, Arabic layout, section dividers, direct signup and dot-segment/default-port rejection retain the previous recorded review's passing evidence at 7115c8d; their successful inputs and presentation paths are unchanged. Signing and relay delivery were not driven because this delta changes display validation only. No planned case remains unrun.

Coverage: contiguous delta 7115c8d..01415be, both changed files, SDK grant and raw Ring signup callers, literal relay rendering and the corresponding rust-url component rules. No layout or translation changes in this delta.

Twin: synonymdev/bitkit-android#2075 at 08420a1 matches the component-specific fix; compared in code.



Reviewed by gpt-6.1-sol-high

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@jvsena42
jvsena42 marked this pull request as draft November 27, 2026 10:57
…y-url

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jvsena42

Copy link
Copy Markdown
Member Author

@piotr-iohk conflicts resolved: merged origin/master in c9332b9, keeping both sides in PubkyAuthRequest.makeRequest (the relay check and the spk parse). After the merge: PubkyAuthRequestTests, PubkyAuthApprovalSheetTests and PubkyAuthURLSchemeTests pass, swiftformat is clean and the translations validate. A new test, testExpectedSignerAndRelayRulesHoldTogether, checks that a request with a punctuated relay still opens the sheet with the relay when spk matches and is still refused when it names another pubky.

@jvsena42
jvsena42 marked this pull request as ready for review November 27, 2026 11:12
@jvsena42
jvsena42 requested a review from piotr-iohk November 27, 2026 11:12
@ovitrif ovitrif modified the milestones: 3.3.0, 3.2.0 Nov 27, 2026
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Moved to 3.2.0: its Android twin, synonymdev/bitkit-android#2075, merged before the 3.2.0 cut and ships in 3.2.0, so this one goes in a 3.2.0 build too, keeping both apps on the same relay section.

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA review

Scope: full PR at c9332b9, re-reviewed after the comparison base moved from edce3cd to af19cc1 (the earlier review no longer covered the files the base change touched). The merge base equals the base, and all 21 changed files were reassessed.

No new actionable code findings.

No actionable code findings. displayRelay now shows the relay's scheme, lower-cased host, port, path and query. It drops user info and the fragment, and makeRequest rejects any non-empty relay it cannot display. For SDK-parsed sign-in requests the relay passed in is the SDK's own params.relay.to_string() (paykit-rs 0b9c63d), so canonical relays are displayed as is. On the raw Ring and pubkyauth://signup paths, only relays the SDK would keep unchanged are accepted. The sheet and PubkyService approval use the same parsed PubkyAuthRequest, so the URL shown is the one that gets signed. The new rejection only produces the existing PubkyAuthInvalidRequestToast in handlePubkyAuthApproval, or stops the clipboard prompt from recognising the link; this change is intentional and documented in the PR description.

Validation:

  • I compiled the pinned displayRelay and its helpers with Swift 6.4.2 on Linux and compared it against Node 24's WHATWG URL on 150,000 generated relay strings.
  • Every relay Swift displayed matched the WHATWG reading with user info and fragment removed, apart from ^ in a path. WHATWG encodes ^ there, but rust-url v2.5.8's PATH set, the version locked in paykit-rs, does not, so Swift agrees with the SDK.
  • The only already-canonical inputs Swift rejected had unusual host characters (!, $, ;, ,, }): a deliberate fail-closed choice.
  • Limits: rust-url itself could not be run (crates.io unreachable in the sandbox), and the app was not built and XCTest was not run here.
  • CI at this head: SwiftFormat and translation validate pass. Run Tests, Run Integration Tests and build-local were still in progress when checked.

Parity: compared with the Android twin synonymdev/bitkit-android#2075 at 08420a1. The displayRelay rules, the fail-closed check at parse time, the section order (permissions → divider → relay → divider → Paykit details), the 12pt dividers, the 16pt globe icon, the selectable wrapping URL and the PubkyAuthRelayOrigin id all match. Android also compares the relay when it re-parses at approval time; iOS doesn't need that because it signs the same immutable request it displayed.

Coverage: the new PubkyAuthRequestTests cases cover the display and rejection tables and Ring signup rejection. testExpectedSignerAndRelayRulesHoldTogether covers the spk check together with the relay check after the master merge. There is no UI test for section order; journey J1 (open-signin-link.xml) covers it.

Recommended before device testing

Suggested additional test cases

  • iOS, wallet without a Pubky identity: Scan → Paste pubkyauth://signup?hs=5jsjx1o6fzu6aeeo697r3i5rx15zq41kikcye8wtwdqm4nb4tryo&relay=https%3A%2F%2Frelay.example%3A443%2Finbox%2F&secret=e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3s&caps=%2Fpub%2Fexample.app%2F%3Arw. Expected: PubkyAuthInvalidRequestToast and no consent sheet. Then repeat with relay=https%3A%2F%2Frelay.example%2Finbox%2F. Expected: the signup sheet shows https://relay.example/inbox/ under RELAY; then cancel. This raw-relay signup path is separate from the Ring path exercised earlier.

Device testing: not performed in this review. Device evidence attributed to ovi-reviewer was recorded at 7115c8d and 01415be, before the master merge in c9332b9.

Reviewer model: claude-opus-5-5
Reasoning effort: high

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ✅ Approve

Findings: None.

QA for c9332b9: Debug regtest build on iPhone 17 Pro, iOS 27.0, dark mode. Dummy requests were cancelled before authorization.

Validate raw Pubky signup relay ✅ Case 16: a default-port relay is invalid; a canonical relay opens signup consent with the complete URL.

Through Scan → Paste on a wallet without a Pubky identity:

  • https://relay.example:443/inbox/ showed “Invalid auth request” without opening consent.
  • https://relay.example/inbox/ opened consent with that exact PubkyAuthRelayOrigin label, checked in the accessibility snapshot. Cancel returned without creating an identity; Profile still offered initial setup.

case16-2x.2x.mp4

Keep relay display and expected signer checks together ✅ Case 17: a matching signer opens consent with the punctuated relay; another signer and invalid signer parameters are refused.

The request used https://httprelay.pubky.app/inbox/o'connor?token={abc}:

  • With this wallet's spk, consent showed the complete relay unchanged and the matching profile key, checked in the accessibility snapshot; Cancel closed it.
  • Another spk showed “This request is for 8um7...1dty, not this wallet's pubky.” without consent.
  • Duplicate, prefixed and malformed spk each showed “Invalid auth request” without consent, confirmed in separate accessibility snapshots. No request was authorized.

case17-2x.2x.mp4

Check: build and Pubky auth validation ✅ Exact-head simulator build, focused auth tests, SwiftFormat and translation validation passed.

Ran xcodebuild test selecting PubkyAuthRequestTests, PubkyAuthApprovalSheetTests and PubkyAuthURLSchemeTests, including testExpectedSignerAndRelayRulesHoldTogether. SwiftFormat 0.64.6 passed on the four auth Swift files; node scripts/validate-translations.js passed.

Not repeated: J1, manual 1–4, long-URL copy, Arabic layout, section dividers, direct signup and Ring rejection retain the recorded review at 7115c8d where their paths and expectations remain unchanged. Case 14 retains the author's device evidence at 01415be; Case 15 retains the recorded component checks at 01415be. Case 16 covers the additional raw signup path raised in the latest QA review.

Not driven: signing and relay delivery are outside this display/validation change. Changes already in the merged base were not re-driven as relay QA. No planned case remains unrun. Layout is unchanged; the earlier recorded Figma comparison is retained, and the live frame was unavailable.

Coverage: contiguous delta 01415be..c9332b9, including conflict resolution and the relay/signer interaction. Of its 65 files, 46 match the merged base exactly; both relay validation and signer parsing remain in makeRequest.

Twin: synonymdev/bitkit-android#2075 at 08420a1 matches the relay rules and section layout; compared in code.


Reviewed by gpt-6.1-sol-high

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@jvsena42
jvsena42 enabled auto-merge November 27, 2026 12:55
@jvsena42
jvsena42 merged commit 2cc38fd into master Nov 27, 2026
42 of 43 checks passed
@jvsena42
jvsena42 deleted the fix/pubky-auth-relay-url branch November 27, 2026 18:52
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.

4 participants