Repository navigation
One session module for the extension and the iPhone app; the popup and background no longer race a refresh - #119
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… background refreshing at once no longer sign you out Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7 Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7 Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
NiallJoeMaher
force-pushed
the
arch-session
branch
from
October 27, 2026 07:31
e6fba5c to
3a6b37a
Compare
Merged
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.
createSession(store)inpackages/clientnow holds the token refresh,isSignedInand the revoke, andregisterholds dynamic registration. The extension (browser storage plus a Web Lock) and the iPhone app (Keychain) each pass a store. The platform-specific sign-in stays in each app.The race was real. I ran the real Better Auth handler (
mcp(), whoserefreshTokenReuseIntervaldefaults to 30 s) in a throwaway vitest:400 invalid_grant, 5 out of 5 times.Only the in-flight case hurts. The extension's guard lived in memory, so the popup and the service worker could each spend the token. The loser then wrote
tokens: nulland signed the person out.Fix
navigator.locks) around the refresh. The popup, options page and worker all share it.Tests (
packages/client/src/client.test.ts): two session "contexts" share one store against a fake rotating token endpoint. Before the fix they returned['Bearer a1', null](red); now both stay signed in and the token is spent once. Further tests cover a refusal where another app refreshed first, a refused token (signs out) and offline (keeps the tokens).Also: the extension uses
pkcePairinstead of hand-rolled PKCE, and the popup and badge askisSignedIn()instead of reading raw storage keys.Not done:
PluckClient.swiftis unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7