@capgo/capacitor-native-biometric 7.5.3 → 7.6.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 +96 -18
- package/android/src/main/java/ee/forgr/biometric/AuthActivity.java +3 -1
- package/android/src/main/java/ee/forgr/biometric/NativeBiometric.java +65 -20
- package/dist/docs.json +143 -45
- package/dist/esm/definitions.d.ts +42 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -1
- package/dist/esm/web.js +23 -6
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +22 -6
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +22 -6
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NativeBiometricPlugin/NativeBiometricPlugin.swift +71 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ A **free**, **comprehensive** biometric authentication plugin with secure creden
|
|
|
18
18
|
- **Flexible fallback** - Optional passcode fallback when biometrics unavailable
|
|
19
19
|
- **Customizable UI** - Full control over prompts, titles, descriptions, button text
|
|
20
20
|
- **Detailed error codes** - Unified error handling across iOS and Android
|
|
21
|
+
- **Resume listener** - Detect biometry availability changes when app returns from background
|
|
21
22
|
- **Modern package management** - Supports both Swift Package Manager (SPM) and CocoaPods (SPM-ready for Capacitor 8)
|
|
22
23
|
|
|
23
24
|
Perfect for banking apps, password managers, authentication flows, and any app requiring secure user verification.
|
|
@@ -40,8 +41,16 @@ async performBiometricVerification(){
|
|
|
40
41
|
|
|
41
42
|
if(!result.isAvailable) return;
|
|
42
43
|
|
|
44
|
+
// Check the biometry type for display purposes
|
|
45
|
+
// IMPORTANT: Always use isAvailable for logic decisions, not biometryType
|
|
43
46
|
const isFaceID = result.biometryType == BiometryType.FACE_ID;
|
|
44
47
|
|
|
48
|
+
// Check if device has PIN/pattern/password set
|
|
49
|
+
console.log('Device is secure:', result.deviceIsSecure);
|
|
50
|
+
|
|
51
|
+
// Check if strong biometry (Face ID, Touch ID, fingerprint) is available
|
|
52
|
+
console.log('Strong biometry available:', result.strongBiometryIsAvailable);
|
|
53
|
+
|
|
45
54
|
const verified = await NativeBiometric.verifyIdentity({
|
|
46
55
|
reason: "For easy log in",
|
|
47
56
|
title: "Log in",
|
|
@@ -69,6 +78,15 @@ NativeBiometric.setCredentials({
|
|
|
69
78
|
NativeBiometric.deleteCredentials({
|
|
70
79
|
server: "www.example.com",
|
|
71
80
|
}).then();
|
|
81
|
+
|
|
82
|
+
// Listen for biometry availability changes when app resumes from background
|
|
83
|
+
const handle = await NativeBiometric.addListener('biometryChange', (result) => {
|
|
84
|
+
console.log('Biometry availability changed:', result.isAvailable);
|
|
85
|
+
console.log('Biometry type:', result.biometryType);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// To remove the listener when no longer needed:
|
|
89
|
+
// await handle.remove();
|
|
72
90
|
```
|
|
73
91
|
|
|
74
92
|
### Biometric Auth Errors
|
|
@@ -94,6 +112,7 @@ This is a plugin specific list of error codes that can be thrown on verifyIdenti
|
|
|
94
112
|
<docgen-index>
|
|
95
113
|
|
|
96
114
|
* [`isAvailable(...)`](#isavailable)
|
|
115
|
+
* [`addListener('biometryChange', ...)`](#addlistenerbiometrychange-)
|
|
97
116
|
* [`verifyIdentity(...)`](#verifyidentity)
|
|
98
117
|
* [`getCredentials(...)`](#getcredentials)
|
|
99
118
|
* [`setCredentials(...)`](#setcredentials)
|
|
@@ -101,6 +120,7 @@ This is a plugin specific list of error codes that can be thrown on verifyIdenti
|
|
|
101
120
|
* [`isCredentialsSaved(...)`](#iscredentialssaved)
|
|
102
121
|
* [`getPluginVersion()`](#getpluginversion)
|
|
103
122
|
* [Interfaces](#interfaces)
|
|
123
|
+
* [Type Aliases](#type-aliases)
|
|
104
124
|
* [Enums](#enums)
|
|
105
125
|
|
|
106
126
|
</docgen-index>
|
|
@@ -127,6 +147,28 @@ Checks if biometric authentication hardware is available.
|
|
|
127
147
|
--------------------
|
|
128
148
|
|
|
129
149
|
|
|
150
|
+
### addListener('biometryChange', ...)
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
addListener(eventName: 'biometryChange', listener: BiometryChangeListener) => Promise<PluginListenerHandle>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Adds a listener that is called when the app resumes from background.
|
|
157
|
+
This is useful to detect if biometry availability has changed while
|
|
158
|
+
the app was in the background (e.g., user enrolled/unenrolled biometrics).
|
|
159
|
+
|
|
160
|
+
| Param | Type | Description |
|
|
161
|
+
| --------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
162
|
+
| **`eventName`** | <code>'biometryChange'</code> | - Must be 'biometryChange' |
|
|
163
|
+
| **`listener`** | <code><a href="#biometrychangelistener">BiometryChangeListener</a></code> | - Callback function that receives the updated <a href="#availableresult">AvailableResult</a> |
|
|
164
|
+
|
|
165
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
166
|
+
|
|
167
|
+
**Since:** 7.6.0
|
|
168
|
+
|
|
169
|
+
--------------------
|
|
170
|
+
|
|
171
|
+
|
|
130
172
|
### verifyIdentity(...)
|
|
131
173
|
|
|
132
174
|
```typescript
|
|
@@ -238,11 +280,14 @@ Get the native Capacitor plugin version.
|
|
|
238
280
|
|
|
239
281
|
Result from isAvailable() method indicating biometric authentication availability.
|
|
240
282
|
|
|
241
|
-
| Prop
|
|
242
|
-
|
|
|
243
|
-
| **`isAvailable`**
|
|
244
|
-
| **`authenticationStrength`**
|
|
245
|
-
| **`
|
|
283
|
+
| Prop | Type | Description |
|
|
284
|
+
| ------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
285
|
+
| **`isAvailable`** | <code>boolean</code> | Whether authentication is available (biometric or fallback if useFallback is true) |
|
|
286
|
+
| **`authenticationStrength`** | <code><a href="#authenticationstrength">AuthenticationStrength</a></code> | The strength of available authentication method (STRONG, WEAK, or NONE) |
|
|
287
|
+
| **`biometryType`** | <code><a href="#biometrytype">BiometryType</a></code> | The primary biometry type available on the device. On Android devices with multiple biometry types, this returns MULTIPLE. Use this for display purposes only - always use isAvailable for logic decisions. |
|
|
288
|
+
| **`deviceIsSecure`** | <code>boolean</code> | Whether the device has a secure lock screen (PIN, pattern, or password). This is independent of biometric enrollment. |
|
|
289
|
+
| **`strongBiometryIsAvailable`** | <code>boolean</code> | Whether strong biometry (Face ID, Touch ID, or fingerprint on devices that consider it strong) is specifically available, separate from weak biometry or device credentials. |
|
|
290
|
+
| **`errorCode`** | <code><a href="#biometricautherror">BiometricAuthError</a></code> | Error code from <a href="#biometricautherror">BiometricAuthError</a> enum. Only present when isAvailable is false. Indicates why biometric authentication is not available. |
|
|
246
291
|
|
|
247
292
|
|
|
248
293
|
#### IsAvailableOptions
|
|
@@ -252,6 +297,13 @@ Result from isAvailable() method indicating biometric authentication availabilit
|
|
|
252
297
|
| **`useFallback`** | <code>boolean</code> | Specifies if should fallback to passcode authentication if biometric authentication is not available. |
|
|
253
298
|
|
|
254
299
|
|
|
300
|
+
#### PluginListenerHandle
|
|
301
|
+
|
|
302
|
+
| Prop | Type |
|
|
303
|
+
| ------------ | ----------------------------------------- |
|
|
304
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
305
|
+
|
|
306
|
+
|
|
255
307
|
#### BiometricOptions
|
|
256
308
|
|
|
257
309
|
| Prop | Type | Description | Default |
|
|
@@ -312,6 +364,16 @@ Result from isAvailable() method indicating biometric authentication availabilit
|
|
|
312
364
|
| **`server`** | <code>string</code> |
|
|
313
365
|
|
|
314
366
|
|
|
367
|
+
### Type Aliases
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
#### BiometryChangeListener
|
|
371
|
+
|
|
372
|
+
Callback type for biometry change listener
|
|
373
|
+
|
|
374
|
+
<code>(result: <a href="#availableresult">AvailableResult</a>): void</code>
|
|
375
|
+
|
|
376
|
+
|
|
315
377
|
### Enums
|
|
316
378
|
|
|
317
379
|
|
|
@@ -324,6 +386,19 @@ Result from isAvailable() method indicating biometric authentication availabilit
|
|
|
324
386
|
| **`WEAK`** | <code>2</code> | Weak authentication: Face authentication on Android devices that consider face weak, or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG). |
|
|
325
387
|
|
|
326
388
|
|
|
389
|
+
#### BiometryType
|
|
390
|
+
|
|
391
|
+
| Members | Value |
|
|
392
|
+
| ------------------------- | -------------- |
|
|
393
|
+
| **`NONE`** | <code>0</code> |
|
|
394
|
+
| **`TOUCH_ID`** | <code>1</code> |
|
|
395
|
+
| **`FACE_ID`** | <code>2</code> |
|
|
396
|
+
| **`FINGERPRINT`** | <code>3</code> |
|
|
397
|
+
| **`FACE_AUTHENTICATION`** | <code>4</code> |
|
|
398
|
+
| **`IRIS_AUTHENTICATION`** | <code>5</code> |
|
|
399
|
+
| **`MULTIPLE`** | <code>6</code> |
|
|
400
|
+
|
|
401
|
+
|
|
327
402
|
#### BiometricAuthError
|
|
328
403
|
|
|
329
404
|
| Members | Value | Description |
|
|
@@ -342,19 +417,6 @@ Result from isAvailable() method indicating biometric authentication availabilit
|
|
|
342
417
|
| **`USER_CANCEL`** | <code>16</code> | User canceled the authentication Platform: Android, iOS |
|
|
343
418
|
| **`USER_FALLBACK`** | <code>17</code> | User chose to use fallback authentication method Platform: Android, iOS |
|
|
344
419
|
|
|
345
|
-
|
|
346
|
-
#### BiometryType
|
|
347
|
-
|
|
348
|
-
| Members | Value |
|
|
349
|
-
| ------------------------- | -------------- |
|
|
350
|
-
| **`NONE`** | <code>0</code> |
|
|
351
|
-
| **`TOUCH_ID`** | <code>1</code> |
|
|
352
|
-
| **`FACE_ID`** | <code>2</code> |
|
|
353
|
-
| **`FINGERPRINT`** | <code>3</code> |
|
|
354
|
-
| **`FACE_AUTHENTICATION`** | <code>4</code> |
|
|
355
|
-
| **`IRIS_AUTHENTICATION`** | <code>5</code> |
|
|
356
|
-
| **`MULTIPLE`** | <code>6</code> |
|
|
357
|
-
|
|
358
420
|
</docgen-api>
|
|
359
421
|
## Face ID (iOS)
|
|
360
422
|
|
|
@@ -375,6 +437,22 @@ To use android's BiometricPrompt api you must add the following permission to yo
|
|
|
375
437
|
<uses-permission android:name="android.permission.USE_BIOMETRIC">
|
|
376
438
|
```
|
|
377
439
|
|
|
440
|
+
### Important Note About biometryType on Android
|
|
441
|
+
|
|
442
|
+
The `biometryType` field indicates what biometric hardware is present, but **hardware presence does not guarantee availability**. Some Android devices report face authentication hardware but don't make it available to apps.
|
|
443
|
+
|
|
444
|
+
**Always use `isAvailable` for logic decisions**, not `biometryType`. The `biometryType` field should only be used for display purposes (e.g., showing "Use Face ID" vs "Use Fingerprint" in your UI).
|
|
445
|
+
|
|
446
|
+
## Web Platform
|
|
447
|
+
|
|
448
|
+
This plugin does not support web browsers. On web:
|
|
449
|
+
- `isAvailable()` returns `{ isAvailable: false, ... }` (no error thrown)
|
|
450
|
+
- `addListener()` returns a no-op handle
|
|
451
|
+
- `verifyIdentity()` throws an error
|
|
452
|
+
- Credential methods throw errors
|
|
453
|
+
|
|
454
|
+
This allows you to safely check availability on web without try/catch, but authentication features are only available on iOS and Android.
|
|
455
|
+
|
|
378
456
|
## Contributors
|
|
379
457
|
|
|
380
458
|
[Jonthia](https://github.com/jonthia)
|
|
@@ -23,7 +23,9 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
23
23
|
super.onCreate(savedInstanceState);
|
|
24
24
|
setContentView(R.layout.activity_auth_acitivy);
|
|
25
25
|
|
|
26
|
-
maxAttempts
|
|
26
|
+
// Get maxAttempts with validation: must be between 1 and 5, default to 1
|
|
27
|
+
int rawMaxAttempts = getIntent().getIntExtra("maxAttempts", 1);
|
|
28
|
+
maxAttempts = Math.max(1, Math.min(5, rawMaxAttempts));
|
|
27
29
|
|
|
28
30
|
Executor executor;
|
|
29
31
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
@@ -51,7 +51,7 @@ import org.json.JSONException;
|
|
|
51
51
|
@CapacitorPlugin(name = "NativeBiometric")
|
|
52
52
|
public class NativeBiometric extends Plugin {
|
|
53
53
|
|
|
54
|
-
private final String pluginVersion = "7.
|
|
54
|
+
private final String pluginVersion = "7.5.4";
|
|
55
55
|
|
|
56
56
|
//protected final static int AUTH_CODE = 0102;
|
|
57
57
|
|
|
@@ -77,11 +77,20 @@ public class NativeBiometric extends Plugin {
|
|
|
77
77
|
|
|
78
78
|
private SharedPreferences encryptedSharedPreferences;
|
|
79
79
|
|
|
80
|
-
@
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
@Override
|
|
81
|
+
protected void handleOnResume() {
|
|
82
|
+
super.handleOnResume();
|
|
83
|
+
// Notify listeners when app resumes from background
|
|
84
|
+
JSObject result = checkBiometryAvailability(false);
|
|
85
|
+
notifyListeners("biometryChange", result);
|
|
86
|
+
}
|
|
83
87
|
|
|
84
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Check biometry availability and return result as JSObject.
|
|
90
|
+
* This is a helper method used by both isAvailable() and handleOnResume().
|
|
91
|
+
*/
|
|
92
|
+
private JSObject checkBiometryAvailability(boolean useFallback) {
|
|
93
|
+
JSObject ret = new JSObject();
|
|
85
94
|
|
|
86
95
|
BiometricManager biometricManager = BiometricManager.from(getContext());
|
|
87
96
|
|
|
@@ -96,23 +105,30 @@ public class NativeBiometric extends Plugin {
|
|
|
96
105
|
boolean hasWeakBiometric = (weakResult == BiometricManager.BIOMETRIC_SUCCESS);
|
|
97
106
|
|
|
98
107
|
// Check if device has credentials (PIN/pattern/password)
|
|
99
|
-
boolean
|
|
108
|
+
boolean deviceIsSecure = this.deviceHasCredentials();
|
|
109
|
+
boolean fallbackAvailable = useFallback && deviceIsSecure;
|
|
110
|
+
|
|
111
|
+
// Determine biometry type
|
|
112
|
+
int biometryType = detectBiometryType(biometricManager);
|
|
113
|
+
ret.put("biometryType", biometryType);
|
|
114
|
+
|
|
115
|
+
// Device is secure if it has PIN/pattern/password
|
|
116
|
+
ret.put("deviceIsSecure", deviceIsSecure);
|
|
117
|
+
|
|
118
|
+
// Strong biometry is available only if strong biometric check passes
|
|
119
|
+
ret.put("strongBiometryIsAvailable", hasStrongBiometric);
|
|
100
120
|
|
|
101
121
|
// Determine authentication strength
|
|
102
122
|
int authenticationStrength = AUTH_STRENGTH_NONE;
|
|
103
123
|
boolean isAvailable = false;
|
|
104
124
|
|
|
105
125
|
if (hasStrongBiometric) {
|
|
106
|
-
// Strong biometric available (fingerprints on devices that consider them strong)
|
|
107
126
|
authenticationStrength = AUTH_STRENGTH_STRONG;
|
|
108
127
|
isAvailable = true;
|
|
109
128
|
} else if (hasWeakBiometric) {
|
|
110
|
-
// Only weak biometric available (face on devices that consider it weak)
|
|
111
129
|
authenticationStrength = AUTH_STRENGTH_WEAK;
|
|
112
130
|
isAvailable = true;
|
|
113
131
|
} else if (fallbackAvailable) {
|
|
114
|
-
// No biometrics but fallback (PIN/pattern/password) is available
|
|
115
|
-
// PIN/pattern/password is ALWAYS considered WEAK, never STRONG
|
|
116
132
|
authenticationStrength = AUTH_STRENGTH_WEAK;
|
|
117
133
|
isAvailable = true;
|
|
118
134
|
}
|
|
@@ -120,29 +136,58 @@ public class NativeBiometric extends Plugin {
|
|
|
120
136
|
// Handle error codes when authentication is not available
|
|
121
137
|
if (!isAvailable) {
|
|
122
138
|
int biometricManagerErrorCode;
|
|
123
|
-
|
|
124
|
-
// Prefer the error from strong biometric check if it failed
|
|
125
139
|
if (strongResult != BiometricManager.BIOMETRIC_SUCCESS) {
|
|
126
140
|
biometricManagerErrorCode = strongResult;
|
|
127
141
|
} else if (weakResult != BiometricManager.BIOMETRIC_SUCCESS) {
|
|
128
|
-
// Otherwise use error from weak biometric check if it failed
|
|
129
142
|
biometricManagerErrorCode = weakResult;
|
|
130
143
|
} else {
|
|
131
|
-
// No biometrics available at all
|
|
132
|
-
// BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE indicates that biometric hardware is unavailable
|
|
133
|
-
// or cannot be accessed. This constant value may vary across Android versions, so we explicitly
|
|
134
|
-
// use the constant rather than assuming its numeric value.
|
|
135
144
|
biometricManagerErrorCode = BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE;
|
|
136
145
|
}
|
|
137
|
-
|
|
138
|
-
// Convert BiometricManager error codes to plugin error codes
|
|
139
146
|
int pluginErrorCode = convertBiometricManagerErrorToPluginError(biometricManagerErrorCode);
|
|
140
147
|
ret.put("errorCode", pluginErrorCode);
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
ret.put("isAvailable", isAvailable);
|
|
144
151
|
ret.put("authenticationStrength", authenticationStrength);
|
|
145
|
-
|
|
152
|
+
return ret;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@PluginMethod
|
|
156
|
+
public void isAvailable(PluginCall call) {
|
|
157
|
+
boolean useFallback = Boolean.TRUE.equals(call.getBoolean("useFallback", false));
|
|
158
|
+
JSObject result = checkBiometryAvailability(useFallback);
|
|
159
|
+
call.resolve(result);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Detect the primary biometry type available on the device.
|
|
164
|
+
* Note: Android doesn't provide a direct API to query specific biometry types,
|
|
165
|
+
* so we check for hardware features. This is informational only - always use
|
|
166
|
+
* isAvailable for logic decisions as hardware presence doesn't guarantee availability.
|
|
167
|
+
*/
|
|
168
|
+
private int detectBiometryType(BiometricManager biometricManager) {
|
|
169
|
+
PackageManager pm = getContext().getPackageManager();
|
|
170
|
+
|
|
171
|
+
boolean hasFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
|
|
172
|
+
boolean hasFace = pm.hasSystemFeature(PackageManager.FEATURE_FACE);
|
|
173
|
+
boolean hasIris = pm.hasSystemFeature(PackageManager.FEATURE_IRIS);
|
|
174
|
+
|
|
175
|
+
int typeCount = 0;
|
|
176
|
+
if (hasFingerprint) typeCount++;
|
|
177
|
+
if (hasFace) typeCount++;
|
|
178
|
+
if (hasIris) typeCount++;
|
|
179
|
+
|
|
180
|
+
if (typeCount > 1) {
|
|
181
|
+
return MULTIPLE; // Multiple biometry types available
|
|
182
|
+
} else if (hasFingerprint) {
|
|
183
|
+
return FINGERPRINT;
|
|
184
|
+
} else if (hasFace) {
|
|
185
|
+
return FACE_AUTHENTICATION;
|
|
186
|
+
} else if (hasIris) {
|
|
187
|
+
return IRIS_AUTHENTICATION;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return NONE;
|
|
146
191
|
}
|
|
147
192
|
|
|
148
193
|
@PluginMethod
|
package/dist/docs.json
CHANGED
|
@@ -40,6 +40,51 @@
|
|
|
40
40
|
],
|
|
41
41
|
"slug": "isavailable"
|
|
42
42
|
},
|
|
43
|
+
{
|
|
44
|
+
"name": "addListener",
|
|
45
|
+
"signature": "(eventName: 'biometryChange', listener: BiometryChangeListener) => Promise<PluginListenerHandle>",
|
|
46
|
+
"parameters": [
|
|
47
|
+
{
|
|
48
|
+
"name": "eventName",
|
|
49
|
+
"docs": "- Must be 'biometryChange'",
|
|
50
|
+
"type": "'biometryChange'"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "listener",
|
|
54
|
+
"docs": "- Callback function that receives the updated AvailableResult",
|
|
55
|
+
"type": "BiometryChangeListener"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
59
|
+
"tags": [
|
|
60
|
+
{
|
|
61
|
+
"name": "param",
|
|
62
|
+
"text": "eventName - Must be 'biometryChange'"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "param",
|
|
66
|
+
"text": "listener - Callback function that receives the updated AvailableResult"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "returns",
|
|
70
|
+
"text": "Handle to remove the listener"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "since",
|
|
74
|
+
"text": "7.6.0"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "example",
|
|
78
|
+
"text": "```typescript\nconst handle = await NativeBiometric.addListener('biometryChange', (result) => {\n console.log('Biometry availability changed:', result.isAvailable);\n});\n\n// To remove the listener:\nawait handle.remove();\n```"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"docs": "Adds a listener that is called when the app resumes from background.\nThis is useful to detect if biometry availability has changed while\nthe app was in the background (e.g., user enrolled/unenrolled biometrics).",
|
|
82
|
+
"complexTypes": [
|
|
83
|
+
"PluginListenerHandle",
|
|
84
|
+
"BiometryChangeListener"
|
|
85
|
+
],
|
|
86
|
+
"slug": "addlistenerbiometrychange-"
|
|
87
|
+
},
|
|
43
88
|
{
|
|
44
89
|
"name": "verifyIdentity",
|
|
45
90
|
"signature": "(options?: BiometricOptions | undefined) => Promise<void>",
|
|
@@ -258,6 +303,29 @@
|
|
|
258
303
|
],
|
|
259
304
|
"type": "AuthenticationStrength"
|
|
260
305
|
},
|
|
306
|
+
{
|
|
307
|
+
"name": "biometryType",
|
|
308
|
+
"tags": [],
|
|
309
|
+
"docs": "The primary biometry type available on the device.\nOn Android devices with multiple biometry types, this returns MULTIPLE.\nUse this for display purposes only - always use isAvailable for logic decisions.",
|
|
310
|
+
"complexTypes": [
|
|
311
|
+
"BiometryType"
|
|
312
|
+
],
|
|
313
|
+
"type": "BiometryType"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"name": "deviceIsSecure",
|
|
317
|
+
"tags": [],
|
|
318
|
+
"docs": "Whether the device has a secure lock screen (PIN, pattern, or password).\nThis is independent of biometric enrollment.",
|
|
319
|
+
"complexTypes": [],
|
|
320
|
+
"type": "boolean"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "strongBiometryIsAvailable",
|
|
324
|
+
"tags": [],
|
|
325
|
+
"docs": "Whether strong biometry (Face ID, Touch ID, or fingerprint on devices that consider it strong)\nis specifically available, separate from weak biometry or device credentials.",
|
|
326
|
+
"complexTypes": [],
|
|
327
|
+
"type": "boolean"
|
|
328
|
+
},
|
|
261
329
|
{
|
|
262
330
|
"name": "errorCode",
|
|
263
331
|
"tags": [
|
|
@@ -290,6 +358,22 @@
|
|
|
290
358
|
}
|
|
291
359
|
]
|
|
292
360
|
},
|
|
361
|
+
{
|
|
362
|
+
"name": "PluginListenerHandle",
|
|
363
|
+
"slug": "pluginlistenerhandle",
|
|
364
|
+
"docs": "",
|
|
365
|
+
"tags": [],
|
|
366
|
+
"methods": [],
|
|
367
|
+
"properties": [
|
|
368
|
+
{
|
|
369
|
+
"name": "remove",
|
|
370
|
+
"tags": [],
|
|
371
|
+
"docs": "",
|
|
372
|
+
"complexTypes": [],
|
|
373
|
+
"type": "() => Promise<void>"
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
},
|
|
293
377
|
{
|
|
294
378
|
"name": "BiometricOptions",
|
|
295
379
|
"slug": "biometricoptions",
|
|
@@ -517,6 +601,54 @@
|
|
|
517
601
|
}
|
|
518
602
|
]
|
|
519
603
|
},
|
|
604
|
+
{
|
|
605
|
+
"name": "BiometryType",
|
|
606
|
+
"slug": "biometrytype",
|
|
607
|
+
"members": [
|
|
608
|
+
{
|
|
609
|
+
"name": "NONE",
|
|
610
|
+
"value": "0",
|
|
611
|
+
"tags": [],
|
|
612
|
+
"docs": ""
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"name": "TOUCH_ID",
|
|
616
|
+
"value": "1",
|
|
617
|
+
"tags": [],
|
|
618
|
+
"docs": ""
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
"name": "FACE_ID",
|
|
622
|
+
"value": "2",
|
|
623
|
+
"tags": [],
|
|
624
|
+
"docs": ""
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
"name": "FINGERPRINT",
|
|
628
|
+
"value": "3",
|
|
629
|
+
"tags": [],
|
|
630
|
+
"docs": ""
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "FACE_AUTHENTICATION",
|
|
634
|
+
"value": "4",
|
|
635
|
+
"tags": [],
|
|
636
|
+
"docs": ""
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"name": "IRIS_AUTHENTICATION",
|
|
640
|
+
"value": "5",
|
|
641
|
+
"tags": [],
|
|
642
|
+
"docs": ""
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"name": "MULTIPLE",
|
|
646
|
+
"value": "6",
|
|
647
|
+
"tags": [],
|
|
648
|
+
"docs": ""
|
|
649
|
+
}
|
|
650
|
+
]
|
|
651
|
+
},
|
|
520
652
|
{
|
|
521
653
|
"name": "BiometricAuthError",
|
|
522
654
|
"slug": "biometricautherror",
|
|
@@ -600,56 +732,22 @@
|
|
|
600
732
|
"docs": "User chose to use fallback authentication method\nPlatform: Android, iOS"
|
|
601
733
|
}
|
|
602
734
|
]
|
|
603
|
-
}
|
|
735
|
+
}
|
|
736
|
+
],
|
|
737
|
+
"typeAliases": [
|
|
604
738
|
{
|
|
605
|
-
"name": "
|
|
606
|
-
"slug": "
|
|
607
|
-
"
|
|
608
|
-
|
|
609
|
-
"name": "NONE",
|
|
610
|
-
"value": "0",
|
|
611
|
-
"tags": [],
|
|
612
|
-
"docs": ""
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
"name": "TOUCH_ID",
|
|
616
|
-
"value": "1",
|
|
617
|
-
"tags": [],
|
|
618
|
-
"docs": ""
|
|
619
|
-
},
|
|
739
|
+
"name": "BiometryChangeListener",
|
|
740
|
+
"slug": "biometrychangelistener",
|
|
741
|
+
"docs": "Callback type for biometry change listener",
|
|
742
|
+
"types": [
|
|
620
743
|
{
|
|
621
|
-
"
|
|
622
|
-
"
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"name": "FINGERPRINT",
|
|
628
|
-
"value": "3",
|
|
629
|
-
"tags": [],
|
|
630
|
-
"docs": ""
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
"name": "FACE_AUTHENTICATION",
|
|
634
|
-
"value": "4",
|
|
635
|
-
"tags": [],
|
|
636
|
-
"docs": ""
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
"name": "IRIS_AUTHENTICATION",
|
|
640
|
-
"value": "5",
|
|
641
|
-
"tags": [],
|
|
642
|
-
"docs": ""
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
"name": "MULTIPLE",
|
|
646
|
-
"value": "6",
|
|
647
|
-
"tags": [],
|
|
648
|
-
"docs": ""
|
|
744
|
+
"text": "(result: AvailableResult): void",
|
|
745
|
+
"complexTypes": [
|
|
746
|
+
"AvailableResult"
|
|
747
|
+
]
|
|
649
748
|
}
|
|
650
749
|
]
|
|
651
750
|
}
|
|
652
751
|
],
|
|
653
|
-
"typeAliases": [],
|
|
654
752
|
"pluginConfigs": []
|
|
655
753
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
1
2
|
export declare enum BiometryType {
|
|
2
3
|
NONE = 0,
|
|
3
4
|
TOUCH_ID = 1,
|
|
@@ -45,6 +46,22 @@ export interface AvailableResult {
|
|
|
45
46
|
* The strength of available authentication method (STRONG, WEAK, or NONE)
|
|
46
47
|
*/
|
|
47
48
|
authenticationStrength: AuthenticationStrength;
|
|
49
|
+
/**
|
|
50
|
+
* The primary biometry type available on the device.
|
|
51
|
+
* On Android devices with multiple biometry types, this returns MULTIPLE.
|
|
52
|
+
* Use this for display purposes only - always use isAvailable for logic decisions.
|
|
53
|
+
*/
|
|
54
|
+
biometryType: BiometryType;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the device has a secure lock screen (PIN, pattern, or password).
|
|
57
|
+
* This is independent of biometric enrollment.
|
|
58
|
+
*/
|
|
59
|
+
deviceIsSecure: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether strong biometry (Face ID, Touch ID, or fingerprint on devices that consider it strong)
|
|
62
|
+
* is specifically available, separate from weak biometry or device credentials.
|
|
63
|
+
*/
|
|
64
|
+
strongBiometryIsAvailable: boolean;
|
|
48
65
|
/**
|
|
49
66
|
* Error code from BiometricAuthError enum. Only present when isAvailable is false.
|
|
50
67
|
* Indicates why biometric authentication is not available.
|
|
@@ -172,6 +189,10 @@ export declare enum BiometricAuthError {
|
|
|
172
189
|
*/
|
|
173
190
|
USER_FALLBACK = 17
|
|
174
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Callback type for biometry change listener
|
|
194
|
+
*/
|
|
195
|
+
export declare type BiometryChangeListener = (result: AvailableResult) => void;
|
|
175
196
|
export interface NativeBiometricPlugin {
|
|
176
197
|
/**
|
|
177
198
|
* Checks if biometric authentication hardware is available.
|
|
@@ -181,6 +202,27 @@ export interface NativeBiometricPlugin {
|
|
|
181
202
|
* @since 1.0.0
|
|
182
203
|
*/
|
|
183
204
|
isAvailable(options?: IsAvailableOptions): Promise<AvailableResult>;
|
|
205
|
+
/**
|
|
206
|
+
* Adds a listener that is called when the app resumes from background.
|
|
207
|
+
* This is useful to detect if biometry availability has changed while
|
|
208
|
+
* the app was in the background (e.g., user enrolled/unenrolled biometrics).
|
|
209
|
+
*
|
|
210
|
+
* @param eventName - Must be 'biometryChange'
|
|
211
|
+
* @param {BiometryChangeListener} listener - Callback function that receives the updated AvailableResult
|
|
212
|
+
* @returns {Promise<PluginListenerHandle>} Handle to remove the listener
|
|
213
|
+
* @since 7.6.0
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const handle = await NativeBiometric.addListener('biometryChange', (result) => {
|
|
218
|
+
* console.log('Biometry availability changed:', result.isAvailable);
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* // To remove the listener:
|
|
222
|
+
* await handle.remove();
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
addListener(eventName: 'biometryChange', listener: BiometryChangeListener): Promise<PluginListenerHandle>;
|
|
184
226
|
/**
|
|
185
227
|
* Prompts the user to authenticate with biometrics.
|
|
186
228
|
* @param {BiometricOptions} [options]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAeX;AAfD,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;AACd,CAAC,EAfW,YAAY,KAAZ,YAAY,QAevB;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}\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/esm/web.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
3
|
+
import type { NativeBiometricPlugin, AvailableResult, BiometricOptions, GetCredentialOptions, SetCredentialOptions, DeleteCredentialOptions, IsCredentialsSavedOptions, IsCredentialsSavedResult, Credentials, BiometryChangeListener } from './definitions';
|
|
3
4
|
export declare class NativeBiometricWeb extends WebPlugin implements NativeBiometricPlugin {
|
|
4
5
|
constructor();
|
|
5
6
|
isAvailable(): Promise<AvailableResult>;
|
|
7
|
+
addListener(_eventName: 'biometryChange', _listener: BiometryChangeListener): Promise<PluginListenerHandle>;
|
|
6
8
|
verifyIdentity(_options?: BiometricOptions): Promise<void>;
|
|
7
9
|
getCredentials(_options: GetCredentialOptions): Promise<Credentials>;
|
|
8
10
|
setCredentials(_options: SetCredentialOptions): Promise<void>;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,30 +1,47 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import { BiometryType, AuthenticationStrength } from './definitions';
|
|
2
3
|
export class NativeBiometricWeb extends WebPlugin {
|
|
3
4
|
constructor() {
|
|
4
5
|
super();
|
|
5
6
|
}
|
|
6
7
|
isAvailable() {
|
|
7
|
-
|
|
8
|
+
// Web platform: biometrics not available, but return structured response
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
isAvailable: false,
|
|
11
|
+
authenticationStrength: AuthenticationStrength.NONE,
|
|
12
|
+
biometryType: BiometryType.NONE,
|
|
13
|
+
deviceIsSecure: false,
|
|
14
|
+
strongBiometryIsAvailable: false,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async addListener(_eventName, _listener) {
|
|
18
|
+
// Web platform: no-op, but return a valid handle
|
|
19
|
+
return {
|
|
20
|
+
remove: async () => {
|
|
21
|
+
// Nothing to remove on web
|
|
22
|
+
},
|
|
23
|
+
};
|
|
8
24
|
}
|
|
9
25
|
verifyIdentity(_options) {
|
|
10
26
|
console.log('verifyIdentity', _options);
|
|
11
|
-
throw new Error('
|
|
27
|
+
throw new Error('Biometric authentication is not available on web platform.');
|
|
12
28
|
}
|
|
13
29
|
getCredentials(_options) {
|
|
14
30
|
console.log('getCredentials', _options);
|
|
15
|
-
throw new Error('
|
|
31
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
16
32
|
}
|
|
17
33
|
setCredentials(_options) {
|
|
18
34
|
console.log('setCredentials', _options);
|
|
19
|
-
throw new Error('
|
|
35
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
20
36
|
}
|
|
21
37
|
deleteCredentials(_options) {
|
|
22
38
|
console.log('deleteCredentials', _options);
|
|
23
|
-
throw new Error('
|
|
39
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
24
40
|
}
|
|
25
41
|
isCredentialsSaved(_options) {
|
|
26
42
|
console.log('isCredentialsSaved', _options);
|
|
27
|
-
|
|
43
|
+
// Return false on web - no credentials can be saved
|
|
44
|
+
return Promise.resolve({ isSaved: false });
|
|
28
45
|
}
|
|
29
46
|
async getPluginVersion() {
|
|
30
47
|
return { version: 'web' };
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAErE,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,WAAW;QACT,yEAAyE;QACzE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,WAAW,EAAE,KAAK;YAClB,sBAAsB,EAAE,sBAAsB,CAAC,IAAI;YACnD,YAAY,EAAE,YAAY,CAAC,IAAI;YAC/B,cAAc,EAAE,KAAK;YACrB,yBAAyB,EAAE,KAAK;SACjC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,UAA4B,EAAE,SAAiC;QAC/E,iDAAiD;QACjD,OAAO;YACL,MAAM,EAAE,KAAK,IAAI,EAAE;gBACjB,2BAA2B;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,QAA2B;QACxC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,cAAc,CAAC,QAA8B;QAC3C,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,cAAc,CAAC,QAA8B;QAC3C,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,iBAAiB,CAAC,QAAiC;QACjD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,kBAAkB,CAAC,QAAmC;QACpD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;QAC5C,oDAAoD;QACpD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nimport type {\n NativeBiometricPlugin,\n AvailableResult,\n BiometricOptions,\n GetCredentialOptions,\n SetCredentialOptions,\n DeleteCredentialOptions,\n IsCredentialsSavedOptions,\n IsCredentialsSavedResult,\n Credentials,\n BiometryChangeListener,\n} from './definitions';\nimport { BiometryType, AuthenticationStrength } from './definitions';\n\nexport class NativeBiometricWeb extends WebPlugin implements NativeBiometricPlugin {\n constructor() {\n super();\n }\n\n isAvailable(): Promise<AvailableResult> {\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\n async addListener(_eventName: 'biometryChange', _listener: BiometryChangeListener): Promise<PluginListenerHandle> {\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\n verifyIdentity(_options?: BiometricOptions): Promise<void> {\n console.log('verifyIdentity', _options);\n throw new Error('Biometric authentication is not available on web platform.');\n }\n\n getCredentials(_options: GetCredentialOptions): Promise<Credentials> {\n console.log('getCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n\n setCredentials(_options: SetCredentialOptions): Promise<void> {\n console.log('setCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n\n deleteCredentials(_options: DeleteCredentialOptions): Promise<void> {\n console.log('deleteCredentials', _options);\n throw new Error('Credential storage is not available on web platform.');\n }\n\n isCredentialsSaved(_options: IsCredentialsSavedOptions): Promise<IsCredentialsSavedResult> {\n console.log('isCredentialsSaved', _options);\n // Return false on web - no credentials can be saved\n return Promise.resolve({ isSaved: false });\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -120,27 +120,43 @@ class NativeBiometricWeb extends core.WebPlugin {
|
|
|
120
120
|
super();
|
|
121
121
|
}
|
|
122
122
|
isAvailable() {
|
|
123
|
-
|
|
123
|
+
// Web platform: biometrics not available, but return structured response
|
|
124
|
+
return Promise.resolve({
|
|
125
|
+
isAvailable: false,
|
|
126
|
+
authenticationStrength: exports.AuthenticationStrength.NONE,
|
|
127
|
+
biometryType: exports.BiometryType.NONE,
|
|
128
|
+
deviceIsSecure: false,
|
|
129
|
+
strongBiometryIsAvailable: false,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async addListener(_eventName, _listener) {
|
|
133
|
+
// Web platform: no-op, but return a valid handle
|
|
134
|
+
return {
|
|
135
|
+
remove: async () => {
|
|
136
|
+
// Nothing to remove on web
|
|
137
|
+
},
|
|
138
|
+
};
|
|
124
139
|
}
|
|
125
140
|
verifyIdentity(_options) {
|
|
126
141
|
console.log('verifyIdentity', _options);
|
|
127
|
-
throw new Error('
|
|
142
|
+
throw new Error('Biometric authentication is not available on web platform.');
|
|
128
143
|
}
|
|
129
144
|
getCredentials(_options) {
|
|
130
145
|
console.log('getCredentials', _options);
|
|
131
|
-
throw new Error('
|
|
146
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
132
147
|
}
|
|
133
148
|
setCredentials(_options) {
|
|
134
149
|
console.log('setCredentials', _options);
|
|
135
|
-
throw new Error('
|
|
150
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
136
151
|
}
|
|
137
152
|
deleteCredentials(_options) {
|
|
138
153
|
console.log('deleteCredentials', _options);
|
|
139
|
-
throw new Error('
|
|
154
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
140
155
|
}
|
|
141
156
|
isCredentialsSaved(_options) {
|
|
142
157
|
console.log('isCredentialsSaved', _options);
|
|
143
|
-
|
|
158
|
+
// Return false on web - no credentials can be saved
|
|
159
|
+
return Promise.resolve({ isSaved: false });
|
|
144
160
|
}
|
|
145
161
|
async getPluginVersion() {
|
|
146
162
|
return { version: 'web' };
|
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';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n throw new Error('Method not implemented.');\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Method not implemented.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Method not implemented.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Method not implemented.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Method not implemented.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n throw new Error('Method not implemented.');\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,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;AACX,CAAC,UAAU,sBAAsB,EAAE;AACnC;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;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AAI,cAAc,CAAC,QAAQ,EAAE;AAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;AAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,iBAAiB,CAAC,QAAQ,EAAE;AAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC;AAClD,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,kBAAkB,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC;AACnD,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;AAClD;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC;AACA;;;;;;;;;"}
|
|
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 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,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAA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
isAvailable() {
|
|
122
|
-
|
|
122
|
+
// Web platform: biometrics not available, but return structured response
|
|
123
|
+
return Promise.resolve({
|
|
124
|
+
isAvailable: false,
|
|
125
|
+
authenticationStrength: exports.AuthenticationStrength.NONE,
|
|
126
|
+
biometryType: exports.BiometryType.NONE,
|
|
127
|
+
deviceIsSecure: false,
|
|
128
|
+
strongBiometryIsAvailable: false,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async addListener(_eventName, _listener) {
|
|
132
|
+
// Web platform: no-op, but return a valid handle
|
|
133
|
+
return {
|
|
134
|
+
remove: async () => {
|
|
135
|
+
// Nothing to remove on web
|
|
136
|
+
},
|
|
137
|
+
};
|
|
123
138
|
}
|
|
124
139
|
verifyIdentity(_options) {
|
|
125
140
|
console.log('verifyIdentity', _options);
|
|
126
|
-
throw new Error('
|
|
141
|
+
throw new Error('Biometric authentication is not available on web platform.');
|
|
127
142
|
}
|
|
128
143
|
getCredentials(_options) {
|
|
129
144
|
console.log('getCredentials', _options);
|
|
130
|
-
throw new Error('
|
|
145
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
131
146
|
}
|
|
132
147
|
setCredentials(_options) {
|
|
133
148
|
console.log('setCredentials', _options);
|
|
134
|
-
throw new Error('
|
|
149
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
135
150
|
}
|
|
136
151
|
deleteCredentials(_options) {
|
|
137
152
|
console.log('deleteCredentials', _options);
|
|
138
|
-
throw new Error('
|
|
153
|
+
throw new Error('Credential storage is not available on web platform.');
|
|
139
154
|
}
|
|
140
155
|
isCredentialsSaved(_options) {
|
|
141
156
|
console.log('isCredentialsSaved', _options);
|
|
142
|
-
|
|
157
|
+
// Return false on web - no credentials can be saved
|
|
158
|
+
return Promise.resolve({ isSaved: false });
|
|
143
159
|
}
|
|
144
160
|
async getPluginVersion() {
|
|
145
161
|
return { version: 'web' };
|
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';\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n throw new Error('Method not implemented.');\n }\n verifyIdentity(_options) {\n console.log('verifyIdentity', _options);\n throw new Error('Method not implemented.');\n }\n getCredentials(_options) {\n console.log('getCredentials', _options);\n throw new Error('Method not implemented.');\n }\n setCredentials(_options) {\n console.log('setCredentials', _options);\n throw new Error('Method not implemented.');\n }\n deleteCredentials(_options) {\n console.log('deleteCredentials', _options);\n throw new Error('Method not implemented.');\n }\n isCredentialsSaved(_options) {\n console.log('isCredentialsSaved', _options);\n throw new Error('Method not implemented.');\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,CA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C,cAAS,CAAC;IAClD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf;IACA,IAAI,WAAW,GAAG;IAClB,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;IAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;IAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;IAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,iBAAiB,CAAC,QAAQ,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAClD,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,kBAAkB,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACnD,QAAQ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;IAClD;IACA,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC;IACA;;;;;;;;;;;;;;;"}
|
|
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 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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C;IAClD,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;IAC/E;IACA,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;IACA,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -9,7 +9,7 @@ import LocalAuthentication
|
|
|
9
9
|
|
|
10
10
|
@objc(NativeBiometricPlugin)
|
|
11
11
|
public class NativeBiometricPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
12
|
-
private let pluginVersion: String = "7.
|
|
12
|
+
private let pluginVersion: String = "7.6.0"
|
|
13
13
|
public let identifier = "NativeBiometricPlugin"
|
|
14
14
|
public let jsName = "NativeBiometric"
|
|
15
15
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -21,65 +21,106 @@ public class NativeBiometricPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
21
21
|
CAPPluginMethod(name: "isCredentialsSaved", returnType: CAPPluginReturnPromise),
|
|
22
22
|
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
23
23
|
]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
override public func load() {
|
|
26
|
+
NotificationCenter.default.addObserver(
|
|
27
|
+
self,
|
|
28
|
+
selector: #selector(handleAppDidBecomeActive),
|
|
29
|
+
name: UIApplication.didBecomeActiveNotification,
|
|
30
|
+
object: nil
|
|
31
|
+
)
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
case unexpectedPasswordData
|
|
32
|
-
case duplicateItem
|
|
33
|
-
case unhandledError(status: OSStatus)
|
|
34
|
+
deinit {
|
|
35
|
+
NotificationCenter.default.removeObserver(self)
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
@objc private func handleAppDidBecomeActive() {
|
|
39
|
+
// Notify listeners when app becomes active (resumes from background)
|
|
40
|
+
let result = checkBiometryAvailability(useFallback: false)
|
|
41
|
+
notifyListeners("biometryChange", data: result)
|
|
42
|
+
}
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
private func checkBiometryAvailability(useFallback: Bool) -> JSObject {
|
|
39
45
|
let context = LAContext()
|
|
40
46
|
var error: NSError?
|
|
41
47
|
var obj = JSObject()
|
|
42
48
|
|
|
43
49
|
obj["isAvailable"] = false
|
|
44
50
|
obj["authenticationStrength"] = 0 // NONE
|
|
51
|
+
obj["biometryType"] = 0 // NONE
|
|
52
|
+
obj["deviceIsSecure"] = false
|
|
53
|
+
obj["strongBiometryIsAvailable"] = false
|
|
45
54
|
|
|
46
|
-
let useFallback = call.getBool("useFallback", false)
|
|
47
|
-
|
|
48
55
|
// Check biometric-only policy first
|
|
49
56
|
let biometricPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics
|
|
50
57
|
let hasBiometric = context.canEvaluatePolicy(biometricPolicy, error: &error)
|
|
51
|
-
|
|
58
|
+
|
|
59
|
+
// Determine biometry type
|
|
60
|
+
let biometryType: Int
|
|
61
|
+
switch context.biometryType {
|
|
62
|
+
case .touchID:
|
|
63
|
+
biometryType = 1 // TOUCH_ID
|
|
64
|
+
case .faceID:
|
|
65
|
+
biometryType = 2 // FACE_ID
|
|
66
|
+
case .opticID:
|
|
67
|
+
biometryType = 2 // Treat opticID as FACE_ID for compatibility
|
|
68
|
+
default:
|
|
69
|
+
biometryType = 0 // NONE
|
|
70
|
+
}
|
|
71
|
+
obj["biometryType"] = biometryType
|
|
72
|
+
|
|
73
|
+
// Check if device has passcode set (device is secure)
|
|
74
|
+
let devicePolicy = LAPolicy.deviceOwnerAuthentication
|
|
75
|
+
var deviceError: NSError?
|
|
76
|
+
let deviceIsSecure = context.canEvaluatePolicy(devicePolicy, error: &deviceError)
|
|
77
|
+
obj["deviceIsSecure"] = deviceIsSecure
|
|
78
|
+
|
|
52
79
|
// Check device credentials policy if fallback is enabled
|
|
53
80
|
var hasDeviceCredentials = false
|
|
54
81
|
if useFallback {
|
|
55
|
-
|
|
56
|
-
var deviceError: NSError?
|
|
57
|
-
hasDeviceCredentials = context.canEvaluatePolicy(devicePolicy, error: &deviceError)
|
|
82
|
+
hasDeviceCredentials = deviceIsSecure
|
|
58
83
|
}
|
|
59
|
-
|
|
84
|
+
|
|
85
|
+
// Strong biometry is available if biometric authentication works
|
|
86
|
+
// On iOS, both Face ID and Touch ID are considered STRONG
|
|
87
|
+
obj["strongBiometryIsAvailable"] = hasBiometric
|
|
88
|
+
|
|
60
89
|
if hasBiometric {
|
|
61
|
-
// Biometric available - Face ID and Touch ID are both considered STRONG on iOS
|
|
62
90
|
obj["authenticationStrength"] = 1 // STRONG
|
|
63
91
|
obj["isAvailable"] = true
|
|
64
|
-
call.resolve(obj)
|
|
65
92
|
} else if hasDeviceCredentials {
|
|
66
|
-
// Only device credentials (PIN/password) available when useFallback is true
|
|
67
|
-
// PIN/password is ALWAYS considered WEAK, never STRONG
|
|
68
93
|
obj["authenticationStrength"] = 2 // WEAK
|
|
69
94
|
obj["isAvailable"] = true
|
|
70
|
-
call.resolve(obj)
|
|
71
95
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
96
|
+
if let authError = error {
|
|
97
|
+
let pluginErrorCode = convertToPluginErrorCode(authError.code)
|
|
98
|
+
obj["errorCode"] = pluginErrorCode
|
|
99
|
+
} else {
|
|
74
100
|
obj["errorCode"] = 0
|
|
75
|
-
call.resolve(obj)
|
|
76
|
-
return
|
|
77
101
|
}
|
|
78
|
-
var pluginErrorCode = convertToPluginErrorCode(authError.code)
|
|
79
|
-
obj["errorCode"] = pluginErrorCode
|
|
80
|
-
call.resolve(obj)
|
|
81
102
|
}
|
|
82
103
|
|
|
104
|
+
return obj
|
|
105
|
+
}
|
|
106
|
+
struct Credentials {
|
|
107
|
+
var username: String
|
|
108
|
+
var password: String
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
enum KeychainError: Error {
|
|
112
|
+
case noPassword
|
|
113
|
+
case unexpectedPasswordData
|
|
114
|
+
case duplicateItem
|
|
115
|
+
case unhandledError(status: OSStatus)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
typealias JSObject = [String: Any]
|
|
119
|
+
|
|
120
|
+
@objc func isAvailable(_ call: CAPPluginCall) {
|
|
121
|
+
let useFallback = call.getBool("useFallback", false)
|
|
122
|
+
let result = checkBiometryAvailability(useFallback: useFallback)
|
|
123
|
+
call.resolve(result)
|
|
83
124
|
}
|
|
84
125
|
|
|
85
126
|
@objc func verifyIdentity(_ call: CAPPluginCall) {
|
package/package.json
CHANGED