From 4a6bae95001096ae565028600ac158f6fc350b1a Mon Sep 17 00:00:00 2001 From: Bitcoin Error Log <18273620+BitcoinErrorLog@users.noreply.github.com> Date: Wed, 23 Sep 2026 13:09:15 +0100 Subject: [PATCH 1/6] feat(auth): Bitkit sign-in through a grant QR beside the Ring QR Bitkit accepts only pubkyauth://signin_grant. The sign-in page now offers a Bitkit grant QR (GrantAuthFlow.startDelegated, client id shop.pubky.app, the Shop capabilities) next to the unchanged Ring cookie QR. A grant session is never exported: it is saved to BrowserSessionStore at sign-in completion, inside the auth finalization lock and only if the cross-tab auth epoch is unchanged since the QR started, and reload restores it from its record id. Sign-out, warm or cold, signs the session out, then bumps the epoch and clears BrowserSessionStore under the lock, and tells other tabs to drop a live grant session. Grant sessions carry no AuthToken, so the classic Pubky Ring approvals (purchases, step-up, inventory, messaging, manual Paykit claim) show a refusal instead of a QR. Lock Server connect stays open: its page decides which QR it offers. --- .../GrantSessionRefusal.tsx | 16 ++ .../molecules/QrCodeSlot/QrCodeSlot.tsx | 23 ++- .../molecules/QrCodeSlot/QrCodeSlot.types.ts | 2 + .../MarketplaceGetPaidSettings.tsx | 9 +- .../MarketplaceInventoryGrantDialog.tsx | 11 +- .../MarketplaceMessagingEnableDialog.tsx | 10 +- .../Marketplace/MarketplaceReauthDialog.tsx | 11 +- .../MarketplaceSessionConnectDialog.tsx | 11 +- src/components/organisms/SignIn/SignIn.tsx | 158 ++++++++++++++-- .../templates/Auth/Logout/Logout.tsx | 3 +- src/config/app.ts | 3 + src/core/application/auth/auth.ts | 66 +++++++ src/core/controllers/auth/auth-epoch.ts | 49 +++++ .../controllers/auth/auth-identity-guard.ts | 7 +- src/core/controllers/auth/auth.test.ts | 174 ++++++++++++++++++ src/core/controllers/auth/auth.ts | 87 ++++++++- src/core/services/homeserver/homeserver.ts | 86 ++++++++- .../services/homeserver/homeserver.utils.ts | 2 +- src/core/stores/auth/auth.actions.ts | 6 +- src/core/stores/auth/auth.store.test.ts | 55 ++++++ src/core/stores/auth/auth.store.ts | 6 +- src/core/stores/auth/auth.types.ts | 7 + src/hooks/useAuthStatus/useAuthStatus.tsx | 5 +- src/hooks/useAuthUrl/useAuthUrl.tsx | 6 +- src/hooks/useAuthUrl/useAuthUrl.types.ts | 6 + .../useGrantSignInAvailable.ts | 16 ++ .../useIsGrantSession/useIsGrantSession.ts | 12 ++ .../RouteGuardProvider/RouteGuardProvider.tsx | 8 +- 28 files changed, 801 insertions(+), 54 deletions(-) create mode 100644 src/components/molecules/GrantSessionRefusal/GrantSessionRefusal.tsx create mode 100644 src/core/controllers/auth/auth-epoch.ts create mode 100644 src/hooks/useGrantSignInAvailable/useGrantSignInAvailable.ts create mode 100644 src/hooks/useIsGrantSession/useIsGrantSession.ts diff --git a/src/components/molecules/GrantSessionRefusal/GrantSessionRefusal.tsx b/src/components/molecules/GrantSessionRefusal/GrantSessionRefusal.tsx new file mode 100644 index 0000000000..f35defe4be --- /dev/null +++ b/src/components/molecules/GrantSessionRefusal/GrantSessionRefusal.tsx @@ -0,0 +1,16 @@ +import { Typography } from '@/atoms/Typography/Typography'; + +/** Shown instead of a Pubky Ring approval QR when the Shop session came from a Bitkit sign-in. */ +export function GrantSessionRefusal() { + return ( +