import { AsyncStorage } from 'oidc-client-ts'; import localForage from 'localforage'; export class LocalForageAsyncStorage implements AsyncStorage { private storage: LocalForage; constructor(name: string, driver: string | string[]) { this.storage = localForage.createInstance({ name, driver }); } get length(): Promise { return this.storage.length(); } clear(): Promise { return this.storage.clear(); } getItem(key: string): Promise { return this.storage.getItem(key); } key(index: number): Promise { return this.storage.key(index); } async removeItem(key: string): Promise { await this.storage.removeItem(key); } async setItem(key: string, value: string): Promise { await this.storage.setItem(key, value); } }