0

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?

4

1 に答える 1

1

localStorage に保存されたデータは暗号化されないため、機密データを Cookie に保存するのと同様に、そのメモリにアクセスできるアプリ/プロセスは値を読み取ることができます。

userId を localStorage に保存する代わりに、識別できないセッション キーを保存することをお勧めします。または、代わりに userId をハッシュしてその値を保存します ( http://en.wikipedia.org/wiki/Cryptographic_hash_function )。

于 2013-04-08T18:11:05.130 に答える