Reputation: 1447
I'm wondering how safe it would be to use html5 LocalStorage in a Phonegap app to store a user session.
Ideally I would store the user id + a random string to verify his identity on the database, much like a typical 'remember me' cookie.
Is this a safe practice? Anything I might be overlooking when it comes to storing data on Phonegap apps? Maybe something outside of LocalStorage?
Upvotes: 0
Views: 119
Reputation: 1885
Data saved in localStorage is not encrypted so any app/process that has access to that memory could read the value, similar to storing sensitive data in a cookie.
Recommend that instead of saving the userId in localStorage, save a non-identifiable session key. Or hash the userId and save that value instead (http://en.wikipedia.org/wiki/Cryptographic_hash_function).
Upvotes: 1