@capacitor-community/sqlite 3.4.1-2 → 3.4.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.
@@ -29,6 +29,7 @@ import java.io.IOException;
29
29
  import java.nio.charset.Charset;
30
30
  import java.nio.charset.StandardCharsets;
31
31
  import java.security.GeneralSecurityException;
32
+ import java.security.KeyStore;
32
33
  import java.util.ArrayList;
33
34
  import java.util.Arrays;
34
35
  import java.util.Collections;
@@ -63,7 +64,7 @@ public class CapacitorSQLite {
63
64
  private Boolean biometricAuth = false;
64
65
  private String biometricTitle;
65
66
  private String biometricSubTitle;
66
- private int VALIDITY_DURATION = 1;
67
+ private int VALIDITY_DURATION = 5;
67
68
  private RetHandler rHandler = new RetHandler();
68
69
  private PluginCall call;
69
70
 
@@ -86,11 +87,18 @@ public class CapacitorSQLite {
86
87
  @Override
87
88
  public void onSuccess(BiometricPrompt.AuthenticationResult result) {
88
89
  try {
89
- masterKeyAlias =
90
- new MasterKey.Builder(context)
91
- .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
92
- .setUserAuthenticationRequired(true, VALIDITY_DURATION)
93
- .build();
90
+ KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
91
+ ks.load(null);
92
+ Enumeration<String> aliases = ks.aliases();
93
+ if (aliases.hasMoreElements()) {
94
+ masterKeyAlias =
95
+ new MasterKey.Builder(context)
96
+ .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
97
+ .setUserAuthenticationRequired(true, VALIDITY_DURATION)
98
+ .build();
99
+ } else {
100
+ masterKeyAlias = new MasterKey.Builder(context).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build();
101
+ }
94
102
  setSharedPreferences();
95
103
  notifyBiometricEvent(true, null);
96
104
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/sqlite",
3
- "version": "3.4.1-2",
3
+ "version": "3.4.1-3",
4
4
  "description": "Community plugin for native & electron SQLite databases",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",