@aparajita/capacitor-biometric-auth 5.0.0 → 5.0.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.
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # capacitor-biometric-auth  [![npm version](https://badge.fury.io/js/@aparajita%2Fcapacitor-biometric-auth.svg)](https://badge.fury.io/js/@aparajita%2Fcapacitor-biometric-auth)
4
4
 
5
- This plugin for [Capacitor 4](https://capacitorjs.com) provides access to native biometry on iOS and Android. It supports every type of biometry and every configuration option on both platforms. In addition, biometry is simulated on the web so you can test your logic without making any changes to your code.
5
+ This plugin for [Capacitor 5](https://capacitorjs.com) provides access to native biometry on iOS and Android. It supports every type of biometry and every configuration option on both platforms. In addition, biometry is simulated on the web so you can test your logic without making any changes to your code.
6
6
 
7
- 👉 **NOTE:** This plugin only works with Capacitor 4. If you are upgrading from the Capacitor 2 version, note that the plugin name has changed to `BiometricAuth`.
7
+ 👉 **NOTE:** This plugin only works with Capacitor 5. If you are upgrading from the Capacitor 2 version, note that the plugin name has changed to `BiometricAuth`.
8
8
 
9
9
  🛑 **BREAKING CHANGE:** If you are upgrading from a version prior to 3.0.0, please note that `androidMaxAttempts` is no longer supported. See the documentation for [`authenticate()`](#authenticate) for more information.
10
10
 
@@ -30,7 +30,8 @@ public class AuthActivity extends AppCompatActivity {
30
30
  executor = command -> new Handler(this.getMainLooper()).post(command);
31
31
  }
32
32
 
33
- BiometricPrompt.PromptInfo.Builder builder = new BiometricPrompt.PromptInfo.Builder();
33
+ BiometricPrompt.PromptInfo.Builder builder =
34
+ new BiometricPrompt.PromptInfo.Builder();
34
35
  Intent intent = getIntent();
35
36
  String title = intent.getStringExtra(BiometricAuthNative.TITLE);
36
37
  String subtitle = intent.getStringExtra(BiometricAuthNative.SUBTITLE);
@@ -54,9 +55,7 @@ public class AuthActivity extends AppCompatActivity {
54
55
  title = "Authenticate";
55
56
  }
56
57
 
57
- builder.setTitle(title)
58
- .setSubtitle(subtitle)
59
- .setDescription(description);
58
+ builder.setTitle(title).setSubtitle(subtitle).setDescription(description);
60
59
 
61
60
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
62
61
  int authenticators = BiometricManager.Authenticators.BIOMETRIC_WEAK;
@@ -128,7 +127,10 @@ public class AuthActivity extends AppCompatActivity {
128
127
  intent
129
128
  .putExtra(prefix + BiometricAuthNative.RESULT_TYPE, resultType.toString())
130
129
  .putExtra(prefix + BiometricAuthNative.RESULT_ERROR_CODE, errorCode)
131
- .putExtra(prefix + BiometricAuthNative.RESULT_ERROR_MESSAGE, errorMessage);
130
+ .putExtra(
131
+ prefix + BiometricAuthNative.RESULT_ERROR_MESSAGE,
132
+ errorMessage
133
+ );
132
134
 
133
135
  setResult(RESULT_OK, intent);
134
136
  finish();
@@ -95,13 +95,17 @@ public class BiometricAuthNative extends Plugin {
95
95
  int biometryResult;
96
96
 
97
97
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
98
- biometryResult = manager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK);
98
+ biometryResult =
99
+ manager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK);
99
100
  } else {
100
101
  biometryResult = manager.canAuthenticate();
101
102
  }
102
103
 
103
104
  JSObject ret = new JSObject();
104
- ret.put("isAvailable", biometryResult == BiometricManager.BIOMETRIC_SUCCESS);
105
+ ret.put(
106
+ "isAvailable",
107
+ biometryResult == BiometricManager.BIOMETRIC_SUCCESS
108
+ );
105
109
  biometryType = getDeviceBiometryType();
106
110
  ret.put("biometryType", biometryType.getType());
107
111
 
@@ -120,10 +124,12 @@ public class BiometricAuthNative extends Plugin {
120
124
  reason = "There is no biometric hardware on this device.";
121
125
  break;
122
126
  case BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED:
123
- reason = "The user can’t authenticate because a security vulnerability has been discovered with one or more hardware sensors.";
127
+ reason =
128
+ "The user can’t authenticate because a security vulnerability has been discovered with one or more hardware sensors.";
124
129
  break;
125
130
  case BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED:
126
- reason = "The user can’t authenticate because the specified options are incompatible with the current Android version.";
131
+ reason =
132
+ "The user can’t authenticate because the specified options are incompatible with the current Android version.";
127
133
  break;
128
134
  case BiometricManager.BIOMETRIC_STATUS_UNKNOWN:
129
135
  reason = "Unable to determine whether the user can authenticate.";
@@ -213,7 +219,9 @@ public class BiometricAuthNative extends Plugin {
213
219
 
214
220
  if (data != null) {
215
221
  resultTypeName =
216
- data.getStringExtra(RESULT_EXTRA_PREFIX + BiometricAuthNative.RESULT_TYPE);
222
+ data.getStringExtra(
223
+ RESULT_EXTRA_PREFIX + BiometricAuthNative.RESULT_TYPE
224
+ );
217
225
  }
218
226
 
219
227
  if (resultTypeName == null) {
@@ -3,5 +3,5 @@ package com.aparajita.capacitor.biometricauth;
3
3
  public enum BiometryResultType {
4
4
  SUCCESS,
5
5
  FAILURE,
6
- ERROR
6
+ ERROR,
7
7
  }
@@ -18,7 +18,7 @@ public class BiometricAuthNative: CAPPlugin {
18
18
  LAError.userFallback.rawValue: "userFallback",
19
19
  LAError.biometryLockout.rawValue: "biometryLockout",
20
20
  LAError.biometryNotAvailable.rawValue: "biometryNotAvailable",
21
- LAError.biometryNotEnrolled.rawValue: "biometryNotEnrolled",
21
+ LAError.biometryNotEnrolled.rawValue: "biometryNotEnrolled"
22
22
  ]
23
23
 
24
24
  var canEvaluatePolicy = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aparajita/capacitor-biometric-auth",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Provides access to the native biometric auth APIs for Capacitor apps",
5
5
  "author": "Aparajita Fishman",
6
6
  "license": "MIT",
@@ -62,10 +62,10 @@
62
62
  "@ionic/swiftlint-config": "^1.1.2",
63
63
  "@rollup/plugin-json": "^6.0.0",
64
64
  "@types/node": "^20.3.1",
65
- "@typescript-eslint/eslint-plugin": "^5.59.11",
66
- "@typescript-eslint/parser": "^5.59.11",
67
- "commit-and-tag-version": "^11.2.1",
68
- "eslint": "^8.42.0",
65
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
66
+ "@typescript-eslint/parser": "^5.60.0",
67
+ "commit-and-tag-version": "^11.2.2",
68
+ "eslint": "^8.43.0",
69
69
  "eslint-config-prettier": "^8.8.0",
70
70
  "eslint-config-standard": "^17.1.0",
71
71
  "eslint-import-resolver-typescript": "^3.5.5",
@@ -90,9 +90,9 @@
90
90
  "scripts": {
91
91
  "clean": "rimraf dist",
92
92
  "lint.eslint": "eslint --fix --cache --ext .js,.cjs,.mjs,.ts --max-warnings 0",
93
- "lint.prettier": "prettier --write --cache --list-different",
93
+ "lint.prettier": "prettier --write --plugin ./node_modules/prettier-plugin-java --cache --list-different",
94
94
  "lint.tsc": "tsc --noEmit",
95
- "lint": "pnpm lint.eslint . && pnpm lint.prettier . && pnpm lint.tsc",
95
+ "lint": "pnpm lint.eslint . && pnpm lint.prettier . && pnpm lint.tsc && swiftly ios",
96
96
  "prebuilder": "pnpm clean",
97
97
  "builder": "tsc ${SOURCE_MAP:-} && rollup -c rollup.config.mjs",
98
98
  "prebuild": "pnpm lint",