sushinpv / react-secure-storage

This is a wrapper written above local storage to write the data securely to local storage
https://npmjs.com/package/react-secure-storage
MIT License
126 stars 12 forks source link

Option to reload local storage #32

Closed rmalca closed 1 year ago

rmalca commented 1 year ago

Today I ran into a problem that doesn't happen when using localStorage directly.

In the application that I am developing, if there are 2 tabs open and one of them updates the secureLocalStorage, the data is not reflected in the other tab. This is problematic as I use secureLocalStorage to store the access token and if one of the tabs rotates the token the other never finds out unless that tab is refreshed.

I was digging into the code and I think I understand that getAllLocalStorageItems is called only once when loading the page, so I propose that there be a function that allows one and/or all of the localStorage keys to be updated.

sushinpv commented 1 year ago

Hi @rmalca , Thank you for your valuable feedback and reporting this issue,

This particular issue is not very simple to resolve because it requires proper thought process. The main intention which we initially thought to decrypt all the data and keep it on a private variable is for faster data access, so if we want to go with real-time decryption, we need to do a proper retesting of the entire library and a proper load testing to check the performance impact.

This issue has been moved into a discussion where we will prioritize and solve it ASAP.

Thanks again for your valuable point