File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
location/src/main/kotlin/io/customer/location/store Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 11package io.customer.location.store
22
3+ import android.annotation.SuppressLint
34import android.os.Build
45import android.security.keystore.KeyGenParameterSpec
56import android.security.keystore.KeyProperties
@@ -28,6 +29,8 @@ internal class PreferenceCrypto(
2829 @Volatile
2930 private var cachedKey: SecretKey ? = null
3031
32+ @Synchronized
33+ @SuppressLint(" NewApi" , " InlinedApi" )
3134 private fun getOrCreateKey (): SecretKey {
3235 cachedKey?.let { return it }
3336
@@ -59,6 +62,7 @@ internal class PreferenceCrypto(
5962 * containing the 12-byte IV prepended to the ciphertext. Falls back
6063 * to returning [plaintext] unchanged if encryption is unavailable.
6164 */
65+ @SuppressLint(" NewApi" )
6266 fun encrypt (plaintext : String ): String {
6367 if (! isKeystoreAvailable) return plaintext
6468
@@ -80,6 +84,7 @@ internal class PreferenceCrypto(
8084 * encryption was enabled, or the Keystore is unavailable), returns
8185 * [encoded] as-is, which handles migration from plaintext transparently.
8286 */
87+ @SuppressLint(" NewApi" )
8388 fun decrypt (encoded : String ): String {
8489 if (! isKeystoreAvailable) return encoded
8590
You can’t perform that action at this time.
0 commit comments