oidc-client-ts icon indicating copy to clipboard operation
oidc-client-ts copied to clipboard

Typing issue: WebStorageStateStore.store should be an async store

Open Badisi opened this issue 3 years ago • 0 comments

I'm trying to use my own custom store implementation where all the data has to be read/write in an async manner.

userStore: new WebStorageStateStore({
  store: new MyStore()
});

The issue I'm facing is that WebStorageStateStore uses async methods whereas WebStorageStateStore.store uses sync ones as it is of type Storage.

Solutions:

  1. I could make my own implementation of WebStorageStateStore but then I would loose or duplicate anything that this wrapper is doing -> so I don't really like that solution.
  2. It seems that supporting an async store is already implemented as all the methods from WebStorageStateStore returns a Promise.resolve of the store's results (ex: line 34, line 43, ...). -> so the ideal solution would be to replace the type of WebStorageStateStore.store and make it reflect an async Storage type instead

What do you think ?

Badisi avatar Jul 05 '22 17:07 Badisi