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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user