@aparajita/capacitor-biometric-auth 1.0.7 → 2.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.
@@ -0,0 +1,262 @@
1
+ package com.aparajita.capacitor.biometricauth;
2
+
3
+ import android.annotation.SuppressLint;
4
+ import android.app.Activity;
5
+ import android.content.Intent;
6
+ import android.content.pm.PackageManager;
7
+ import androidx.activity.result.ActivityResult;
8
+ import androidx.biometric.BiometricManager;
9
+ import androidx.biometric.BiometricPrompt;
10
+ import com.getcapacitor.JSObject;
11
+ import com.getcapacitor.Plugin;
12
+ import com.getcapacitor.PluginCall;
13
+ import com.getcapacitor.PluginMethod;
14
+ import com.getcapacitor.annotation.ActivityCallback;
15
+ import com.getcapacitor.annotation.CapacitorPlugin;
16
+ import java.util.HashMap;
17
+
18
+ @SuppressLint("RestrictedApi")
19
+ @CapacitorPlugin(name = "BiometricAuth")
20
+ public class BiometricAuth extends Plugin {
21
+
22
+ public static final String RESULT_TYPE = "type";
23
+ public static final String RESULT_ERROR_CODE = "errorCode";
24
+ public static final String RESULT_ERROR_MESSAGE = "errorMessage";
25
+ public static final String TITLE = "androidTitle";
26
+ public static final String SUBTITLE = "androidSubtitle";
27
+ public static final String REASON = "reason";
28
+ public static final String CANCEL_TITLE = "cancelTitle";
29
+ public static final String DEVICE_CREDENTIAL = "allowDeviceCredential";
30
+ public static final String MAX_ATTEMPTS = "androidMaxAttempts";
31
+ public static final int DEFAULT_MAX_ATTEMPTS = 3;
32
+ // Error code when biometry is not recognized
33
+ public static final String BIOMETRIC_FAILURE = "authenticationFailed";
34
+ // Maps biometry error numbers to string error codes
35
+ private static final HashMap<Integer, String> biometryErrorCodeMap;
36
+ private static final HashMap<BiometryType, String> biometryNameMap;
37
+ private static final String INVALID_CONTEXT_ERROR = "invalidContext";
38
+ public static String RESULT_EXTRA_PREFIX;
39
+
40
+ static {
41
+ biometryErrorCodeMap = new HashMap<>();
42
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_CANCELED, "systemCancel");
43
+ biometryErrorCodeMap.put(
44
+ BiometricPrompt.ERROR_HW_NOT_PRESENT,
45
+ "biometryNotAvailable"
46
+ );
47
+ biometryErrorCodeMap.put(
48
+ BiometricPrompt.ERROR_HW_UNAVAILABLE,
49
+ "biometryNotAvailable"
50
+ );
51
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_LOCKOUT, "biometryLockout");
52
+ biometryErrorCodeMap.put(
53
+ BiometricPrompt.ERROR_LOCKOUT_PERMANENT,
54
+ "biometryLockout"
55
+ );
56
+ biometryErrorCodeMap.put(
57
+ BiometricPrompt.ERROR_NEGATIVE_BUTTON,
58
+ "userCancel"
59
+ );
60
+ biometryErrorCodeMap.put(
61
+ BiometricPrompt.ERROR_NO_BIOMETRICS,
62
+ "biometryNotEnrolled"
63
+ );
64
+ biometryErrorCodeMap.put(
65
+ BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL,
66
+ "noDeviceCredential"
67
+ );
68
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_NO_SPACE, "systemCancel");
69
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_TIMEOUT, "systemCancel");
70
+ biometryErrorCodeMap.put(
71
+ BiometricPrompt.ERROR_UNABLE_TO_PROCESS,
72
+ "systemCancel"
73
+ );
74
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_USER_CANCELED, "userCancel");
75
+ biometryErrorCodeMap.put(BiometricPrompt.ERROR_VENDOR, "systemCancel");
76
+ }
77
+
78
+ static {
79
+ biometryNameMap = new HashMap<>();
80
+ biometryNameMap.put(BiometryType.NONE, "No Authentication");
81
+ biometryNameMap.put(BiometryType.FINGERPRINT, "Fingerprint Authentication");
82
+ biometryNameMap.put(BiometryType.FACE, "Face Authentication");
83
+ biometryNameMap.put(BiometryType.IRIS, "Iris Authentication");
84
+ }
85
+
86
+ private BiometryType biometryType;
87
+
88
+ /**
89
+ * Check the device's availability and type of biometric authentication.
90
+ */
91
+ @PluginMethod
92
+ public void checkBiometry(PluginCall call) {
93
+ BiometricManager manager = BiometricManager.from(getContext());
94
+
95
+ int result = manager.canAuthenticate();
96
+
97
+ JSObject ret = new JSObject();
98
+ ret.put("isAvailable", result == BiometricManager.BIOMETRIC_SUCCESS);
99
+ biometryType = getDeviceBiometryType();
100
+ ret.put("biometryType", biometryType.getType());
101
+
102
+ String reason = "";
103
+
104
+ switch (result) {
105
+ case BiometricManager.BIOMETRIC_SUCCESS:
106
+ break;
107
+ case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
108
+ reason = "Biometry hardware is present, but currently unavailable.";
109
+ break;
110
+ case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
111
+ reason = "The user does not have any biometrics enrolled.";
112
+ break;
113
+ case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
114
+ reason = "There is no biometric hardware on this device.";
115
+ break;
116
+ }
117
+
118
+ ret.put("reason", reason);
119
+ call.resolve(ret);
120
+ }
121
+
122
+ private BiometryType getDeviceBiometryType() {
123
+ PackageManager manager = getContext().getPackageManager();
124
+
125
+ if (manager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
126
+ return BiometryType.FINGERPRINT;
127
+ }
128
+
129
+ if (manager.hasSystemFeature(PackageManager.FEATURE_FACE)) {
130
+ return BiometryType.FACE;
131
+ }
132
+
133
+ if (manager.hasSystemFeature(PackageManager.FEATURE_IRIS)) {
134
+ return BiometryType.IRIS;
135
+ }
136
+
137
+ return BiometryType.NONE;
138
+ }
139
+
140
+ /**
141
+ * Prompt the user for biometric authentication.
142
+ */
143
+ @PluginMethod
144
+ public void authenticate(final PluginCall call) {
145
+ // The result of an intent is supposed to have the package name as a prefix
146
+ RESULT_EXTRA_PREFIX = getContext().getPackageName() + ".";
147
+
148
+ Intent intent = new Intent(getContext(), AuthActivity.class);
149
+
150
+ // Pass the options to the activity
151
+ intent.putExtra(
152
+ TITLE,
153
+ call.getString(TITLE, biometryNameMap.get(biometryType))
154
+ );
155
+ intent.putExtra(SUBTITLE, call.getString(SUBTITLE));
156
+ intent.putExtra(REASON, call.getString(REASON));
157
+ intent.putExtra(CANCEL_TITLE, call.getString(CANCEL_TITLE));
158
+ intent.putExtra(
159
+ DEVICE_CREDENTIAL,
160
+ call.getBoolean(DEVICE_CREDENTIAL, false)
161
+ );
162
+
163
+ // Just in case the developer does something dumb like using a number < 1...
164
+ Integer maxAttemptsConfig = call.getInt(MAX_ATTEMPTS, DEFAULT_MAX_ATTEMPTS);
165
+ int maxAttempts = Math.max(
166
+ maxAttemptsConfig == null ? 0 : maxAttemptsConfig,
167
+ 1
168
+ );
169
+ intent.putExtra(MAX_ATTEMPTS, maxAttempts);
170
+
171
+ startActivityForResult(call, intent, "authenticateResult");
172
+ }
173
+
174
+ @ActivityCallback
175
+ protected void authenticateResult(PluginCall call, ActivityResult result) {
176
+ int resultCode = result.getResultCode();
177
+
178
+ // If the system canceled the activity, we might get RESULT_CANCELED in resultCode.
179
+ // In that case return that immediately, because there won't be any data.
180
+ if (resultCode == Activity.RESULT_CANCELED) {
181
+ call.reject(
182
+ "The system canceled authentication",
183
+ biometryErrorCodeMap.get(BiometricPrompt.ERROR_CANCELED)
184
+ );
185
+ return;
186
+ }
187
+
188
+ // Convert the string result type to an enum
189
+ Intent data = result.getData();
190
+ String resultTypeName = null;
191
+
192
+ if (data != null) {
193
+ resultTypeName =
194
+ data.getStringExtra(RESULT_EXTRA_PREFIX + BiometricAuth.RESULT_TYPE);
195
+ }
196
+
197
+ if (resultTypeName == null) {
198
+ call.reject(
199
+ "Missing data in the result of the activity",
200
+ INVALID_CONTEXT_ERROR
201
+ );
202
+ return;
203
+ }
204
+
205
+ BiometryResultType resultType;
206
+
207
+ try {
208
+ resultType = BiometryResultType.valueOf(resultTypeName);
209
+ } catch (IllegalArgumentException e) {
210
+ call.reject(
211
+ "Invalid data in the result of the activity",
212
+ INVALID_CONTEXT_ERROR
213
+ );
214
+ return;
215
+ }
216
+
217
+ int errorCode = data.getIntExtra(
218
+ RESULT_EXTRA_PREFIX + BiometricAuth.RESULT_ERROR_CODE,
219
+ 0
220
+ );
221
+ String errorMessage = data.getStringExtra(
222
+ RESULT_EXTRA_PREFIX + BiometricAuth.RESULT_ERROR_MESSAGE
223
+ );
224
+
225
+ switch (resultType) {
226
+ case SUCCESS:
227
+ call.resolve();
228
+ break;
229
+ case FAILURE:
230
+ // Biometry was successfully presented but was not recognized
231
+ call.reject(errorMessage, BIOMETRIC_FAILURE);
232
+ break;
233
+ case ERROR:
234
+ // The user cancelled, the system cancelled, or some error occurred.
235
+ // If the user cancelled, errorMessage is the text of the "negative" button,
236
+ // which is not especially descriptive.
237
+ if (errorCode == BiometricPrompt.ERROR_NEGATIVE_BUTTON) {
238
+ errorMessage = "Cancel button was pressed";
239
+ }
240
+
241
+ call.reject(errorMessage, biometryErrorCodeMap.get(errorCode));
242
+ break;
243
+ }
244
+ }
245
+
246
+ enum BiometryType {
247
+ NONE(0),
248
+ FINGERPRINT(3),
249
+ FACE(4),
250
+ IRIS(5);
251
+
252
+ private final int type;
253
+
254
+ BiometryType(int type) {
255
+ this.type = type;
256
+ }
257
+
258
+ public int getType() {
259
+ return this.type;
260
+ }
261
+ }
262
+ }
@@ -1,7 +1,7 @@
1
1
  package com.aparajita.capacitor.biometricauth;
