PlasmoHQ / storage

💾 Safely store data and share it across your extension
MIT License
45 stars 23 forks source link

How to use useStorage hooks with SecureStorage? #34

Open dimadolgopolovn opened 1 year ago

dimadolgopolovn commented 1 year ago

I have tried every combination of the lines below in popup.tsx.

const secureStorage = new SecureStorage({ copiedKeyList: ["shield-modulation"], area: "local" })
secureStorage.setPassword(MY_PASSWORD)

const [PROFILE_LIBRARY] = useStorage({ key: REMOTE_COOKIES_COLLECTION, instance: secureStorage })

background.ts:

const secureStorage = new SecureStorage({ copiedKeyList: ["shield-modulation"], area: "local" })
secureStorage.setPassword(MY_PASSWORD)
secureStorage.set(...)

How to get the same storage data in background.ts and popup.tsx with SecureStorage? It works with regular Storage. Documentation on SecureStorage is missing.

mrcnk commented 1 year ago

I have pretty much the same issue. I would like to access some data encrypted in SecureStorage with service worker instance of Chrome extension. As you mentioned, local and session data replicates just fine. @dimadolgopolovn did you by any chance make some progress since May?

dimadolgopolovn commented 1 year ago

@mrcnk no. If I remember it right, I just moved all storage interactions to background.js where you don't need a hook to access secure storage.