AKASHAorg / secure-webstore

A secure IndexedDB store with built-in encryption
MIT License
44 stars 6 forks source link

Losing reference to the existing Store object on memory #28

Closed zireal23 closed 1 year ago

zireal23 commented 1 year ago

We are currently using the library to some user specific data in indexed db in encrypted form, but when the page is refreshed, although initialising the store again references the store with the same name and passphrase stored in the IDB but a new encryption key is generated and thus cant decrypt the existing encrypteddata in IDB. Any way to get the same key with the same passphrase everytime the store object is initialised? Currently we are thinking of storing the store object somehwere but that wouldnt be very secure.

deiu commented 1 year ago

Hi @zireal23. That shouldn't be the normal behavior. Are you sure you're not clearing the store somehow? When the store obj is initialized, it will check for an existing encryption key first for the store with the name you provided. It should not overwrite the encryption key.

zireal23 commented 1 year ago

@deiu thanks for the reply. I did find that the store was getting cleared from idb, it was some sideeffect of a code that I was dumb enough to write without testing properly. Anyways I fixed it and its working as it should. Again, would like to express my gratitude for creating this wonderful library.