@capgo/capacitor-native-biometric 8.3.1 → 8.3.2
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.
|
@@ -363,12 +363,15 @@ public class NativeBiometric extends Plugin {
|
|
|
363
363
|
Cipher cipher;
|
|
364
364
|
cipher = Cipher.getInstance(TRANSFORMATION);
|
|
365
365
|
|
|
366
|
-
//
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
366
|
+
// Let the system generate the IV to comply with hardware-backed keystore requirements
|
|
367
|
+
// Modern Android devices with StrongBox/TEE enforce RandomizedEncryption and reject caller-provided IVs
|
|
368
|
+
cipher.init(Cipher.ENCRYPT_MODE, getKey(KEY_ALIAS));
|
|
369
|
+
byte[] iv = cipher.getIV(); // Retrieve the system-generated IV
|
|
370
|
+
if (iv == null || iv.length != GCM_IV_LENGTH) {
|
|
371
|
+
throw new GeneralSecurityException(
|
|
372
|
+
"Failed to generate valid IV: expected " + GCM_IV_LENGTH + " bytes, got " + (iv == null ? "null" : iv.length + " bytes")
|
|
373
|
+
);
|
|
374
|
+
}
|
|
372
375
|
byte[] encryptedBytes = cipher.doFinal(stringToEncrypt.getBytes(StandardCharsets.UTF_8));
|
|
373
376
|
|
|
374
377
|
// Prepend IV to the encrypted data
|
|
@@ -11,7 +11,7 @@ import LocalAuthentication
|
|
|
11
11
|
|
|
12
12
|
@objc(NativeBiometricPlugin)
|
|
13
13
|
public class NativeBiometricPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
14
|
-
private let pluginVersion: String = "8.3.
|
|
14
|
+
private let pluginVersion: String = "8.3.2"
|
|
15
15
|
public let identifier = "NativeBiometricPlugin"
|
|
16
16
|
public let jsName = "NativeBiometric"
|
|
17
17
|
public let pluginMethods: [CAPPluginMethod] = [
|
package/package.json
CHANGED