secure-ls icon indicating copy to clipboard operation
secure-ls copied to clipboard

secure-ls ( v.^1.2.6") can't find variable localStorage

Open mohamedbelhassen opened this issue 4 years ago • 1 comments

I am trying to use secure-ls to encrypt local data of my Parse Server Application in a react-native project. when typing the following two lines, I get the error "secure-ls can't find variable localStorage":

import SecureLS from 'secure-ls';
const ls = new SecureLS({ isCompression: false });

Could you tell me how to fix this error?

mohamedbelhassen avatar Sep 17 '20 08:09 mohamedbelhassen

https://github.com/softvar/secure-ls/blob/b2d92feeeb0de93f8aebed83750dd5a30fd02d0e/src/index.js#L39

试试自己改一下这里?我想使用 sesstionStorage ,而不是 localStorage.

只要覆盖以下 api clear setItem getItem remove 应该就可以直接用了

zheNeng avatar Oct 13 '20 03:10 zheNeng