Commit 20ce1e9
feat: let AuthClient take identity and session storage
AuthClient now takes identityStorage and sessionStorage instead of one combined
store, which is what lets an application share sign-in state across sibling
subdomains by handing it CookieSessionStorage. 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 session'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 and adds sessionStorage.
Existing sessions are not migrated and users re-authenticate.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 6656c45 commit 20ce1e9
7 files changed
Lines changed: 607 additions & 803 deletions
File tree
- .claude/rules
- src/client
- tests/client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
This file was deleted.
0 commit comments