fix: detect and clear stale IndexedDB auth tokens (refs #190)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-14 21:55:54 -06:00
parent a195fa9231
commit 6e493e9bc7
2 changed files with 44 additions and 1 deletions

View File

@@ -157,6 +157,23 @@ class IndexedDBStorage implements StorageAdapter, Auth0Cache {
}
}
async clearAll(): Promise<void> {
await this.initPromise;
if (!this.db) {
this.memoryCache.clear();
return;
}
const tx = this.db.transaction(this.storeName, 'readwrite');
tx.objectStore(this.storeName).clear();
await new Promise<void>((resolve, reject) => {
tx.oncomplete = () => {
this.memoryCache.clear();
resolve();
};
tx.onerror = () => reject(tx.error);
});
}
key(index: number): string | null {
const keys = Array.from(this.memoryCache.keys());
return keys[index] || null;