Skip to content

chore: drop legacy Pubky Ring sign-up path - #1917

Draft
pwltr wants to merge 5 commits into
masterfrom
chore/drop-legacy-ring-signup
Draft

pwltr wants to merge 5 commits into
masterfrom
chore/drop-legacy-ring-signup

Conversation

@pwltr

@pwltr pwltr commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Part of synonymdev/bitkit-core#205
Twin: synonymdev/bitkit-ios#1332

This PR removes the legacy Pubky Ring sign-up path that also authorizes an app, so Bitkit no longer calls any bitkit-core Pubky auth export and bitkit-core can drop its legacy pubky module.

Description

  • Removes approval of legacy sign-up links that authorize an app over the relay/secret/caps protocol (pubkyring://signup?hs&relay&secret&caps, and the same query under pubkyauth://signup), because Paykit only approves grant links and the next Pubky SDK drops legacy cookie auth.
  • Rejects those links as invalid when they are scanned, pasted or opened in Bitkit, so the user sees the existing "This Pubky authorization link is invalid." error before consent and no identity is created.
  • Stops offering those links in the automatic clipboard prompt: for a recognised Pubky link the Pubky parser decides, instead of bitkit-core's generic decode, which accepts any pubkyauth: string.
  • Stops registering Bitkit for pubkyring://signup links, so Android hands them to Pubky Ring, which still supports them.
  • Keeps plain sign-up (pubkyauth://direct_signup and pubkyauth://signup with hs/st) and pubkyauth://signup_grant unchanged; both already go through Paykit.
  • Removes the Ring relay timeout error, which only that path could raise; the timeout message string stays because contact deep links still use it.

Out of Scope

Design

N/A — no UI changes.

Preview

N/A — no new UI; a legacy link shows the existing invalid-link error toast.

QA Notes

Setup

  • Dev build (just run) from this branch on an emulator, with a wallet created and Paykit enabled, and no Pubky identity yet (fresh wallet or wiped profile).
  • For case 3, install Pubky Ring on the same device; for case 4, uninstall it.
  • Cases 1–4 need no homeserver or relay: the links are rejected before any network call. Case 5 needs a reachable homeserver from a Pubky Ring or staging setup that accepts the signup token used.

Journeys

N/A — no journey added or updated. The legacy-link rejection could be driven through the deep-link capability, but by maintainer decision it is covered by the reviewer cases below instead.

Manual Tests

  • 1. Deliver pubkyauth://signup?hs=<homeserver>&relay=https%3A%2F%2Frelay.example&secret=x&caps=%2Fpub%2Fexample%2F%3Arw with adb shell am start -a android.intent.action.VIEW -d "<uri>" to.bitkit.dev → Bitkit shows "Authorization failed / This Pubky authorization link is invalid.", no consent screen, and no Pubky identity is created
  • 2. Paste pubkyring://signup?hs=<homeserver>&relay=https%3A%2F%2Frelay.example&secret=x&caps=%2Fpub%2Fexample%2F%3Arw in the wallet scanner (Scan → Paste) → the same invalid-link error, and no identity is created
  • 3. With Pubky Ring installed, deliver the pubkyring://signup?... link from case 2 via adb shell am start -a android.intent.action.VIEW -d "<uri>" (no package) → it opens in Pubky Ring; Bitkit is not offered
  • 4. Without Pubky Ring installed, deliver the same pubkyring://signup?... link via adb → Bitkit is not offered and does not open
  • 5. Deliver pubkyauth://direct_signup?hs=<homeserver>&st=<token> → the consent sheet shows the homeserver; approve → the identity is created and profile setup opens (plain sign-up still works)

Automated Checks

  • added PubkyAuthRequestTest.kt — legacy Ring and pubkyauth://signup links with relay/secret/caps are rejected as invalid
  • added PubkyRepoTest.kt — parsing a legacy Ring sign-up link fails as invalid without contacting Pubky
  • added AppViewModelSendFlowTest.kt — the clipboard prompt doesn't offer legacy pubkyauth://signup / pubkyring://signup links or lightning:-wrapped Pubky links; plain and grant sign-up links are still offered, decided by the Pubky parser instead of bitkit-core's generic decode
  • added PubkyRepoTest.kt — plain sign-up links (direct_signup, signup with hs/st) parse
  • updated PubkyRepoTest.kt — sign-up rollback and registration-failure cases use plain sign-up; grant sign-up still authorizes through Paykit before activation
  • updated PubkyAuthManifestTest.kt — pubkyring://signup links no longer resolve to Bitkit
  • updated PubkyAuthApprovalViewModelTest.kt — sign-up consent covers plain and grant sign-up only
  • updated PubkyAuthApprovalRetryTest.kt — a failed sign-up restores consent and requires local auth on retry
  • updated PubkyAuthErrorMessageTest.kt — unmapped and known errors without the removed Ring timeout error
  • removed PubkyServiceTest.kt — relay-timeout and cancellation tests for the removed Ring approval
  • ran just compile, just test, just lint — all passed

Evidence

  • just compile, just test (6,283 tests in 319 classes, 0 failures; 2 skipped SparkExitRegtestTest tests, opt-in via SPARK_EXIT_REGTEST=1) and just lint (detekt and Android Lint) passed locally on 5fae4683f, with master 0244a2a07 merged in (bitkit-core 0.8.0-rc15).

Gaps

  • Manual cases 1–5 have not been run on a device; behaviour is covered by unit and Robolectric manifest tests only.
  • Grant sign-up was not exercised end to end; it needs a controlled requesting app, homeserver and relay (see the pubky-auth journey README).

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: high)
  • Implementation: claude-opus-5-5 (reasoning: high)
  • Review: Not performed

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 5fae468 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@pwltr
pwltr marked this pull request as ready for review November 23, 2026 11:19
@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Removes legacy Pubky Ring sign-up approval while keeping plain and grant sign-up.

  • Bitkit rejects legacy Ring sign-up links that authorize an app.

Intentional scope from pwltr: direct_signup still ignores stray relay, secret, and caps parameters.

Reviews (1) · 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. Removes the legacy Pubky Ring sign-up path that also authorized an app over relay/secret/caps: such links now fail parseSignup as InvalidUrl before any Pubky call, pubkyring://signup is no longer routed to Bitkit, and approvePubkyAuth, parsePubkyAuthUrl and PubkyRingAuthTimeoutError go with it. Reviewed bdba834, full tier (auth path), static: on bitkit-android the PR's branch is not built from this side, so this rests on the code and on CI.

What I checked, and 4 candidates I ruled out

Read in full: PubkyAuthRequest.kt (parseSignup, isProtocolUrl, isSignupRequest, authorizesApp), PubkyRepo.parseAuthUrl and approveSignupAuth, PubkyService.validateSignupRequest, the manifest alias, and the test changes.

Ruled out

  • Grant sign-up stops authorizing the app: on master authorizationUrl defaulted to rawUrl for grant sign-up, so it called approveAuth(rawUrl, ...); the new if (request.isGrantSignup) branch makes the same call with the same arguments, still before activateRegisteredIdentity.
  • Plain sign-up starts calling approveAuth: on master its authorizationUrl was null, so nothing ran; it still runs nothing, and PubkyRepoTest now asserts never() on approveAuth.
  • A pasted pubkyring://signup link bypasses the new rejection: isProtocolUrl still accepts it, so it reaches PubkyRepo.parseAuthUrl, where isSignupUrl is true and parseSignup fails on the new require(!authorizesApp), before validateSignupRequest or the Paykit parser. That is the invalid-link error the body describes, and PubkyRepoTest covers both schemes.
  • Removed timeout string still referenced: profile__auth_error_timeout is kept and still used by AppViewModel for contact deep links; no remaining reference to PubkyRingAuthTimeoutError, approveRingAuth or authorizationUrl under app/src/main.

CI: the earlier run's build and apk-comment are red only because that run was cancelled (BUILD_RESULT: cancelled); the run on this head (build-and-test, lint, compose-ui) was still pending at review time.

Merge confidence: 4/5, no findings, but an auth path whose CI run on this head had not finished and that was not built here.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (this runtime does not report the setting)

@ovitrif

ovitrif commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Triaged into 3.2.0: it's ready, removes a sign-up path Paykit no longer approves, and lets bitkit-core drop its legacy pubky module. Tracked in #1997; the iOS twin joins it once synonymdev/bitkit-ios#1332 is ready for review.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code scan at bdba834d9: no findings. I reviewed this as an auth and deeplink change, not a chore, since it changes the manifest intent filters and PubkyAuthRequest parsing.

Checked and clean:

  • What's removed: the pubkyring://signup filter on .ui.MainActivityPubkySignup, and the sign-up-plus-authorize request kind. That covers pubkyring://signup… and pubkyauth://signup?… with relay, secret or caps, which parseSignup now rejects as InvalidUrl (PubkyAuthRequest.kt:207). The pubkyauth://signup, direct_signup and signup_grant hosts stay.
  • No other handler picks up a legacy link. isProtocolUrl/isSignupRequest still recognise it, so a pasted or scanned link stays on the Pubky path and fails in parseSignup before any Pubky or Paykit call. Approval re-parses, so approveSignupAuth can't be reached. Upper-case and percent-encoded keys, an empty relay= and a relay-less pubkyring://signup?hs= are all rejected.
  • Upgrade from v3.1.1: the legacy path exists there, but a completed legacy sign-up persists the same state as a plain sign-up, and the auth URL was never persisted. Nothing is stranded. The removed timeout error and URL validation had no other callers.
  • Grant sign-up still calls approveAuth(rawUrl, …) between registerIdentity and activateRegisteredIdentity. Sign-in and companion-claim approval never read authorizationUrl.
  • iOS twin synonymdev/bitkit-ios#1332 has no confirmed findings to compare.

Device gate (partial): bdba834d9 — not run yet; pending: manual cases 1, 2, 4 and 5 on an emulator. Case 3 needs Pubky Ring installed, and I'll run it if I can install it. Device results and the final review type follow in a second review.
perf: not relevant; the PR only removes the 30 s relay timeout wait.

Reviewer model: claude-fable-5-2, coordination claude-opus-5-5
Reasoning effort: Not exposed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Device results at 5fae4683f. Approving: nothing came out of the code scan, the delta review of 5fae4683f or the device gate.

Delta 5fae4683f (clipboard prompt): the new branch in canDecodeClipboard (AppViewModel.kt:9265) only parses locally. Plain sign-up goes through parseSignup and validateSignupRequest, which only normalises the key. Other links go through Paykit's synchronous parsePubkyAuthUrl. Nothing dials the homeserver or the relay, so a clipboard string can't trigger a network request. The prompt is now skipped only for links the approval sheet would reject anyway.

On device (fresh regtest wallet, no Pubky identity):

  1. pubkyauth://signup?…relay…secret…caps via am start → "Authorization Failed / This Pubky authorization link is invalid." in 1.3 s. No consent sheet and no identity. Log: Failed to parse auth request [InvalidUrl='null'].
  2. pubkyring://signup?… pasted in Scan → Paste → the same toast in 1.6 s, no identity.
  3. With Pubky Ring v2.0 installed, the pubkyring://signup link resolves only to to.pubky.ring/…MainActivity and opens Ring, with no chooser and Bitkit not offered.
  4. With Ring removed, the link doesn't resolve ("No activities found", am start can't resolve the intent), and Bitkit doesn't open.
  5. pubkyauth://direct_signup with a staging homegate code → the consent sheet shows the homeserver. Authorize → "Auth approved" after 33 s on staging → Create Profile.
  • In-app Create Profile still works: save → "Created identity" in 37 s on staging.
  • Clipboard prompt with auto-read on: a legacy pubkyring://signup or pubkyauth://signup?…relay… link gives no prompt. A direct_signup link prompts, and OK opens the consent sheet with the homeserver.

