Multi-account support: per-DID data scoping + clear-on-account-change #31
Labels
No labels
auth
bug
composer
correctness
database
durability
enhancement
feeds
interactions
notifications
performance
reliability
safety
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starsetbyte/peregrine#31
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Peregrine supports a single account at a time and keeps account-bound data (Room, draft images on disk, DataStore feed prefs + recent searches) in shared, unscoped stores. #18 (PR #30) added the immediate safety fix — wipe all account-bound data on logout — but that's a blunt instrument: switching accounts loses all cached state and forces a full re-download, and one leak vector remains uncovered. This issue tracks proper multi-account support.
Goals
accountDidto account-bound Room entities (and key DataStore values by DID), or use a separate DB/DataStore per DID. Lets each account retain its own cached timeline/feeds/drafts/notifications and enables fast switching without re-download.AuthRepository.logout(). Move the "fresh start for a new account" guarantee to the point a session is established: when a newly authenticated DID differs from the stored one, scope (or clear) appropriately.Remaining leak vector (not covered by #18 / PR #30)
TokenAuthenticatorperforms a forced logout on refresh failure by callingSessionManager.clearSession()directly — it does not route throughAuthRepository.logout(), so the account-data wipe never runs. Sequence: account A's session expires →clearSession()→ login screen → account B logs in → B sees A's cached data.The OAuth login path also bypasses
AuthRepositoryentirely (session saved viaOAuthLoginViewModel→SessionManager.saveOAuthSession). A login-boundary approach covers app-password login, OAuth login, and post-expiry re-login in one place, whereas the current logout-only hook covers none of those switches.Acceptance criteria
Related