2
2
 
3
3
  public enum BiometryResultType {
4
- SUCCESS,
5
- FAILURE,
6
- ERROR
4
+ SUCCESS,
5
+ FAILURE,
6
+ ERROR
7
7
  }
@@ -1,9 +1,5 @@
1
- declare module '@capacitor/core' {
2
- interface PluginRegistry {
3
- WSBiometricAuth: WSBiometricAuthPlugin;
4
- }
5
- }
6
- import { PluginResultError } from '@capacitor/core';
1
+ import type { DecoratedNativePlugin } from '@aparajita/capacitor-native-decorator';
2
+ import type { PluginListenerHandle, PluginResultError } from '@capacitor/core';
7
3
  export declare enum BiometryType {
8
4
  /**
9
5
  * No biometry is available
@@ -32,8 +28,8 @@ export declare enum BiometryType {
32
28
  }
33
29
  export interface AuthenticateOptions {
34
30
  /**
35
- * The reason for requesting authentication. Displays in the authentication dialog presented to the user.
36
- * If not supplied, a default message is displayed.
31
+ * The reason for requesting authentication. Displays in the authentication dialog
32
+ * presented to the user. If not supplied, a default message is displayed.
37
33
  */
38
34
  reason?: string;
39
35
  /**
@@ -53,27 +49,27 @@ export interface AuthenticateOptions {
53
49
  * Default: "Cancel"
54
50
  */
55
51
  cancelTitle?: string;
56
- /***
52
+ /**
57
53
  * If true, allows for authentication using device unlock credentials. Default is false.
58
54
  *
59
55
  * iOS:
60
56
  * If biometry is available, enrolled, and not disabled, the system uses that first.
61
- * After the first Touch ID failure or second Face ID failure, if iosFallbackTitle
57
+ * After the first Touch ID failure or second Face ID failure, if `iosFallbackTitle`
62
58
  * is not an empty string, a fallback button appears in the authentication dialog.
63
59
  * If the user taps the fallback button, the system prompts the user for the device
64
- * passcode or the user’s password. If iosFallbackTitle is an empty string, no
60
+ * passcode or the user’s password. If `iosFallbackTitle` is an empty string, no
65
61
  * fallback button will appear.
66
62
  *
67
63
  * If biometry is not available, enrolled and enabled, and a passcode is set,
68
64
  * the system immediately prompts the user for the device passcode or user’s password.
69
- * Authentication fails with the error code passcodeNotSet if the device passcode isn’t enabled.
65
+ * Authentication fails with the error code `passcodeNotSet` if the device passcode isn’t enabled.
70
66
  *
71
- * If a passcode is not set on the device, a passcodeNotSet error is returned.
67
+ * If a passcode is not set on the device, a `passcodeNotSet` error is returned.
72
68
  *
73
69
  * The system disables passcode authentication after 6 unsuccessful attempts, with progressively
74
70
  * increasing delays between attempts.
75
71
  *
76
- * The title of the fallback button may be customized by setting iosFallbackTitle to
72
+ * The title of the fallback button may be customized by setting `iosFallbackTitle` to
77
73
  * a non-empty string.
78
74
  *
79
75
  * Android:
@@ -88,12 +84,12 @@ export interface AuthenticateOptions {
88
84
  * — for example, because the system doesn’t recognize the presented finger,
89
85
  * or after several failed attempts to recognize the user’s face.
90
86
  *
91
- * If allowDeviceCredential is false, tapping this button dismisses the
87
+ * If `allowDeviceCredential` is false, tapping this button dismisses the
92
88
  * authentication dialog and returns the error code userFallback. If undefined,
93
89
  * the localized systetm default title is used. Passing an empty string
94
90
  * hides the fallback button completely.
95
91
  *
96
- * If allowDeviceCredential is true and this is undefined,
92
+ * If `allowDeviceCredential` is true and this is undefined,
97
93
  * the localized system default title is used.
98
94
  */
99
95
  iosFallbackTitle?: string;
@@ -107,12 +103,12 @@ export interface AuthenticateOptions {
107
103
  androidSubtitle?: string;
108
104
  /**
109
105
  * The maximum number of failed biometric verification attempts before
110
- * returning BiometryError.authenticationFailed. The default is 3.
106
+ * returning `BiometryError.authenticationFailed`. The default is 3.
111
107
  */
112
108
  androidMaxAttempts?: number;
113
109
  }
114
110
  /**
115
- * If the authenticate() method throws an exception, the error object
111
+ * If the `authenticate()` method throws an exception, the error object
116
112
  * contains a .code property which will contain one of these strings,
117
113
  * indicating what the error was.
118
114
  *
@@ -158,42 +154,39 @@ export interface CheckBiometryResult {
158
154
  reason: string;
159
155
  }
160
156
  /**
161
- * The signature of the callback passed to addResumeListener().
157
+ * The signature of the callback passed to `addResumeListener()`.
162
158
  */
163
159
  export declare type ResumeListener = (info: CheckBiometryResult) => void;
164
- export interface WSBiometricAuthPlugin {
160
+ export interface BiometricAuthPlugin extends DecoratedNativePlugin {
165
161
  /**
166
162
  * Check to see what biometry type (if any) is available.
167
- * For testing on the web, a BiometryType name (case-sensitive)
168
- * may be specified as an environment variable. For example:
169
- *
170
- * WS_BIOMETRY_TYPE=touchId
171
163
  */
172
- checkBiometry(): Promise<CheckBiometryResult>;
164
+ checkBiometry: () => Promise<CheckBiometryResult>;
173
165
  /**
174
166
  * web only
175
167
  *
176
168
  * On the web, this method allows you to dynamically simulate
177
- * different types of biometry. You may either pass a BiometryType enum
178
- * or the string name of a BiometryType. If a string is passed and
179
- * it isn't a valid
169
+ * different types of biometry. You may either pass a `BiometryType` enum
170
+ * or the string name of a `BiometryType`. If a string is passed and
171
+ * it isn't a valid value, nothing happens.
180
172
  */
181
- setBiometryType(type: BiometryType | string | undefined): void;
173
+ setBiometryType: (type: BiometryType | string | undefined) => void;
182
174
  /**
183
175
  * Prompt the user for authentication. If authorization fails for any reason,
184
- * the promise is rejected with a BiometryError.
176
+ * the promise is rejected with a `BiometryError`.
185
177
  *
186
178
  * @param {AuthenticateOptions} options
187
179
  * @returns {Promise<void>}
188
180
  * @rejects {BiometryError}
189
181
  */
190
- authenticate(options?: AuthenticateOptions): Promise<void>;
182
+ authenticate: (options?: AuthenticateOptions) => Promise<void>;
191
183
  /**
192
184
  * Register a function that will be called when the app resumes.
193
- * The function will be passed the result of checkBiometry().
185
+ * The function will be passed the result of `checkBiometry()`.
194
186
  *
195
187
  * @param {ResumeListener} listener
196
188
  * @returns {boolean} true if the listener is successfully added
197
189
  */
198
- addResumeListener(listener: ResumeListener): void;
190
+ addResumeListener: (listener: ResumeListener) => Promise<PluginListenerHandle>;
199
191
  }
192
+ export declare const kPluginName = "BiometricAuth";
@@ -26,7 +26,7 @@ export var BiometryType;
26
26
  BiometryType[BiometryType["irisAuthentication"] = 5] = "irisAuthentication";
27
27
  })(BiometryType || (BiometryType = {}));