Device gate: 5fae4683f — Gate_Throwaway emulator, dev debug, staging homegate for case 5. manual: 5 of 5 cases passed, plus the in-app create-profile regression and the clipboard prompt; perf: not relevant (the PR removes the 30 s relay wait; the sign-up waits are the staging homeserver's); l10n: no UI text changed; iOS: not run.
Skipped — covered by CI at 5fae4683f: unit tests, lint, detekt, compose UI tests, local e2e suites.

Reviewer model: claude-fable-5-2 (review, delta, runbook; reasoning: medium), claude-sonnet-5-5 (driver; reasoning: low), claude-opus-5-5 (coordination; reasoning: Not exposed)

@pwltr
pwltr marked this pull request as draft November 23, 2026 14:24
@pwltr

pwltr commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Parking this and converting it back to a draft. The plan for legacy Pubky auth has changed: support for requesting legacy auth goes away (apps that upgrade the Pubky SDK move to grant auth), but signers keep approving legacy requests, so older apps keep working with new versions of the homeserver, Pubky Ring and Bitkit. Bitkit is a signer here, so removing this sign-up path would break those apps.

bitkit-core will restore the signer API that synonymdev/bitkit-core#217 removed (parsePubkyAuthUrl, approvePubkyAuth and their types) before its next release, so no app change is needed. Thanks for the reviews; nothing here was wrong, it's the direction that changed.

This branch has not been deployed

No deployments
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