amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.08k stars 1.16k forks source link

Gun.user with sentitive data and persistent login status #1292

Closed ndaidong closed 1 year ago

ndaidong commented 1 year ago

Hi everyone,

I am trying to apply this library to my project, but I have some questions as follows.

Thank you.

MaheeshaDias commented 1 year ago

To answer your second bullet point, It is safe because user pairs are only stored in sessionStorage when a user is authenticated and is removed from sessionStorage when the user exits that session or signs out. Anyway, sessionStorage is specific for each website a user visits so I don't know how someone with malicious intent would access someone's sessionStorage anyway.

ndaidong commented 1 year ago

@BrendanDN I understand how sessionStorage works, but privatekey is very sensitive data, similar to password in the raw. I would like to know if any better approach provided by Gun that I missed. If not, I may need to implement another user management system by myself with native web crypto.

MaheeshaDias commented 1 year ago

@ndaidong I am afraid to say there are no other approaches provided by Gun, but a malicious attack on a user's sessionStorage would have to be extremely targeted, but I do understand it is better to be safer than sorry.