Skip to content

Commit 1b35a95

Browse files
sea-snakeclaude
andcommitted
feat: let AuthClient take identity and delegation storage
AuthClient now takes identityStorage and delegationStorage instead of one combined store, which is what lets an application share sign-in state across sibling subdomains by handing it CookieDelegationStorage. The client is key-type agnostic as a result: the keyType option, the pending-key machinery, key (de)serialization, StoredKey and the localStorage migration are all gone, because the choice of algorithm now belongs to the identity store. The window flow persists the key only once a delegation is obtained, so a cancelled or failed ceremony can no longer overwrite the key of a session that is still valid. The redirect flow has to persist on the outbound load, since the key must survive the navigation, so #hydrate and #reconcile verify that the stored key matches the delegation's leaf public key and discard the session on a mismatch rather than assembling an identity that signs with an unauthorized key. subscribe() and dispose() expose the stores' change events and re-derive the identity on an external sign-in or sign-out. isAuthenticated() is synchronous, reading the delegation's expiry directly. Each concrete store owns its own storage slot, so no slot-key constants are exported. BREAKING CHANGE: removes the keyType option and the AuthClientStorage and StoredKey interfaces, along with the IdbStorage, LocalStorage and KEY_STORAGE_* exports; renames the storage option to identityStorage. Existing sessions are not migrated and users re-authenticate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 78e9443 commit 1b35a95

6 files changed

Lines changed: 604 additions & 803 deletions

File tree

0 commit comments

Comments
 (0)