[英]What is the difference between SharedPrefernces and Flutter_secure_storage packages when building an app in flutter? or do they do the same thing?
I am trying to build an app in flutter using api tokens and i would like to know if SharedPrefences and flutter_secure_storage packages do the same things or if they are different.我正在尝试使用 api 令牌在 flutter 中构建一个应用程序,我想知道 SharedPrefences 和 flutter_secure_storage 包是否做同样的事情或者它们是否不同。
flutter_secure_storage package uses SharedPreferences with MODE_PRIVATE as you can see here :如您在此处看到的, flutter_secure_storage package 使用 SharedPreferences 和 MODE_PRIVATE :
preferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
It also uses additional encryption via AES.它还通过 AES 使用额外的加密。 From readme :
AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore
来自自述文件:
AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore
AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore
. AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore
。 You can find details in the source code .您可以在源代码中找到详细信息。
As for secure tokens and other sensitive data, it would be safer to use flutter_secure_storage
instead of raw SharedPreferences with private mode.至于安全令牌和其他敏感数据,使用
flutter_secure_storage
而不是使用私有模式的原始 SharedPreferences 会更安全。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.