Sign-in: Ring and Bitkit QRs side by side, profile prefill, clear quota error - #111
Merged
BitcoinErrorLog merged 8 commits intoSep 24, 2026
Merged
Conversation
The Bitkit grant flow gets its own controller slot, so starting it no longer cancels the Ring single-approval ceremony and vice versa. A completed sign-in, local-state cleanup and cross-tab sign-out cancel both. A Bitkit approval that settles after another sign-in won is signed out instead of initialized.
Both QRs are labelled and scannable at once; the Bitkit QR is no longer behind a text link. Mobile shows both Authorize buttons. Browsers without grant delegation keep the Ring-only layout.
pubky-homeserver answers 403 "Write to this path is not allowed" when the account's allowed_write_paths quota excludes a path, whatever the session's capabilities. Homegate IP signups (Bitkit's path) allow only /pub/paykit/ and /pub/bitkit.to/. isWritePathNotAllowedError tells it apart from a capability 403.
…invent a name (#48) Create profile reads the account's Pubky App profile.json, then Bitkit's profile (Paykit rc55 /pub/bitkit.to/bitkit/wallet/profile.json, then the Bitkit 2.4 /pub/bitkit.to/profile.json), and prefills name, bio and safe links without overwriting typing. With no profile the name stays empty. generateRandomUsername had no other caller and is removed. Saving on an account whose homeserver refuses Pubky App writes shows that reason instead of "Could not save profile".
…th directions Every sign-in QR records the flow generation it started under. A completion whose generation moved on lost to another sign-in or a sign-out: it is signed out and never initialized, in the Ring dual-POST window, in the Bitkit wrapper, and as the first synchronous step of completeAuthenticatedSession, which closes the window where both approvals are already in hand. A losing Ring completion drops the marketplace bearer it minted; a losing Bitkit approval mints none and leaves the winner's bearer alone. The winner's session and grant record are untouched. The sign-in hook no longer toasts a failure for the loser.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#48: new Bitkit identities on the Shop (profile save, both QRs, profile prefill)
Base:
release/shop-v0.6.8@5e7fc0e64(tagshop-v0.6.25). Issue: BitcoinErrorLog/pubky-marketplace#48 (comment)Root cause of "Could not save profile" (not a Shop or SDK defect)
The production homeserver refuses every
pubky.appwrite for accounts created through Homegate's IP signup, which is how Bitkit creates an identity (PubkyRepo.createIdentity→POST https://homegate.pubky.app/ip_verification→signUp). Homegate gives those accountsallowed_write_paths = ["/pub/paykit/", "/pub/bitkit.to/"]and a 2 MB storage quota (pubky/pubky-stack.github/workflows/homegate-cicd.yml:110-116). The homeserver'sWritePathLayerthen answers403 Write to this path is not allowedfor/pub/pubky.app/*and/priv/pubky.app/*, whatever the session's capabilities.Evidence, production, throwaway Homegate IP-signup identity
5dyqcwcn…:POST /auth/grant/session200),PUT /pub/pubky.app/profile.json→403 Write to this path is not allowed, toast "Could not save profile". Pav's failure reproduced./:rw) for the same account gets the same 403 on/pub/pubky.app/profile.json,/pub/pubky.app/marketplace/v1/…and/priv/pubky.app/…, while/pub/paykit/and/pub/bitkit.to/succeed.startGrantAuthFlow(CAPABILITIES, signin, cid shop.pubky.app), SDK 0.11) for the seller test seatn3pfudgx…writes, reads back and deletes/pub/pubky.app/proofs/…. The grant session storage API and the capability path are correct; only the account allow-list differs.The Shop cannot lift that restriction. This PR makes the Shop say what happened and fixes the two UX problems. The homeserver-side fix is an operator change in
pubky/pubky-stack(see "Needs an owner decision").Changes
isWritePathNotAllowedErrormatches the homeserver's allow-list 403 body; Create profile shows "Your homeserver account doesn't allow saving a Pubky profile yet. Signing in again won't change this." A capability 403 keeps "Could not save profile".profile.json, then Bitkit's profile (Paykit rc55/pub/bitkit.to/bitkit/wallet/profile.json, then the Bitkit 2.4/pub/bitkit.to/profile.json), and prefills name, bio and safe links without overwriting typing. With no profile the name is empty. An existing Pubky Appprofile.jsonstill skips onboarding (unchangeduserIsSignedUp).generateRandomUsernamehad no other caller and is removed.§6d contract table
bitkit qr hidden without delegationshows the Ring and Bitkit QRs side by side, each labelled, with no link to clickpubkyauth://signin?caps&relay&secretring-with-both-qrs-proof.mjscheck 2; existing R1.1 testsstarting the Bitkit QR keeps the Ring ceremony live,starting the Ring QR keeps the Bitkit flow livea completed sign-in cancels both QRsa Bitkit approval that settles after another sign-in won is signed out, not returned; positivea Bitkit approval with no competing sign-in is returnedreleasing the Bitkit handle cancels only the Bitkit flowoffers both authorize buttons on mobilecopying the Bitkit QR copies the Bitkit flow URL, not the Ring one403 Write to this path is not allowedon profile savethe account allow-list 403 maps to an auth error the profile form can name,names the homeserver account restriction when the profile write is refused by patha capability 403 is not reported as an account restriction,keeps the generic copy for other homeserver 403suseProfileForm/ error testsprofile.jsonexists at sign-inuserIsSignedUp)prefers an existing Pubky App profilefalls back to the Bitkit profile, newest layout first,prefills name, bio and links from an existing profile; Chromium check 6reads the Bitkit 2.4 layout when only it existsdoes not invent a name when the account has no profile; Chromium check 6 (no-profile run); VRTonboarding-profile-*javascript:linksignores fields of the wrong type instead of failing,takes the name, bio and safe links from a Bitkit profile,bounds every field to the Pubky App limitsnever rejects: a failed read moves on to the next sourcenever overwrites a name typed before the profile arrivesedit mode never reads a prefillIdentity predicates: S6 compares nothing new; the signed-in identity is still decided by
completeAuthenticatedSession→persistIdentityUnderLock(shouldAbortIdentityPersistagainstcurrentUserPubkyand the persisted blob). Residual (P3 cleanup): if a Ring token was already redeemed when a Bitkit completion cancels the Ring flow, a later Ring completion for a different pubky is refused by that guard; for the same pubky it replaces the grant session and the grant record stays in IndexedDB until the next sign-out'sclearAll.The Bitkit profile fixture is authored from
pubky/paykit-rsv0.1.0-rc55PaykitProfileserde andbitkit-androidPubkyProfileData; no live Bitkit-written profile has been captured yet. Parsing is tolerant (.passthrough(), every field optional).Proof
PREPUSH OK 22e5d08862bf345050d660cb834f5289c91e4312 403(prettier and eslint on 21/19 changed files, typecheck,vitest related708 files / 10,814 tests, Linux VRT 62 specs: 98 + 26 files passed).22e5d088, local build of this branch against the production homeserver, relay, Nexus and marketplace service, throwaway Homegate IP-signup identity: both QRs visible without a click; Bitkit grant approval signs in; Create profile shows an empty name (no profile) or the Bitkit name and bio (after writing a Bitkit rc55 profile); save shows the account-restriction copy on the homeserver's 403.POST /session200, one marketplacePOST /v1/auth/sessions201, cookie export, no grant exchange; signed out after.Needs an owner decision (outside this repo)
Bitkit-created identities stay unable to save a Shop profile, publish listings, or write the purchase-bootstrap proof document until
pubky/pubky-stackadds/pub/pubky.app/to the productionip_verification.signup_quota.allowed_write_pathsand existing Homegate IP accounts get the same quota update on the homeserver.