react-native-keystore-crypto-joe 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ repositories {
25
25
  }
26
26
 
27
27
  dependencies {
28
+ implementation "com.facebook.react:react-android"
28
29
  implementation "org.jetbrains.kotlin:kotlin-stdlib"
29
30
  implementation "androidx.biometric:biometric:1.1.0" // use stable unless you need alpha
30
31
  }
@@ -7,6 +7,7 @@ import android.security.keystore.KeyProperties
7
7
  import android.util.Base64
8
8
  import androidx.biometric.BiometricPrompt
9
9
  import androidx.core.content.ContextCompat
10
+ import androidx.fragment.app.FragmentActivity
10
11
  import com.facebook.react.bridge.*
11
12
  import java.security.KeyPairGenerator
12
13
  import java.security.KeyStore
@@ -98,6 +99,11 @@ class KeystoreCryptoModule(private val reactContext: ReactApplicationContext) :
98
99
  activity.runOnUiThread {
99
100
  try {
100
101
  val cipher = newOaepCipherForDecrypt(privateKey)
102
+ val activity = currentActivity
103
+ if (activity !is FragmentActivity) {
104
+ promise.reject("NO_ACTIVITY", "Current activity is not a FragmentActivity")
105
+ return
106
+ }
101
107
  val executor = ContextCompat.getMainExecutor(activity)
102
108
  val callback = object : BiometricPrompt.AuthenticationCallback() {
103
109
  override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keystore-crypto-joe",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "RSA OAEP decrypt via Android Keystore / iOS Keychain + biometric gating for React Native",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",