28
28
  /**
29
- * If the authenticate() method throws an exception, the error object
29
+ * If the `authenticate()` method throws an exception, the error object
30
30
  * contains a .code property which will contain one of these strings,
31
31
  * indicating what the error was.
32
32
  *
@@ -54,4 +54,4 @@ export class BiometryError {
54
54
  this.code = BiometryErrorType[code];
55
55
  }
56
56
  }
57
- //# sourceMappingURL=definitions.js.map
57
+ export const kPluginName = 'BiometricAuth';
@@ -1,2 +1,5 @@
1
+ import type { BiometricAuthPlugin } from './definitions';
2
+ declare const biometricAuth: BiometricAuthPlugin;
1
3
  export * from './definitions';
2
- export * from './web';
4
+ export { biometricAuth as BiometricAuth };
5
+ export { getBiometryName } from './web';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,18 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ import { kPluginName } from './definitions';
3
+ import { name } from './package.json';
4
+ import { BiometricAuth } from './web';
5
+ console.log(`loaded ${name}`);
6
+ // Because we are using @aparajita/capacitor-native-decorator,
7
+ // we have one version of the TS code to rule them all, and there
8
+ // is no need to lazy load. 😁
9
+ const plugin = new BiometricAuth();
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ const biometricAuth = registerPlugin(kPluginName, {
12
+ web: plugin,
13
+ ios: plugin,
14
+ android: plugin
15
+ });
1
16
  export * from './definitions';
2
- export * from './web';
3
- //# sourceMappingURL=index.js.map
17
+ export { biometricAuth as BiometricAuth };
18
+ export { getBiometryName } from './web';
@@ -0,0 +1,113 @@
1
+ {
2
+ "name": "@aparajita/capacitor-biometric-auth",
3
+ "version": "2.0.1",
4
+ "description": "Provides access to the native biometric auth APIs for Capacitor apps",
5
+ "author": "Aparajita Fishman",
6
+ "license": "MIT",
7
+ "main": "dist/plugin.cjs.js",
8
+ "module": "dist/esm/index.js",
9
+ "types": "dist/esm/index.d.ts",
10
+ "unpkg": "dist/plugin.js",
11
+ "engines": {
12
+ "node": ">=16.15.1"
13
+ },
14
+ "files": [
15
+ "android/src/main/",
16
+ "android/build.gradle",
17
+ "dist/",
18
+ "ios/Plugin/",
19
+ "*.podspec",
20
+ "LICENSE"
21
+ ],
22
+ "scripts": {
23
+ "clean": "rimraf ./dist",
24
+ "build": "pnpm check && pnpm build.only",
25
+ "build.dev": "pnpm check && pnpm build.only.dev",
26
+ "build.only": "pnpm clean && tsc $SOURCE_MAP && pnpm rollup && make-ios-plugin && pnpm docgen",
27
+ "build.only.dev": "SOURCE_MAP=--sourceMap pnpm build.only",
28
+ "rollup": "rollup -c rollup.config.mjs",
29
+ "watch": "nodemon -w ./src -w tsconfig.json -w rollup.config.mjs --exec 'pnpm build --silent' -e ts",
30
+ "lint": "eslint . && pnpm typecheck",
31
+ "lint.fix": "eslint --fix . && pnpm typecheck",
32
+ "typecheck": "tsc --noEmit",
33
+ "lint.swift": "pnpm swiftlint",
34
+ "prettier": "prettier --check \"**/*.{css,html,ts,js,json,java}\"",
35
+ "prettier.fix": "pnpm prettier --write",
36
+ "swiftlint": "swiftly ios",
37
+ "swiftlint.fix": "swiftly --fix ios",
38
+ "check": "pnpm lint && pnpm prettier && pnpm swiftlint",
39
+ "check.fix": "pnpm lint.fix && pnpm prettier.fix && pnpm swiftlint.fix",
40
+ "docgen": "docgen --api BiometricAuthPlugin --output-readme README.md && docgen-format",
41
+ "verify": "pnpm verify:ios && pnpm verify:android && pnpm verify:web",
42
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
43
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
44
+ "verify:web": "pnpm build",
45
+ "push": "git push --follow-tags origin main",
46
+ "release.check": "commit-and-tag-version $VERSION --dry-run",
47
+ "release": "commit-and-tag-version $VERSION && pnpm push && pnpm publish"
48
+ },
49
+ "keywords": [
50
+ "capacitor",
51
+ "plugin",
52
+ "native",
53
+ "biometry",
54
+ "biometric",
55
+ "auth",
56
+ "faceid",
57
+ "touchid"
58
+ ],
59
+ "capacitor": {
60
+ "ios": {
61
+ "src": "ios"
62
+ },
63
+ "android": {
64
+ "src": "android"
65
+ }
66
+ },
67
+ "swiftlint": "@ionic/swiftlint-config",
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "https://github.com/aparajita/capacitor-biometric-auth"
71
+ },
72
+ "bugs": {
73
+ "url": "https://github.com/aparajita/capacitor-biometric-auth/issues"
74
+ },
75
+ "devDependencies": {
76
+ "@aparajita/capacitor-docgen": "github:aparajita/capacitor-docgen",
77
+ "@aparajita/capacitor-docgen-format": "github:aparajita/capacitor-docgen-format",
78
+ "@aparajita/eslint-config-base": "^1.1.2",
79
+ "@aparajita/prettier-config": "^1.0.0",
80
+ "@aparajita/swiftly": "^1.0.0",
81
+ "@capacitor/core": "^3.6.0",
82
+ "@ionic/swiftlint-config": "^1.1.2",
83
+ "@rollup/plugin-json": "^4.1.0",
84
+ "@types/node": "^18.0.0",
85
+ "@typescript-eslint/eslint-plugin": "^5.30.3",
86
+ "@typescript-eslint/parser": "^5.30.3",
87
+ "chalk": "^5.0.1",
88
+ "commit-and-tag-version": "^10.0.1",
89
+ "eslint": "^8.19.0",
90
+ "eslint-config-prettier": "^8.5.0",
91
+ "eslint-config-standard": "^17.0.0",
92
+ "eslint-import-resolver-typescript": "^3.1.4",
93
+ "eslint-plugin-import": "^2.26.0",
94
+ "eslint-plugin-n": "^15.2.3",
95
+ "eslint-plugin-prettier": "^4.2.1",
96
+ "eslint-plugin-promise": "^6.0.0",
97
+ "nodemon": "^2.0.18",
98
+ "prettier": "^2.7.1",
99
+ "prettier-plugin-java": "^1.6.2",
100
+ "rimraf": "^3.0.2",
101
+ "rollup": "^2.75.7",
102
+ "typescript": "~4.7.4"
103
+ },
104
+ "dependencies": {
105
+ "@aparajita/capacitor-native-decorator": "link:../capacitor-native-decorator",
106
+ "@capacitor/android": "^3.6.0",
107
+ "@capacitor/app": "^1.1.1",
108
+ "@capacitor/ios": "^3.6.0"
109
+ },
110
+ "peerDependencies": {
111
+ "@capacitor/core": "^3.6.0"
112
+ }
113
+ }
package/dist/esm/web.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import { CheckBiometryResult, AuthenticateOptions, BiometryType, WSBiometricAuthPlugin, ResumeListener } from './definitions';
3
- export declare class WSBiometricAuthWeb extends WebPlugin implements WSBiometricAuthPlugin {
2
+ import type { PluginListenerHandle } from '@capacitor/core';
3
+ import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult, ResumeListener } from './definitions';
4
+ import { BiometryType } from './definitions';
5
+ export declare class BiometricAuth extends WebPlugin implements BiometricAuthPlugin {
4
6
  private biometryType;
5
- constructor();
7
+ getRegisteredPluginName(): string;
6
8
  setBiometryType(type: BiometryType | string | undefined): void;
7
9
  checkBiometry(): Promise<CheckBiometryResult>;
8
10
  authenticate(options?: AuthenticateOptions): Promise<void>;
9
- addResumeListener(listener: ResumeListener): void;
11
+ addResumeListener(listener: ResumeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
10
12
  }
11
13
  /**
12
14
  * Return a human-readable name for a BiometryType.
@@ -15,5 +17,3 @@ export declare class WSBiometricAuthWeb extends WebPlugin implements WSBiometric
15
17
  * @returns {string}
16
18
  */
17
19
  export declare function getBiometryName(type: BiometryType): string;
18
- declare const WSBiometricAuth: WSBiometricAuthWeb;
19
- export { WSBiometricAuth };