Skip to content

Commit cae786e

Browse files
committed
Merge branch 'feat/location-event-plugin' into feat/location-sync-filter
2 parents ebc2067 + 56d6033 commit cae786e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

location/src/main/kotlin/io/customer/location/store/PreferenceCrypto.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.customer.location.store
22

3+
import android.annotation.SuppressLint
34
import android.os.Build
45
import android.security.keystore.KeyGenParameterSpec
56
import 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

0 commit comments

Comments
 (0)