Parse-sdk-js: Encrypt Current User - LocalStorage

Created on 25 Oct 2019  路  8Comments  路  Source: parse-community/Parse-SDK-JS

Hello guys :vulcan_salute:,

Right now I鈥檓 trying to encrypt the data which is storage in the browser and I鈥檓 using secure-ls , actually is working fine but only is encrypting the ping data not the Current User.

Do you have any idea of how to do it ?

Thanks and have a good day.

BTW. This is the code I鈥檓 using

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

Parse.enableLocalDatastore()
Parse.setLocalDatastoreController({
  fromPinWithName: name => ls.get(name),
  pinWithName: (name, objects) => ls.set(name, objects),
  unPinWithName: name => ls.remove(name),
  getAllContents: () => ls.getAllKeys(),
  clear: () => ls.removeAll()
})

I wrote it before in the community forum but no one shows up 馃槄

enhancement feature good first task

All 8 comments

Sorry for the late reply. That secure-ls trick looks cool.

The currentUser isn't stored in the localDatastore.

This is the line you are looking for.

If you want you could do the same for setting the StorageController

Feel free to do a PR.

Hello @dplewis 馃枛
Sorry for not answering before and thanks for the line I was looking for.

Sure let me try it. 馃憣馃榿

I would like to add SecureLS to the SDK but I鈥檓 skeptical. StorageController is swappable so we could have that option.

@acinader @davimacedo Thoughts?

Off the cuff, just documenting it on the readme and maybe the js sdk guide how to use it would be a decent first step?

alternatively, we could make an argument to initialize or a single call to use it wheen Parse SDK is initialized?

I figure it could be the same as setAsyncStorage for React-Native.

Secure LS has browser support issues i.e Microsoft Edge (insert rant here). I can open a PR for this and we can move the conversation there. @macarthuror what do you think?

@acinader I'm gonna documented it in the Readme. Thanks.

@dplewis I like it, also I think we can use other solutions to improve the security without using other repo.

BTW @davimacedo suggest trying with CoreManager.setStorageController()

I'm going to close this as users can add their own storage implementation if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oallouch picture oallouch  路  4Comments

Gyran picture Gyran  路  5Comments

ryanemax picture ryanemax  路  7Comments

Jonarod picture Jonarod  路  6Comments

myuller picture myuller  路  5Comments