patrickfav / armadillo

A shared preference implementation for confidential data in Android. Per default uses AES-GCM, BCrypt and HKDF as cryptographic primitives. Uses the concept of device fingerprinting combined with optional user provided passwords and strong password hashes.
https://favr.dev/opensource/armadillo
Apache License 2.0
280 stars 52 forks source link

putString() cannot take null as a default value #3

Closed SAGARSURI closed 6 years ago

SAGARSURI commented 6 years ago

Got this error:

java.lang.NullPointerException: provided string must not be null
 at java.util.Objects.requireNonNull(Objects.java:228)
 at at.favre.lib.bytes.Bytes.from(Bytes.java:432)
 at at.favre.lib.bytes.Bytes.from(Bytes.java:410)
  at at.favre.lib.armadillo.SecureSharedPreferences$Editor.putString(SecureSharedPreferences.java:241)
patrickfav commented 6 years ago

I will look into it; I would have to create special case for handling null object types which I don't really want, but the sharedPref interface allows it so, I probably have to.

patrickfav commented 6 years ago

0.4.2 should support null values, as specified by SharedPreference Interface:

Passing null for this argument is equivalent to calling remove(String) with this key.

https://developer.android.com/reference/android/content/SharedPreferences.Editor.html#putStringSet(java.lang.String,%20java.util.Set%3Cjava.lang.String%3E)