@capgo/capacitor-native-biometric 8.0.4 → 8.1.0
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 +146 -1
- package/android/src/main/java/ee/forgr/biometric/AuthActivity.java +6 -0
- package/android/src/main/java/ee/forgr/biometric/NativeBiometric.java +21 -0
- package/dist/docs.json +6 -0
- package/dist/esm/definitions.d.ts +2 -1
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js +2 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NativeBiometricPlugin/NativeBiometricPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Use biometrics confirm device owner presence or authenticate users. A couple of
|
|
|
13
13
|
|
|
14
14
|
A **free**, **comprehensive** biometric authentication plugin with secure credential storage:
|
|
15
15
|
|
|
16
|
-
- **All biometric types** - Face ID, Touch ID, Fingerprint, Face Authentication, Iris
|
|
16
|
+
- **All biometric types** - Face ID, Touch ID, Fingerprint, Face Authentication, Iris, and Device Credentials (PIN, pattern, password)
|
|
17
17
|
- **Secure credential storage** - Keychain (iOS) and Keystore (Android) integration
|
|
18
18
|
- **Flexible fallback** - Optional passcode fallback when biometrics unavailable
|
|
19
19
|
- **Customizable UI** - Full control over prompts, titles, descriptions, button text
|
|
@@ -27,12 +27,106 @@ Perfect for banking apps, password managers, authentication flows, and any app r
|
|
|
27
27
|
|
|
28
28
|
The most complete doc is available here: https://capgo.app/docs/plugins/native-biometric/
|
|
29
29
|
|
|
30
|
+
## ⚠️ Security Considerations
|
|
31
|
+
|
|
32
|
+
### Important: verifyIdentity() Can Be Bypassed on Rooted/Jailbroken Devices
|
|
33
|
+
|
|
34
|
+
The `verifyIdentity()` method **should not be used as the sole authentication mechanism** for sensitive operations. On rooted Android devices or jailbroken iOS devices, attackers can use tools like Frida, Xposed, or similar frameworks to:
|
|
35
|
+
|
|
36
|
+
- Hook the JavaScript bridge and force `verifyIdentity()` to return success
|
|
37
|
+
- Intercept native method calls and bypass biometric authentication
|
|
38
|
+
- Modify the app's runtime behavior to skip authentication checks
|
|
39
|
+
|
|
40
|
+
### Recommended Security Practices
|
|
41
|
+
|
|
42
|
+
1. **Use Root/Jailbreak Detection**: Protect your app by detecting compromised devices. We recommend using the **[@capgo/capacitor-is-root](https://github.com/Cap-go/capacitor-is-root)** plugin to detect rooted/jailbroken devices:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { IsRoot } from '@capgo/capacitor-is-root';
|
|
46
|
+
|
|
47
|
+
async function checkDeviceSecurity() {
|
|
48
|
+
const { result } = await IsRoot.isRooted();
|
|
49
|
+
|
|
50
|
+
if (result) {
|
|
51
|
+
// Handle rooted device - show warning, restrict features, or block access
|
|
52
|
+
console.warn('Device security compromised');
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. **Never Store Sensitive Data Client-Side**: Don't rely on locally stored credentials for critical authentication. Use `verifyIdentity()` as a convenience feature, not a security boundary.
|
|
60
|
+
|
|
61
|
+
3. **Server-Side Verification**: Always validate authentication on your backend server. Biometric authentication should be used for user convenience, with the real authentication happening server-side.
|
|
62
|
+
|
|
63
|
+
4. **Implement Additional Security Layers**:
|
|
64
|
+
- Use certificate pinning for API calls
|
|
65
|
+
- Implement server-side session management
|
|
66
|
+
- Use short-lived tokens that expire after biometric auth
|
|
67
|
+
- Add anti-tampering checks
|
|
68
|
+
|
|
69
|
+
### Secure Usage Pattern
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { NativeBiometric } from "@capgo/capacitor-native-biometric";
|
|
73
|
+
import { IsRoot } from '@capgo/capacitor-is-root';
|
|
74
|
+
|
|
75
|
+
async function secureAuthentication() {
|
|
76
|
+
// 1. Check device security first
|
|
77
|
+
const { result } = await IsRoot.isRooted();
|
|
78
|
+
if (result) {
|
|
79
|
+
// Handle rooted device appropriately
|
|
80
|
+
// Example: showSecurityWarning() could display an alert to the user
|
|
81
|
+
showSecurityWarning();
|
|
82
|
+
// Optionally: disable biometric login, require re-authentication, etc.
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// 2. Perform biometric authentication
|
|
86
|
+
try {
|
|
87
|
+
await NativeBiometric.verifyIdentity({
|
|
88
|
+
reason: "Authenticate to access your account",
|
|
89
|
+
title: "Biometric Login",
|
|
90
|
+
});
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error("Biometric authentication failed");
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 3. Get stored credentials (if needed for convenience)
|
|
97
|
+
const credentials = await NativeBiometric.getCredentials({
|
|
98
|
+
server: "www.example.com",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// 4. CRITICAL: Validate credentials with your backend server
|
|
102
|
+
// Example: validateWithServer() should send credentials to your API
|
|
103
|
+
// and verify them server-side before granting access
|
|
104
|
+
const isValid = await validateWithServer(credentials.username, credentials.password);
|
|
105
|
+
|
|
106
|
+
return isValid;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### What This Plugin Provides
|
|
111
|
+
|
|
112
|
+
This plugin provides:
|
|
113
|
+
- ✅ Convenient local biometric authentication UI
|
|
114
|
+
- ✅ Secure credential storage using Keychain (iOS) and Keystore (Android)
|
|
115
|
+
- ✅ Protection against casual unauthorized access
|
|
116
|
+
|
|
117
|
+
This plugin does NOT provide:
|
|
118
|
+
- ❌ Protection against determined attackers on compromised devices
|
|
119
|
+
- ❌ Server-side authentication or validation
|
|
120
|
+
- ❌ Root/jailbreak detection (use [@capgo/capacitor-is-root](https://github.com/Cap-go/capacitor-is-root))
|
|
121
|
+
|
|
30
122
|
## Installation (Only supports Capacitor 7)
|
|
31
123
|
|
|
32
124
|
- `npm i @capgo/capacitor-native-biometric`
|
|
33
125
|
|
|
34
126
|
## Usage
|
|
35
127
|
|
|
128
|
+
⚠️ **Important**: Before implementing biometric authentication, review the [Security Considerations](#️-security-considerations) section to understand limitations and best practices for secure implementation.
|
|
129
|
+
|
|
36
130
|
```ts
|
|
37
131
|
import { NativeBiometric, BiometryType } from "@capgo/capacitor-native-biometric";
|
|
38
132
|
|
|
@@ -65,6 +159,9 @@ async performBiometricVerification(){
|
|
|
65
159
|
const credentials = await NativeBiometric.getCredentials({
|
|
66
160
|
server: "www.example.com",
|
|
67
161
|
});
|
|
162
|
+
|
|
163
|
+
// IMPORTANT: Always validate credentials with your backend server
|
|
164
|
+
// Do not trust client-side verification alone
|
|
68
165
|
}
|
|
69
166
|
|
|
70
167
|
// Save user's credentials
|
|
@@ -74,6 +171,12 @@ NativeBiometric.setCredentials({
|
|
|
74
171
|
server: "www.example.com",
|
|
75
172
|
}).then();
|
|
76
173
|
|
|
174
|
+
// Check if credentials are already saved
|
|
175
|
+
const isSaved = await NativeBiometric.isCredentialsSaved({
|
|
176
|
+
server: "www.example.com",
|
|
177
|
+
});
|
|
178
|
+
console.log('Credentials saved:', isSaved.isSaved);
|
|
179
|
+
|
|
77
180
|
// Delete user's credentials
|
|
78
181
|
NativeBiometric.deleteCredentials({
|
|
79
182
|
server: "www.example.com",
|
|
@@ -89,6 +192,47 @@ const handle = await NativeBiometric.addListener('biometryChange', (result) => {
|
|
|
89
192
|
// await handle.remove();
|
|
90
193
|
```
|
|
91
194
|
|
|
195
|
+
### Complete Login Flow Example
|
|
196
|
+
|
|
197
|
+
This example shows how to use `isCredentialsSaved()` to check if credentials are already saved before showing a "save credentials" popup:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
// After successful login
|
|
201
|
+
async handleLoginSuccess(username: string, password: string) {
|
|
202
|
+
// Check if biometric authentication is available
|
|
203
|
+
const result = await NativeBiometric.isAvailable({ useFallback: true });
|
|
204
|
+
|
|
205
|
+
if (!result.isAvailable) {
|
|
206
|
+
// Biometrics not available - go to home page directly
|
|
207
|
+
this.navigateToHome();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Check if credentials are already saved
|
|
212
|
+
const checkCredentials = await NativeBiometric.isCredentialsSaved({
|
|
213
|
+
server: "www.example.com"
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
if (checkCredentials.isSaved) {
|
|
217
|
+
// Credentials already saved - go to home page
|
|
218
|
+
this.navigateToHome();
|
|
219
|
+
} else {
|
|
220
|
+
// No credentials saved - show save credentials popup
|
|
221
|
+
this.showSaveCredentialsPopup(username, password);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Save credentials when user confirms
|
|
226
|
+
async saveCredentials(username: string, password: string) {
|
|
227
|
+
await NativeBiometric.setCredentials({
|
|
228
|
+
username: username,
|
|
229
|
+
password: password,
|
|
230
|
+
server: "www.example.com",
|
|
231
|
+
});
|
|
232
|
+
this.navigateToHome();
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
92
236
|
### Biometric Auth Errors
|
|
93
237
|
|
|
94
238
|
This is a plugin specific list of error codes that can be thrown on verifyIdentity failure, or set as a part of isAvailable. It consolidates Android and iOS specific Authentication Error codes into one combined error list.
|
|
@@ -397,6 +541,7 @@ Callback type for biometry change listener
|
|
|
397
541
|
| **`FACE_AUTHENTICATION`** | <code>4</code> |
|
|
398
542
|
| **`IRIS_AUTHENTICATION`** | <code>5</code> |
|
|
399
543
|
| **`MULTIPLE`** | <code>6</code> |
|
|
544
|
+
| **`DEVICE_CREDENTIAL`** | <code>7</code> |
|
|
400
545
|
|
|
401
546
|
|
|
402
547
|
#### BiometricAuthError
|
|
@@ -168,6 +168,12 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
168
168
|
case 5: // IRIS_AUTHENTICATION
|
|
169
169
|
authenticators |= BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
170
170
|
break;
|
|
171
|
+
case 6: // MULTIPLE - allow all biometric types
|
|
172
|
+
authenticators |= BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
173
|
+
break;
|
|
174
|
+
case 7: // DEVICE_CREDENTIAL (PIN, pattern, or password)
|
|
175
|
+
authenticators |= BiometricManager.Authenticators.DEVICE_CREDENTIAL;
|
|
176
|
+
break;
|
|
171
177
|
}
|
|
172
178
|
}
|
|
173
179
|
return authenticators > 0 ? authenticators : BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
@@ -34,6 +34,7 @@ import java.security.KeyStore;
|
|
|
34
34
|
import java.security.KeyStoreException;
|
|
35
35
|
import java.security.NoSuchAlgorithmException;
|
|
36
36
|
import java.security.NoSuchProviderException;
|
|
37
|
+
import java.security.ProviderException;
|
|
37
38
|
import java.security.SecureRandom;
|
|
38
39
|
import java.security.UnrecoverableEntryException;
|
|
39
40
|
import java.security.cert.CertificateException;
|
|
@@ -60,6 +61,7 @@ public class NativeBiometric extends Plugin {
|
|
|
60
61
|
private static final int FACE_AUTHENTICATION = 4;
|
|
61
62
|
private static final int IRIS_AUTHENTICATION = 5;
|
|
62
63
|
private static final int MULTIPLE = 6;
|
|
64
|
+
private static final int DEVICE_CREDENTIAL = 7;
|
|
63
65
|
|
|
64
66
|
// AuthenticationStrength enum values
|
|
65
67
|
private static final int AUTH_STRENGTH_NONE = 0;
|
|
@@ -187,6 +189,12 @@ public class NativeBiometric extends Plugin {
|
|
|
187
189
|
return IRIS_AUTHENTICATION;
|
|
188
190
|
}
|
|
189
191
|
|
|
192
|
+
// If no biometric sensors are available but device has credentials (PIN/pattern/password)
|
|
193
|
+
// return DEVICE_CREDENTIAL type
|
|
194
|
+
if (this.deviceHasCredentials()) {
|
|
195
|
+
return DEVICE_CREDENTIAL;
|
|
196
|
+
}
|
|
197
|
+
|
|
190
198
|
return NONE;
|
|
191
199
|
}
|
|
192
200
|
|
|
@@ -376,7 +384,20 @@ public class NativeBiometric extends Plugin {
|
|
|
376
384
|
try {
|
|
377
385
|
key = generateKey(KEY_ALIAS, true);
|
|
378
386
|
} catch (StrongBoxUnavailableException e) {
|
|
387
|
+
// Retry without StrongBox if it's unavailable
|
|
379
388
|
key = generateKey(KEY_ALIAS, false);
|
|
389
|
+
} catch (ProviderException e) {
|
|
390
|
+
// ProviderException can be thrown for various device-specific keystore issues
|
|
391
|
+
// Retry without StrongBox as a fallback
|
|
392
|
+
try {
|
|
393
|
+
key = generateKey(KEY_ALIAS, false);
|
|
394
|
+
} catch (StrongBoxUnavailableException ex) {
|
|
395
|
+
// This shouldn't happen when isStrongBoxBacked=false, but handle it anyway
|
|
396
|
+
throw new GeneralSecurityException("Failed to generate key without StrongBox", ex);
|
|
397
|
+
} catch (ProviderException ex) {
|
|
398
|
+
// If it still fails without StrongBox, wrap and rethrow
|
|
399
|
+
throw new GeneralSecurityException("Keystore key generation failed", ex);
|
|
400
|
+
}
|
|
380
401
|
}
|
|
381
402
|
return key;
|
|
382
403
|
}
|
package/dist/docs.json
CHANGED
package/dist/esm/definitions.js
CHANGED
|
@@ -14,6 +14,8 @@ export var BiometryType;
|
|
|
14
14
|
BiometryType[BiometryType["IRIS_AUTHENTICATION"] = 5] = "IRIS_AUTHENTICATION";
|
|
15
15
|
// Android
|
|
16
16
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
17
|
+
// Android - Device credentials (PIN, pattern, or password)
|
|
18
|
+
BiometryType[BiometryType["DEVICE_CREDENTIAL"] = 7] = "DEVICE_CREDENTIAL";
|
|
17
19
|
})(BiometryType || (BiometryType = {}));
|
|
18
20
|
export var AuthenticationStrength;
|
|
19
21
|
(function (AuthenticationStrength) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB,eAAe;IACf,+CAAQ,CAAA;IACR,MAAM;IACN,uDAAY,CAAA;IACZ,MAAM;IACN,qDAAW,CAAA;IACX,UAAU;IACV,6DAAe,CAAA;IACf,UAAU;IACV,6EAAuB,CAAA;IACvB,UAAU;IACV,6EAAuB,CAAA;IACvB,UAAU;IACV,uDAAY,CAAA;IACZ,2DAA2D;IAC3D,yEAAqB,CAAA;AACvB,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB;AAED,MAAM,CAAN,IAAY,sBAeX;AAfD,WAAY,sBAAsB;IAChC;;OAEG;IACH,mEAAQ,CAAA;IACR;;;OAGG;IACH,uEAAU,CAAA;IACV;;;OAGG;IACH,mEAAQ,CAAA;AACV,CAAC,EAfW,sBAAsB,KAAtB,sBAAsB,QAejC;AAuGD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,kBAiEX;AAjED,WAAY,kBAAkB;IAC5B;;OAEG;IACH,6EAAiB,CAAA;IACjB;;;OAGG;IACH,+FAA0B,CAAA;IAC1B;;;OAGG;IACH,2EAAgB,CAAA;IAChB;;;OAGG;IACH,iGAA2B,CAAA;IAC3B;;;OAGG;IACH,+FAA0B,CAAA;IAC1B;;;OAGG;IACH,8FAA0B,CAAA;IAC1B;;;OAGG;IACH,wEAAe,CAAA;IACf;;;OAGG;IACH,kFAAoB,CAAA;IACpB;;;OAGG;IACH,kFAAoB,CAAA;IACpB;;;OAGG;IACH,oFAAqB,CAAA;IACrB;;;OAGG;IACH,8EAAkB,CAAA;IAClB;;;OAGG;IACH,0EAAgB,CAAA;IAChB;;;OAGG;IACH,8EAAkB,CAAA;AACpB,CAAC,EAjEW,kBAAkB,KAAlB,kBAAkB,QAiE7B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport enum BiometryType {\n // Android, iOS\n NONE = 0,\n // iOS\n TOUCH_ID = 1,\n // iOS\n FACE_ID = 2,\n // Android\n FINGERPRINT = 3,\n // Android\n FACE_AUTHENTICATION = 4,\n // Android\n IRIS_AUTHENTICATION = 5,\n // Android\n MULTIPLE = 6,\n // Android - Device credentials (PIN, pattern, or password)\n DEVICE_CREDENTIAL = 7,\n}\n\nexport enum AuthenticationStrength {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n NONE = 0,\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n STRONG = 1,\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n WEAK = 2,\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface IsAvailableOptions {\n /**\n * Specifies if should fallback to passcode authentication if biometric authentication is not available.\n */\n useFallback: boolean;\n}\n\n/**\n * Result from isAvailable() method indicating biometric authentication availability.\n */\nexport interface AvailableResult {\n /**\n * Whether authentication is available (biometric or fallback if useFallback is true)\n */\n isAvailable: boolean;\n /**\n * The strength of available authentication method (STRONG, WEAK, or NONE)\n */\n authenticationStrength: AuthenticationStrength;\n /**\n * The primary biometry type available on the device.\n * On Android devices with multiple biometry types, this returns MULTIPLE.\n * Use this for display purposes only - always use isAvailable for logic decisions.\n */\n biometryType: BiometryType;\n /**\n * Whether the device has a secure lock screen (PIN, pattern, or password).\n * This is independent of biometric enrollment.\n */\n deviceIsSecure: boolean;\n /**\n * Whether strong biometry (Face ID, Touch ID, or fingerprint on devices that consider it strong)\n * is specifically available, separate from weak biometry or device credentials.\n */\n strongBiometryIsAvailable: boolean;\n /**\n * Error code from BiometricAuthError enum. Only present when isAvailable is false.\n * Indicates why biometric authentication is not available.\n * @see BiometricAuthError\n */\n errorCode?: BiometricAuthError;\n}\n\nexport interface BiometricOptions {\n reason?: string;\n title?: string;\n subtitle?: string;\n description?: string;\n negativeButtonText?: string;\n /**\n * Specifies if should fallback to passcode authentication if biometric authentication fails.\n */\n useFallback?: boolean;\n /**\n * Only for iOS.\n * Set the text for the fallback button in the authentication dialog.\n * If this property is not specified, the default text is set by the system.\n */\n fallbackTitle?: string;\n /**\n * Only for Android.\n * Set a maximum number of attempts for biometric authentication. The maximum allowed by android is 5.\n * @default 1\n */\n maxAttempts?: number;\n /**\n * Only for Android.\n * Specify which biometry types are allowed for authentication.\n * If not specified, all available types will be allowed.\n * @example [BiometryType.FINGERPRINT, BiometryType.FACE_AUTHENTICATION]\n */\n allowedBiometryTypes?: BiometryType[];\n}\n\nexport interface GetCredentialOptions {\n server: string;\n}\n\nexport interface SetCredentialOptions {\n username: string;\n password: string;\n server: string;\n}\n\nexport interface DeleteCredentialOptions {\n server: string;\n}\n\nexport interface IsCredentialsSavedOptions {\n server: string;\n}\n\nexport interface IsCredentialsSavedResult {\n isSaved: boolean;\n}\n\n/**\n * Biometric authentication error codes.\n * These error codes are used in both isAvailable() and verifyIdentity() methods.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport enum BiometricAuthError {\n /**\n * Unknown error occurred\n */\n UNKNOWN_ERROR = 0,\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BIOMETRICS_UNAVAILABLE = 1,\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n USER_LOCKOUT = 2,\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BIOMETRICS_NOT_ENROLLED = 3,\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n USER_TEMPORARY_LOCKOUT = 4,\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n AUTHENTICATION_FAILED = 10,\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n APP_CANCEL = 11,\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n INVALID_CONTEXT = 12,\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n NOT_INTERACTIVE = 13,\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n PASSCODE_NOT_SET = 14,\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n SYSTEM_CANCEL = 15,\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n USER_CANCEL = 16,\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n USER_FALLBACK = 17,\n}\n\n/**\n * Callback type for biometry change listener\n */\nexport type BiometryChangeListener = (result: AvailableResult) => void;\n\nexport interface NativeBiometricPlugin {\n /**\n * Checks if biometric authentication hardware is available.\n * @param {IsAvailableOptions} [options]\n * @returns {Promise<AvailableResult>}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n isAvailable(options?: IsAvailableOptions): Promise<AvailableResult>;\n\n /**\n * Adds a listener that is called when the app resumes from background.\n * This is useful to detect if biometry availability has changed while\n * the app was in the background (e.g., user enrolled/unenrolled biometrics).\n *\n * @param eventName - Must be 'biometryChange'\n * @param {BiometryChangeListener} listener - Callback function that receives the updated AvailableResult\n * @returns {Promise<PluginListenerHandle>} Handle to remove the listener\n * @since 7.6.0\n *\n * @example\n * ```typescript\n * const handle = await NativeBiometric.addListener('biometryChange', (result) => {\n * console.log('Biometry availability changed:', result.isAvailable);\n * });\n *\n * // To remove the listener:\n * await handle.remove();\n * ```\n */\n addListener(eventName: 'biometryChange', listener: BiometryChangeListener): Promise<PluginListenerHandle>;\n /**\n * Prompts the user to authenticate with biometrics.\n * @param {BiometricOptions} [options]\n * @returns {Promise<any>}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n verifyIdentity(options?: BiometricOptions): Promise<void>;\n /**\n * Gets the stored credentials for a given server.\n * @param {GetCredentialOptions} options\n * @returns {Promise<Credentials>}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n getCredentials(options: GetCredentialOptions): Promise<Credentials>;\n /**\n * Stores the given credentials for a given server.\n * @param {SetCredentialOptions} options\n * @returns {Promise<any>}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n setCredentials(options: SetCredentialOptions): Promise<void>;\n /**\n * Deletes the stored credentials for a given server.\n * @param {DeleteCredentialOptions} options\n * @returns {Promise<any>}\n * @memberof NativeBiometricPlugin\n * @since 1.0.0\n */\n deleteCredentials(options: DeleteCredentialOptions): Promise<void>;\n /**\n * Checks if credentials are already saved for a given server.\n * @param {IsCredentialsSavedOptions} options\n * @returns {Promise<IsCredentialsSavedResult>}\n * @memberof NativeBiometricPlugin\n * @since 7.3.0\n */\n isCredentialsSaved(options: IsCredentialsSavedOptions): Promise<IsCredentialsSavedResult>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @since 1.0.0\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -18,6 +18,8 @@ exports.BiometryType = void 0;
|
|
|
18
18
|
BiometryType[BiometryType["IRIS_AUTHENTICATION"] = 5] = "IRIS_AUTHENTICATION";
|
|
19
19
|
// Android
|
|
20
20
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
21
|
+
// Android - Device credentials (PIN, pattern, or password)
|
|
22
|
+
BiometryType[BiometryType["DEVICE_CREDENTIAL"] = 7] = "DEVICE_CREDENTIAL";
|
|
21
23
|
})(exports.BiometryType || (exports.BiometryType = {}));
|
|
22
24
|
exports.AuthenticationStrength = void 0;
|
|
23
25
|
(function (AuthenticationStrength) {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BiometryType;\n(function (BiometryType) {\n // Android, iOS\n BiometryType[BiometryType[\"NONE\"] = 0] = \"NONE\";\n // iOS\n BiometryType[BiometryType[\"TOUCH_ID\"] = 1] = \"TOUCH_ID\";\n // iOS\n BiometryType[BiometryType[\"FACE_ID\"] = 2] = \"FACE_ID\";\n // Android\n BiometryType[BiometryType[\"FINGERPRINT\"] = 3] = \"FINGERPRINT\";\n // Android\n BiometryType[BiometryType[\"FACE_AUTHENTICATION\"] = 4] = \"FACE_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"IRIS_AUTHENTICATION\"] = 5] = \"IRIS_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"MULTIPLE\"] = 6] = \"MULTIPLE\";\n})(BiometryType || (BiometryType = {}));\nexport var AuthenticationStrength;\n(function (AuthenticationStrength) {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n AuthenticationStrength[AuthenticationStrength[\"NONE\"] = 0] = \"NONE\";\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n AuthenticationStrength[AuthenticationStrength[\"STRONG\"] = 1] = \"STRONG\";\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n AuthenticationStrength[AuthenticationStrength[\"WEAK\"] = 2] = \"WEAK\";\n})(AuthenticationStrength || (AuthenticationStrength = {}));\n/**\n * Biometric authentication error codes.\n * These error codes are used in both isAvailable() and verifyIdentity() methods.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport var BiometricAuthError;\n(function (BiometricAuthError) {\n /**\n * Unknown error occurred\n */\n BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_FALLBACK\"] = 17] = \"USER_FALLBACK\";\n})(BiometricAuthError || (BiometricAuthError = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeBiometric = registerPlugin('NativeBiometric', {\n web: () => import('./web').then((m) => new m.NativeBiometricWeb()),\n});\nexport * from './definitions';\nexport { NativeBiometric };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { BiometryType, AuthenticationStrength } from './definitions';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n // Web platform: biometrics not available, but return structured response\n return Promise.resolve({\n isAvailable: false,\n authenticationStrength: AuthenticationStrength.NONE,\n biometryType: BiometryType.NONE,\n deviceIsSecure: false,\n strongBiometryIsAvailable: false,\n });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async addListener(_eventName, _listener) {\n // Web platform: no-op, but return a valid handle\n return {\n remove: async () => {\n // Nothing to remove on web\n },\n };\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Biometric authentication is not available on web platform.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n // Return false on web - no credentials can be saved\n return Promise.resolve({ isSaved: false });\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BiometryType","AuthenticationStrength","BiometricAuthError","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AACnD;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;AAC3D;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O,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC;AAClD,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;AAC/E,IAAI;AACJ,IAAI,kBAAkB,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC;AACnD;AACA,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BiometryType;\n(function (BiometryType) {\n // Android, iOS\n BiometryType[BiometryType[\"NONE\"] = 0] = \"NONE\";\n // iOS\n BiometryType[BiometryType[\"TOUCH_ID\"] = 1] = \"TOUCH_ID\";\n // iOS\n BiometryType[BiometryType[\"FACE_ID\"] = 2] = \"FACE_ID\";\n // Android\n BiometryType[BiometryType[\"FINGERPRINT\"] = 3] = \"FINGERPRINT\";\n // Android\n BiometryType[BiometryType[\"FACE_AUTHENTICATION\"] = 4] = \"FACE_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"IRIS_AUTHENTICATION\"] = 5] = \"IRIS_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"MULTIPLE\"] = 6] = \"MULTIPLE\";\n // Android - Device credentials (PIN, pattern, or password)\n BiometryType[BiometryType[\"DEVICE_CREDENTIAL\"] = 7] = \"DEVICE_CREDENTIAL\";\n})(BiometryType || (BiometryType = {}));\nexport var AuthenticationStrength;\n(function (AuthenticationStrength) {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n AuthenticationStrength[AuthenticationStrength[\"NONE\"] = 0] = \"NONE\";\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n AuthenticationStrength[AuthenticationStrength[\"STRONG\"] = 1] = \"STRONG\";\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n AuthenticationStrength[AuthenticationStrength[\"WEAK\"] = 2] = \"WEAK\";\n})(AuthenticationStrength || (AuthenticationStrength = {}));\n/**\n * Biometric authentication error codes.\n * These error codes are used in both isAvailable() and verifyIdentity() methods.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport var BiometricAuthError;\n(function (BiometricAuthError) {\n /**\n * Unknown error occurred\n */\n BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_FALLBACK\"] = 17] = \"USER_FALLBACK\";\n})(BiometricAuthError || (BiometricAuthError = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeBiometric = registerPlugin('NativeBiometric', {\n web: () => import('./web').then((m) => new m.NativeBiometricWeb()),\n});\nexport * from './definitions';\nexport { NativeBiometric };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { BiometryType, AuthenticationStrength } from './definitions';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n // Web platform: biometrics not available, but return structured response\n return Promise.resolve({\n isAvailable: false,\n authenticationStrength: AuthenticationStrength.NONE,\n biometryType: BiometryType.NONE,\n deviceIsSecure: false,\n strongBiometryIsAvailable: false,\n });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async addListener(_eventName, _listener) {\n // Web platform: no-op, but return a valid handle\n return {\n remove: async () => {\n // Nothing to remove on web\n },\n };\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Biometric authentication is not available on web platform.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n // Return false on web - no credentials can be saved\n return Promise.resolve({ isSaved: false });\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BiometryType","AuthenticationStrength","BiometricAuthError","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AACnD;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;AAC3D;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS;AACzD;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,aAAa;AACjE;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB;AACjF;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB;AACjF;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;AAC3D;AACA,IAAI,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,GA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I;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -17,6 +17,8 @@ var capacitorCapacitorBiometric = (function (exports, core) {
|
|
|
17
17
|
BiometryType[BiometryType["IRIS_AUTHENTICATION"] = 5] = "IRIS_AUTHENTICATION";
|
|
18
18
|
// Android
|
|
19
19
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
20
|
+
// Android - Device credentials (PIN, pattern, or password)
|
|
21
|
+
BiometryType[BiometryType["DEVICE_CREDENTIAL"] = 7] = "DEVICE_CREDENTIAL";
|
|
20
22
|
})(exports.BiometryType || (exports.BiometryType = {}));
|
|
21
23
|
exports.AuthenticationStrength = void 0;
|
|
22
24
|
(function (AuthenticationStrength) {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BiometryType;\n(function (BiometryType) {\n // Android, iOS\n BiometryType[BiometryType[\"NONE\"] = 0] = \"NONE\";\n // iOS\n BiometryType[BiometryType[\"TOUCH_ID\"] = 1] = \"TOUCH_ID\";\n // iOS\n BiometryType[BiometryType[\"FACE_ID\"] = 2] = \"FACE_ID\";\n // Android\n BiometryType[BiometryType[\"FINGERPRINT\"] = 3] = \"FINGERPRINT\";\n // Android\n BiometryType[BiometryType[\"FACE_AUTHENTICATION\"] = 4] = \"FACE_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"IRIS_AUTHENTICATION\"] = 5] = \"IRIS_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"MULTIPLE\"] = 6] = \"MULTIPLE\";\n})(BiometryType || (BiometryType = {}));\nexport var AuthenticationStrength;\n(function (AuthenticationStrength) {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n AuthenticationStrength[AuthenticationStrength[\"NONE\"] = 0] = \"NONE\";\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n AuthenticationStrength[AuthenticationStrength[\"STRONG\"] = 1] = \"STRONG\";\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n AuthenticationStrength[AuthenticationStrength[\"WEAK\"] = 2] = \"WEAK\";\n})(AuthenticationStrength || (AuthenticationStrength = {}));\n/**\n * Biometric authentication error codes.\n * These error codes are used in both isAvailable() and verifyIdentity() methods.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport var BiometricAuthError;\n(function (BiometricAuthError) {\n /**\n * Unknown error occurred\n */\n BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_FALLBACK\"] = 17] = \"USER_FALLBACK\";\n})(BiometricAuthError || (BiometricAuthError = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeBiometric = registerPlugin('NativeBiometric', {\n web: () => import('./web').then((m) => new m.NativeBiometricWeb()),\n});\nexport * from './definitions';\nexport { NativeBiometric };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { BiometryType, AuthenticationStrength } from './definitions';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n // Web platform: biometrics not available, but return structured response\n return Promise.resolve({\n isAvailable: false,\n authenticationStrength: AuthenticationStrength.NONE,\n biometryType: BiometryType.NONE,\n deviceIsSecure: false,\n strongBiometryIsAvailable: false,\n });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async addListener(_eventName, _listener) {\n // Web platform: no-op, but return a valid handle\n return {\n remove: async () => {\n // Nothing to remove on web\n },\n };\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Biometric authentication is not available on web platform.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n // Return false on web - no credentials can be saved\n return Promise.resolve({ isSaved: false });\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BiometryType","AuthenticationStrength","BiometricAuthError","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;IACnD;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;IAC3D;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS;IACzD;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,aAAa;IACjE;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB;IACjF;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,qBAAqB;IACjF;IACA,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;IAC3D,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;IACX,CAAC,UAAU,sBAAsB,EA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\n(function (BiometryType) {\n // Android, iOS\n BiometryType[BiometryType[\"NONE\"] = 0] = \"NONE\";\n // iOS\n BiometryType[BiometryType[\"TOUCH_ID\"] = 1] = \"TOUCH_ID\";\n // iOS\n BiometryType[BiometryType[\"FACE_ID\"] = 2] = \"FACE_ID\";\n // Android\n BiometryType[BiometryType[\"FINGERPRINT\"] = 3] = \"FINGERPRINT\";\n // Android\n BiometryType[BiometryType[\"FACE_AUTHENTICATION\"] = 4] = \"FACE_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"IRIS_AUTHENTICATION\"] = 5] = \"IRIS_AUTHENTICATION\";\n // Android\n BiometryType[BiometryType[\"MULTIPLE\"] = 6] = \"MULTIPLE\";\n // Android - Device credentials (PIN, pattern, or password)\n BiometryType[BiometryType[\"DEVICE_CREDENTIAL\"] = 7] = \"DEVICE_CREDENTIAL\";\n})(BiometryType || (BiometryType = {}));\nexport var AuthenticationStrength;\n(function (AuthenticationStrength) {\n /**\n * No authentication available, even if PIN is available but useFallback = false\n */\n AuthenticationStrength[AuthenticationStrength[\"NONE\"] = 0] = \"NONE\";\n /**\n * Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\n * Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.\n */\n AuthenticationStrength[AuthenticationStrength[\"STRONG\"] = 1] = \"STRONG\";\n /**\n * Weak authentication: Face authentication on Android devices that consider face weak,\n * or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).\n */\n AuthenticationStrength[AuthenticationStrength[\"WEAK\"] = 2] = \"WEAK\";\n})(AuthenticationStrength || (AuthenticationStrength = {}));\n/**\n * Biometric authentication error codes.\n * These error codes are used in both isAvailable() and verifyIdentity() methods.\n *\n * Keep this in sync with BiometricAuthError in README.md\n * Update whenever `convertToPluginErrorCode` functions are modified\n */\nexport var BiometricAuthError;\n(function (BiometricAuthError) {\n /**\n * Unknown error occurred\n */\n BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n /**\n * Biometrics are unavailable (no hardware or hardware error)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n /**\n * User has been locked out due to too many failed attempts\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n /**\n * No biometrics are enrolled on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n /**\n * User is temporarily locked out (Android: 30 second lockout)\n * Platform: Android\n */\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n /**\n * Authentication failed (user did not authenticate successfully)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n /**\n * App canceled the authentication (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n /**\n * Invalid context (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n /**\n * Authentication was not interactive (iOS only)\n * Platform: iOS\n */\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n /**\n * Passcode/PIN is not set on the device\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n /**\n * System canceled the authentication (e.g., due to screen lock)\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n /**\n * User canceled the authentication\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\n /**\n * User chose to use fallback authentication method\n * Platform: Android, iOS\n */\n BiometricAuthError[BiometricAuthError[\"USER_FALLBACK\"] = 17] = \"USER_FALLBACK\";\n})(BiometricAuthError || (BiometricAuthError = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeBiometric = registerPlugin('NativeBiometric', {\n web: () => import('./web').then((m) => new m.NativeBiometricWeb()),\n});\nexport * from './definitions';\nexport { NativeBiometric };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { BiometryType, AuthenticationStrength } from './definitions';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n // Web platform: biometrics not available, but return structured response\n return Promise.resolve({\n isAvailable: false,\n authenticationStrength: AuthenticationStrength.NONE,\n biometryType: BiometryType.NONE,\n deviceIsSecure: false,\n strongBiometryIsAvailable: false,\n });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async addListener(_eventName, _listener) {\n // Web platform: no-op, but return a valid handle\n return {\n remove: async () => {\n // Nothing to remove on web\n },\n };\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Biometric authentication is not available on web platform.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n // Return false on web - no credentials can be saved\n return Promise.resolve({ isSaved: false });\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BiometryType","AuthenticationStrength","BiometricAuthError","registerPlugin","WebPlugin"],"m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QAAQ,CAAC;IAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;IAC/E,IAAI;IACJ,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;IAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;IAC/E,IAAI;IACJ,IAAI,iBAAiB,CAAC,QAAQ,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAClD,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;IAC/E,IAAI;IACJ,IAAI,kBAAkB,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACnD;IACA,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -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.0
|
|
14
|
+
private let pluginVersion: String = "8.1.0"
|
|
15
15
|
public let identifier = "NativeBiometricPlugin"
|
|
16
16
|
public let jsName = "NativeBiometric"
|
|
17
17
|
public let pluginMethods: [CAPPluginMethod] = [
|
package/package.json
CHANGED