@capgo/capacitor-native-biometric 7.4.4 → 7.5.1
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 +35 -5
- package/android/src/main/java/ee/forgr/biometric/NativeBiometric.java +75 -62
- package/dist/docs.json +125 -10
- package/dist/esm/definitions.d.ts +86 -2
- package/dist/esm/definitions.js +71 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js +71 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +71 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NativeBiometricPlugin/NativeBiometricPlugin.swift +25 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -236,11 +236,13 @@ Get the native Capacitor plugin version.
|
|
|
236
236
|
|
|
237
237
|
#### AvailableResult
|
|
238
238
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
|
242
|
-
|
|
|
243
|
-
| **`
|
|
239
|
+
Result from isAvailable() method indicating biometric authentication availability.
|
|
240
|
+
|
|
241
|
+
| Prop | Type | Description |
|
|
242
|
+
| ---------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
243
|
+
| **`isAvailable`** | <code>boolean</code> | Whether authentication is available (biometric or fallback if useFallback is true) |
|
|
244
|
+
| **`authenticationStrength`** | <code><a href="#authenticationstrength">AuthenticationStrength</a></code> | The strength of available authentication method (STRONG, WEAK, or NONE) |
|
|
245
|
+
| **`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. |
|
|
244
246
|
|
|
245
247
|
|
|
246
248
|
#### IsAvailableOptions
|
|
@@ -313,6 +315,34 @@ Get the native Capacitor plugin version.
|
|
|
313
315
|
### Enums
|
|
314
316
|
|
|
315
317
|
|
|
318
|
+
#### AuthenticationStrength
|
|
319
|
+
|
|
320
|
+
| Members | Value | Description |
|
|
321
|
+
| ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
322
|
+
| **`NONE`** | <code>0</code> | No authentication available, even if PIN is available but useFallback = false |
|
|
323
|
+
| **`STRONG`** | <code>1</code> | Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android). Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true. |
|
|
324
|
+
| **`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
|
+
|
|
326
|
+
|
|
327
|
+
#### BiometricAuthError
|
|
328
|
+
|
|
329
|
+
| Members | Value | Description |
|
|
330
|
+
| ----------------------------- | --------------- | ------------------------------------------------------------------------------------- |
|
|
331
|
+
| **`UNKNOWN_ERROR`** | <code>0</code> | Unknown error occurred |
|
|
332
|
+
| **`BIOMETRICS_UNAVAILABLE`** | <code>1</code> | Biometrics are unavailable (no hardware or hardware error) Platform: Android, iOS |
|
|
333
|
+
| **`USER_LOCKOUT`** | <code>2</code> | User has been locked out due to too many failed attempts Platform: Android, iOS |
|
|
334
|
+
| **`BIOMETRICS_NOT_ENROLLED`** | <code>3</code> | No biometrics are enrolled on the device Platform: Android, iOS |
|
|
335
|
+
| **`USER_TEMPORARY_LOCKOUT`** | <code>4</code> | User is temporarily locked out (Android: 30 second lockout) Platform: Android |
|
|
336
|
+
| **`AUTHENTICATION_FAILED`** | <code>10</code> | Authentication failed (user did not authenticate successfully) Platform: Android, iOS |
|
|
337
|
+
| **`APP_CANCEL`** | <code>11</code> | App canceled the authentication (iOS only) Platform: iOS |
|
|
338
|
+
| **`INVALID_CONTEXT`** | <code>12</code> | Invalid context (iOS only) Platform: iOS |
|
|
339
|
+
| **`NOT_INTERACTIVE`** | <code>13</code> | Authentication was not interactive (iOS only) Platform: iOS |
|
|
340
|
+
| **`PASSCODE_NOT_SET`** | <code>14</code> | Passcode/PIN is not set on the device Platform: Android, iOS |
|
|
341
|
+
| **`SYSTEM_CANCEL`** | <code>15</code> | System canceled the authentication (e.g., due to screen lock) Platform: Android, iOS |
|
|
342
|
+
| **`USER_CANCEL`** | <code>16</code> | User canceled the authentication Platform: Android, iOS |
|
|
343
|
+
| **`USER_FALLBACK`** | <code>17</code> | User chose to use fallback authentication method Platform: Android, iOS |
|
|
344
|
+
|
|
345
|
+
|
|
316
346
|
#### BiometryType
|
|
317
347
|
|
|
318
348
|
| Members | Value |
|
|
@@ -61,6 +61,11 @@ public class NativeBiometric extends Plugin {
|
|
|
61
61
|
private static final int IRIS_AUTHENTICATION = 5;
|
|
62
62
|
private static final int MULTIPLE = 6;
|
|
63
63
|
|
|
64
|
+
// AuthenticationStrength enum values
|
|
65
|
+
private static final int AUTH_STRENGTH_NONE = 0;
|
|
66
|
+
private static final int AUTH_STRENGTH_STRONG = 1;
|
|
67
|
+
private static final int AUTH_STRENGTH_WEAK = 2;
|
|
68
|
+
|
|
64
69
|
private KeyStore keyStore;
|
|
65
70
|
private static final String ANDROID_KEY_STORE = "AndroidKeyStore";
|
|
66
71
|
private static final String TRANSFORMATION = "AES/GCM/NoPadding";
|
|
@@ -72,52 +77,6 @@ public class NativeBiometric extends Plugin {
|
|
|
72
77
|
|
|
73
78
|
private SharedPreferences encryptedSharedPreferences;
|
|
74
79
|
|
|
75
|
-
private int getAvailableFeature() {
|
|
76
|
-
// default to none
|
|
77
|
-
BiometricManager biometricManager = BiometricManager.from(getContext());
|
|
78
|
-
|
|
79
|
-
// Check for biometric capabilities
|
|
80
|
-
int authenticators = BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
81
|
-
int canAuthenticate = biometricManager.canAuthenticate(authenticators);
|
|
82
|
-
|
|
83
|
-
if (canAuthenticate == BiometricManager.BIOMETRIC_SUCCESS) {
|
|
84
|
-
// Check specific features
|
|
85
|
-
PackageManager pm = getContext().getPackageManager();
|
|
86
|
-
boolean hasFinger = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
|
|
87
|
-
boolean hasIris = false;
|
|
88
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
89
|
-
hasIris = pm.hasSystemFeature(PackageManager.FEATURE_IRIS);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// For face, we rely on BiometricManager since it's more reliable
|
|
93
|
-
boolean hasFace = false;
|
|
94
|
-
try {
|
|
95
|
-
// Try to create a face authentication prompt - if it succeeds, face auth is available
|
|
96
|
-
androidx.biometric.BiometricPrompt.PromptInfo promptInfo = new androidx.biometric.BiometricPrompt.PromptInfo.Builder()
|
|
97
|
-
.setTitle("Test")
|
|
98
|
-
.setNegativeButtonText("Cancel")
|
|
99
|
-
.setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG)
|
|
100
|
-
.build();
|
|
101
|
-
hasFace = true;
|
|
102
|
-
} catch (Exception e) {
|
|
103
|
-
System.out.println("Error creating face authentication prompt: " + e.getMessage());
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Determine the type based on available features
|
|
107
|
-
if (hasFinger && (hasFace || hasIris)) {
|
|
108
|
-
return MULTIPLE;
|
|
109
|
-
} else if (hasFinger) {
|
|
110
|
-
return FINGERPRINT;
|
|
111
|
-
} else if (hasFace) {
|
|
112
|
-
return FACE_AUTHENTICATION;
|
|
113
|
-
} else if (hasIris) {
|
|
114
|
-
return IRIS_AUTHENTICATION;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return NONE;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
80
|
@PluginMethod
|
|
122
81
|
public void isAvailable(PluginCall call) {
|
|
123
82
|
JSObject ret = new JSObject();
|
|
@@ -125,29 +84,64 @@ public class NativeBiometric extends Plugin {
|
|
|
125
84
|
boolean useFallback = Boolean.TRUE.equals(call.getBoolean("useFallback", false));
|
|
126
85
|
|
|
127
86
|
BiometricManager biometricManager = BiometricManager.from(getContext());
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
|
|
87
|
+
|
|
88
|
+
// Check for strong biometrics first
|
|
89
|
+
int strongAuthenticators = BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
|
90
|
+
int strongResult = biometricManager.canAuthenticate(strongAuthenticators);
|
|
91
|
+
boolean hasStrongBiometric = (strongResult == BiometricManager.BIOMETRIC_SUCCESS);
|
|
92
|
+
|
|
93
|
+
// Check for weak biometrics
|
|
94
|
+
int weakAuthenticators = BiometricManager.Authenticators.BIOMETRIC_WEAK;
|
|
95
|
+
int weakResult = biometricManager.canAuthenticate(weakAuthenticators);
|
|
96
|
+
boolean hasWeakBiometric = (weakResult == BiometricManager.BIOMETRIC_SUCCESS);
|
|
97
|
+
|
|
98
|
+
// Check if device has credentials (PIN/pattern/password)
|
|
136
99
|
boolean fallbackAvailable = useFallback && this.deviceHasCredentials();
|
|
137
|
-
if (useFallback && !fallbackAvailable) {
|
|
138
|
-
canAuthenticateResult = BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE;
|
|
139
|
-
}
|
|
140
100
|
|
|
141
|
-
|
|
142
|
-
|
|
101
|
+
// Determine authentication strength
|
|
102
|
+
int authenticationStrength = AUTH_STRENGTH_NONE;
|
|
103
|
+
boolean isAvailable = false;
|
|
104
|
+
|
|
105
|
+
if (hasStrongBiometric) {
|
|
106
|
+
// Strong biometric available (fingerprints on devices that consider them strong)
|
|
107
|
+
authenticationStrength = AUTH_STRENGTH_STRONG;
|
|
108
|
+
isAvailable = true;
|
|
109
|
+
} else if (hasWeakBiometric) {
|
|
110
|
+
// Only weak biometric available (face on devices that consider it weak)
|
|
111
|
+
authenticationStrength = AUTH_STRENGTH_WEAK;
|
|
112
|
+
isAvailable = true;
|
|
113
|
+
} else if (fallbackAvailable) {
|
|
114
|
+
// No biometrics but fallback (PIN/pattern/password) is available
|
|
115
|
+
// PIN/pattern/password is ALWAYS considered WEAK, never STRONG
|
|
116
|
+
authenticationStrength = AUTH_STRENGTH_WEAK;
|
|
117
|
+
isAvailable = true;
|
|
118
|
+
}
|
|
143
119
|
|
|
120
|
+
// Handle error codes when authentication is not available
|
|
144
121
|
if (!isAvailable) {
|
|
145
|
-
|
|
146
|
-
|
|
122
|
+
int biometricManagerErrorCode;
|
|
123
|
+
|
|
124
|
+
// Prefer the error from strong biometric check if it failed
|
|
125
|
+
if (strongResult != BiometricManager.BIOMETRIC_SUCCESS) {
|
|
126
|
+
biometricManagerErrorCode = strongResult;
|
|
127
|
+
} else if (weakResult != BiometricManager.BIOMETRIC_SUCCESS) {
|
|
128
|
+
// Otherwise use error from weak biometric check if it failed
|
|
129
|
+
biometricManagerErrorCode = weakResult;
|
|
130
|
+
} 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
|
+
biometricManagerErrorCode = BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Convert BiometricManager error codes to plugin error codes
|
|
139
|
+
int pluginErrorCode = convertBiometricManagerErrorToPluginError(biometricManagerErrorCode);
|
|
147
140
|
ret.put("errorCode", pluginErrorCode);
|
|
148
141
|
}
|
|
149
142
|
|
|
150
|
-
ret.put("
|
|
143
|
+
ret.put("isAvailable", isAvailable);
|
|
144
|
+
ret.put("authenticationStrength", authenticationStrength);
|
|
151
145
|
call.resolve(ret);
|
|
152
146
|
}
|
|
153
147
|
|
|
@@ -463,6 +457,25 @@ public class NativeBiometric extends Plugin {
|
|
|
463
457
|
return keyguardManager.isDeviceSecure();
|
|
464
458
|
}
|
|
465
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Convert BiometricManager error codes to plugin error codes
|
|
462
|
+
* BiometricManager constants have different values than BiometricPrompt constants
|
|
463
|
+
*/
|
|
464
|
+
private int convertBiometricManagerErrorToPluginError(int errorCode) {
|
|
465
|
+
switch (errorCode) {
|
|
466
|
+
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
|
467
|
+
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
|
468
|
+
case BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED:
|
|
469
|
+
return 1; // BIOMETRICS_UNAVAILABLE
|
|
470
|
+
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
|
471
|
+
return 3; // BIOMETRICS_NOT_ENROLLED
|
|
472
|
+
case BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED:
|
|
473
|
+
return 1; // BIOMETRICS_UNAVAILABLE (security update required, treat as unavailable)
|
|
474
|
+
default:
|
|
475
|
+
return 0; // UNKNOWN_ERROR
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
466
479
|
@PluginMethod
|
|
467
480
|
public void getPluginVersion(final PluginCall call) {
|
|
468
481
|
try {
|
package/dist/docs.json
CHANGED
|
@@ -238,32 +238,39 @@
|
|
|
238
238
|
{
|
|
239
239
|
"name": "AvailableResult",
|
|
240
240
|
"slug": "availableresult",
|
|
241
|
-
"docs": "",
|
|
241
|
+
"docs": "Result from isAvailable() method indicating biometric authentication availability.",
|
|
242
242
|
"tags": [],
|
|
243
243
|
"methods": [],
|
|
244
244
|
"properties": [
|
|
245
245
|
{
|
|
246
246
|
"name": "isAvailable",
|
|
247
247
|
"tags": [],
|
|
248
|
-
"docs": "",
|
|
248
|
+
"docs": "Whether authentication is available (biometric or fallback if useFallback is true)",
|
|
249
249
|
"complexTypes": [],
|
|
250
250
|
"type": "boolean"
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
|
-
"name": "
|
|
253
|
+
"name": "authenticationStrength",
|
|
254
254
|
"tags": [],
|
|
255
|
-
"docs": "",
|
|
255
|
+
"docs": "The strength of available authentication method (STRONG, WEAK, or NONE)",
|
|
256
256
|
"complexTypes": [
|
|
257
|
-
"
|
|
257
|
+
"AuthenticationStrength"
|
|
258
258
|
],
|
|
259
|
-
"type": "
|
|
259
|
+
"type": "AuthenticationStrength"
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
262
|
"name": "errorCode",
|
|
263
|
-
"tags": [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
"tags": [
|
|
264
|
+
{
|
|
265
|
+
"text": "BiometricAuthError",
|
|
266
|
+
"name": "see"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"docs": "Error code from BiometricAuthError enum. Only present when isAvailable is false.\nIndicates why biometric authentication is not available.",
|
|
270
|
+
"complexTypes": [
|
|
271
|
+
"BiometricAuthError"
|
|
272
|
+
],
|
|
273
|
+
"type": "BiometricAuthError"
|
|
267
274
|
}
|
|
268
275
|
]
|
|
269
276
|
},
|
|
@@ -486,6 +493,114 @@
|
|
|
486
493
|
}
|
|
487
494
|
],
|
|
488
495
|
"enums": [
|
|
496
|
+
{
|
|
497
|
+
"name": "AuthenticationStrength",
|
|
498
|
+
"slug": "authenticationstrength",
|
|
499
|
+
"members": [
|
|
500
|
+
{
|
|
501
|
+
"name": "NONE",
|
|
502
|
+
"value": "0",
|
|
503
|
+
"tags": [],
|
|
504
|
+
"docs": "No authentication available, even if PIN is available but useFallback = false"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"name": "STRONG",
|
|
508
|
+
"value": "1",
|
|
509
|
+
"tags": [],
|
|
510
|
+
"docs": "Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).\nNote: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true."
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"name": "WEAK",
|
|
514
|
+
"value": "2",
|
|
515
|
+
"tags": [],
|
|
516
|
+
"docs": "Weak authentication: Face authentication on Android devices that consider face weak,\nor PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG)."
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"name": "BiometricAuthError",
|
|
522
|
+
"slug": "biometricautherror",
|
|
523
|
+
"members": [
|
|
524
|
+
{
|
|
525
|
+
"name": "UNKNOWN_ERROR",
|
|
526
|
+
"value": "0",
|
|
527
|
+
"tags": [],
|
|
528
|
+
"docs": "Unknown error occurred"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "BIOMETRICS_UNAVAILABLE",
|
|
532
|
+
"value": "1",
|
|
533
|
+
"tags": [],
|
|
534
|
+
"docs": "Biometrics are unavailable (no hardware or hardware error)\nPlatform: Android, iOS"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"name": "USER_LOCKOUT",
|
|
538
|
+
"value": "2",
|
|
539
|
+
"tags": [],
|
|
540
|
+
"docs": "User has been locked out due to too many failed attempts\nPlatform: Android, iOS"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"name": "BIOMETRICS_NOT_ENROLLED",
|
|
544
|
+
"value": "3",
|
|
545
|
+
"tags": [],
|
|
546
|
+
"docs": "No biometrics are enrolled on the device\nPlatform: Android, iOS"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"name": "USER_TEMPORARY_LOCKOUT",
|
|
550
|
+
"value": "4",
|
|
551
|
+
"tags": [],
|
|
552
|
+
"docs": "User is temporarily locked out (Android: 30 second lockout)\nPlatform: Android"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"name": "AUTHENTICATION_FAILED",
|
|
556
|
+
"value": "10",
|
|
557
|
+
"tags": [],
|
|
558
|
+
"docs": "Authentication failed (user did not authenticate successfully)\nPlatform: Android, iOS"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"name": "APP_CANCEL",
|
|
562
|
+
"value": "11",
|
|
563
|
+
"tags": [],
|
|
564
|
+
"docs": "App canceled the authentication (iOS only)\nPlatform: iOS"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"name": "INVALID_CONTEXT",
|
|
568
|
+
"value": "12",
|
|
569
|
+
"tags": [],
|
|
570
|
+
"docs": "Invalid context (iOS only)\nPlatform: iOS"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"name": "NOT_INTERACTIVE",
|
|
574
|
+
"value": "13",
|
|
575
|
+
"tags": [],
|
|
576
|
+
"docs": "Authentication was not interactive (iOS only)\nPlatform: iOS"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"name": "PASSCODE_NOT_SET",
|
|
580
|
+
"value": "14",
|
|
581
|
+
"tags": [],
|
|
582
|
+
"docs": "Passcode/PIN is not set on the device\nPlatform: Android, iOS"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"name": "SYSTEM_CANCEL",
|
|
586
|
+
"value": "15",
|
|
587
|
+
"tags": [],
|
|
588
|
+
"docs": "System canceled the authentication (e.g., due to screen lock)\nPlatform: Android, iOS"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"name": "USER_CANCEL",
|
|
592
|
+
"value": "16",
|
|
593
|
+
"tags": [],
|
|
594
|
+
"docs": "User canceled the authentication\nPlatform: Android, iOS"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"name": "USER_FALLBACK",
|
|
598
|
+
"value": "17",
|
|
599
|
+
"tags": [],
|
|
600
|
+
"docs": "User chose to use fallback authentication method\nPlatform: Android, iOS"
|
|
601
|
+
}
|
|
602
|
+
]
|
|
603
|
+
},
|
|
489
604
|
{
|
|
490
605
|
"name": "BiometryType",
|
|
491
606
|
"slug": "biometrytype",
|
|
@@ -7,6 +7,22 @@ export declare enum BiometryType {
|
|
|
7
7
|
IRIS_AUTHENTICATION = 5,
|
|
8
8
|
MULTIPLE = 6
|
|
9
9
|
}
|
|
10
|
+
export declare enum AuthenticationStrength {
|
|
11
|
+
/**
|
|
12
|
+
* No authentication available, even if PIN is available but useFallback = false
|
|
13
|
+
*/
|
|
14
|
+
NONE = 0,
|
|
15
|
+
/**
|
|
16
|
+
* Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).
|
|
17
|
+
* Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.
|
|
18
|
+
*/
|
|
19
|
+
STRONG = 1,
|
|
20
|
+
/**
|
|
21
|
+
* Weak authentication: Face authentication on Android devices that consider face weak,
|
|
22
|
+
* or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).
|
|
23
|
+
*/
|
|
24
|
+
WEAK = 2
|
|
25
|
+
}
|
|
10
26
|
export interface Credentials {
|
|
11
27
|
username: string;
|
|
12
28
|
password: string;
|
|
@@ -17,10 +33,24 @@ export interface IsAvailableOptions {
|
|
|
17
33
|
*/
|
|
18
34
|
useFallback: boolean;
|
|
19
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Result from isAvailable() method indicating biometric authentication availability.
|
|
38
|
+
*/
|
|
20
39
|
export interface AvailableResult {
|
|
40
|
+
/**
|
|
41
|
+
* Whether authentication is available (biometric or fallback if useFallback is true)
|
|
42
|
+
*/
|
|
21
43
|
isAvailable: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The strength of available authentication method (STRONG, WEAK, or NONE)
|
|
46
|
+
*/
|
|
47
|
+
authenticationStrength: AuthenticationStrength;
|
|
48
|
+
/**
|
|
49
|
+
* Error code from BiometricAuthError enum. Only present when isAvailable is false.
|
|
50
|
+
* Indicates why biometric authentication is not available.
|
|
51
|
+
* @see BiometricAuthError
|
|
52
|
+
*/
|
|
53
|
+
errorCode?: BiometricAuthError;
|
|
24
54
|
}
|
|
25
55
|
export interface BiometricOptions {
|
|
26
56
|
reason?: string;
|
|
@@ -70,22 +100,76 @@ export interface IsCredentialsSavedResult {
|
|
|
70
100
|
isSaved: boolean;
|
|
71
101
|
}
|
|
72
102
|
/**
|
|
103
|
+
* Biometric authentication error codes.
|
|
104
|
+
* These error codes are used in both isAvailable() and verifyIdentity() methods.
|
|
105
|
+
*
|
|
73
106
|
* Keep this in sync with BiometricAuthError in README.md
|
|
74
107
|
* Update whenever `convertToPluginErrorCode` functions are modified
|
|
75
108
|
*/
|
|
76
109
|
export declare enum BiometricAuthError {
|
|
110
|
+
/**
|
|
111
|
+
* Unknown error occurred
|
|
112
|
+
*/
|
|
77
113
|
UNKNOWN_ERROR = 0,
|
|
114
|
+
/**
|
|
115
|
+
* Biometrics are unavailable (no hardware or hardware error)
|
|
116
|
+
* Platform: Android, iOS
|
|
117
|
+
*/
|
|
78
118
|
BIOMETRICS_UNAVAILABLE = 1,
|
|
119
|
+
/**
|
|
120
|
+
* User has been locked out due to too many failed attempts
|
|
121
|
+
* Platform: Android, iOS
|
|
122
|
+
*/
|
|
79
123
|
USER_LOCKOUT = 2,
|
|
124
|
+
/**
|
|
125
|
+
* No biometrics are enrolled on the device
|
|
126
|
+
* Platform: Android, iOS
|
|
127
|
+
*/
|
|
80
128
|
BIOMETRICS_NOT_ENROLLED = 3,
|
|
129
|
+
/**
|
|
130
|
+
* User is temporarily locked out (Android: 30 second lockout)
|
|
131
|
+
* Platform: Android
|
|
132
|
+
*/
|
|
81
133
|
USER_TEMPORARY_LOCKOUT = 4,
|
|
134
|
+
/**
|
|
135
|
+
* Authentication failed (user did not authenticate successfully)
|
|
136
|
+
* Platform: Android, iOS
|
|
137
|
+
*/
|
|
82
138
|
AUTHENTICATION_FAILED = 10,
|
|
139
|
+
/**
|
|
140
|
+
* App canceled the authentication (iOS only)
|
|
141
|
+
* Platform: iOS
|
|
142
|
+
*/
|
|
83
143
|
APP_CANCEL = 11,
|
|
144
|
+
/**
|
|
145
|
+
* Invalid context (iOS only)
|
|
146
|
+
* Platform: iOS
|
|
147
|
+
*/
|
|
84
148
|
INVALID_CONTEXT = 12,
|
|
149
|
+
/**
|
|
150
|
+
* Authentication was not interactive (iOS only)
|
|
151
|
+
* Platform: iOS
|
|
152
|
+
*/
|
|
85
153
|
NOT_INTERACTIVE = 13,
|
|
154
|
+
/**
|
|
155
|
+
* Passcode/PIN is not set on the device
|
|
156
|
+
* Platform: Android, iOS
|
|
157
|
+
*/
|
|
86
158
|
PASSCODE_NOT_SET = 14,
|
|
159
|
+
/**
|
|
160
|
+
* System canceled the authentication (e.g., due to screen lock)
|
|
161
|
+
* Platform: Android, iOS
|
|
162
|
+
*/
|
|
87
163
|
SYSTEM_CANCEL = 15,
|
|
164
|
+
/**
|
|
165
|
+
* User canceled the authentication
|
|
166
|
+
* Platform: Android, iOS
|
|
167
|
+
*/
|
|
88
168
|
USER_CANCEL = 16,
|
|
169
|
+
/**
|
|
170
|
+
* User chose to use fallback authentication method
|
|
171
|
+
* Platform: Android, iOS
|
|
172
|
+
*/
|
|
89
173
|
USER_FALLBACK = 17
|
|
90
174
|
}
|
|
91
175
|
export interface NativeBiometricPlugin {
|
package/dist/esm/definitions.js
CHANGED
|
@@ -15,24 +15,95 @@ export var BiometryType;
|
|
|
15
15
|
// Android
|
|
16
16
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
17
17
|
})(BiometryType || (BiometryType = {}));
|
|
18
|
+
export var AuthenticationStrength;
|
|
19
|
+
(function (AuthenticationStrength) {
|
|
20
|
+
/**
|
|
21
|
+
* No authentication available, even if PIN is available but useFallback = false
|
|
22
|
+
*/
|
|
23
|
+
AuthenticationStrength[AuthenticationStrength["NONE"] = 0] = "NONE";
|
|
24
|
+
/**
|
|
25
|
+
* Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).
|
|
26
|
+
* Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.
|
|
27
|
+
*/
|
|
28
|
+
AuthenticationStrength[AuthenticationStrength["STRONG"] = 1] = "STRONG";
|
|
29
|
+
/**
|
|
30
|
+
* Weak authentication: Face authentication on Android devices that consider face weak,
|
|
31
|
+
* or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).
|
|
32
|
+
*/
|
|
33
|
+
AuthenticationStrength[AuthenticationStrength["WEAK"] = 2] = "WEAK";
|
|
34
|
+
})(AuthenticationStrength || (AuthenticationStrength = {}));
|
|
18
35
|
/**
|
|
36
|
+
* Biometric authentication error codes.
|
|
37
|
+
* These error codes are used in both isAvailable() and verifyIdentity() methods.
|
|
38
|
+
*
|
|
19
39
|
* Keep this in sync with BiometricAuthError in README.md
|
|
20
40
|
* Update whenever `convertToPluginErrorCode` functions are modified
|
|
21
41
|
*/
|
|
22
42
|
export var BiometricAuthError;
|
|
23
43
|
(function (BiometricAuthError) {
|
|
44
|
+
/**
|
|
45
|
+
* Unknown error occurred
|
|
46
|
+
*/
|
|
24
47
|
BiometricAuthError[BiometricAuthError["UNKNOWN_ERROR"] = 0] = "UNKNOWN_ERROR";
|
|
48
|
+
/**
|
|
49
|
+
* Biometrics are unavailable (no hardware or hardware error)
|
|
50
|
+
* Platform: Android, iOS
|
|
51
|
+
*/
|
|
25
52
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_UNAVAILABLE"] = 1] = "BIOMETRICS_UNAVAILABLE";
|
|
53
|
+
/**
|
|
54
|
+
* User has been locked out due to too many failed attempts
|
|
55
|
+
* Platform: Android, iOS
|
|
56
|
+
*/
|
|
26
57
|
BiometricAuthError[BiometricAuthError["USER_LOCKOUT"] = 2] = "USER_LOCKOUT";
|
|
58
|
+
/**
|
|
59
|
+
* No biometrics are enrolled on the device
|
|
60
|
+
* Platform: Android, iOS
|
|
61
|
+
*/
|
|
27
62
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_NOT_ENROLLED"] = 3] = "BIOMETRICS_NOT_ENROLLED";
|
|
63
|
+
/**
|
|
64
|
+
* User is temporarily locked out (Android: 30 second lockout)
|
|
65
|
+
* Platform: Android
|
|
66
|
+
*/
|
|
28
67
|
BiometricAuthError[BiometricAuthError["USER_TEMPORARY_LOCKOUT"] = 4] = "USER_TEMPORARY_LOCKOUT";
|
|
68
|
+
/**
|
|
69
|
+
* Authentication failed (user did not authenticate successfully)
|
|
70
|
+
* Platform: Android, iOS
|
|
71
|
+
*/
|
|
29
72
|
BiometricAuthError[BiometricAuthError["AUTHENTICATION_FAILED"] = 10] = "AUTHENTICATION_FAILED";
|
|
73
|
+
/**
|
|
74
|
+
* App canceled the authentication (iOS only)
|
|
75
|
+
* Platform: iOS
|
|
76
|
+
*/
|
|
30
77
|
BiometricAuthError[BiometricAuthError["APP_CANCEL"] = 11] = "APP_CANCEL";
|
|
78
|
+
/**
|
|
79
|
+
* Invalid context (iOS only)
|
|
80
|
+
* Platform: iOS
|
|
81
|
+
*/
|
|
31
82
|
BiometricAuthError[BiometricAuthError["INVALID_CONTEXT"] = 12] = "INVALID_CONTEXT";
|
|
83
|
+
/**
|
|
84
|
+
* Authentication was not interactive (iOS only)
|
|
85
|
+
* Platform: iOS
|
|
86
|
+
*/
|
|
32
87
|
BiometricAuthError[BiometricAuthError["NOT_INTERACTIVE"] = 13] = "NOT_INTERACTIVE";
|
|
88
|
+
/**
|
|
89
|
+
* Passcode/PIN is not set on the device
|
|
90
|
+
* Platform: Android, iOS
|
|
91
|
+
*/
|
|
33
92
|
BiometricAuthError[BiometricAuthError["PASSCODE_NOT_SET"] = 14] = "PASSCODE_NOT_SET";
|
|
93
|
+
/**
|
|
94
|
+
* System canceled the authentication (e.g., due to screen lock)
|
|
95
|
+
* Platform: Android, iOS
|
|
96
|
+
*/
|
|
34
97
|
BiometricAuthError[BiometricAuthError["SYSTEM_CANCEL"] = 15] = "SYSTEM_CANCEL";
|
|
98
|
+
/**
|
|
99
|
+
* User canceled the authentication
|
|
100
|
+
* Platform: Android, iOS
|
|
101
|
+
*/
|
|
35
102
|
BiometricAuthError[BiometricAuthError["USER_CANCEL"] = 16] = "USER_CANCEL";
|
|
103
|
+
/**
|
|
104
|
+
* User chose to use fallback authentication method
|
|
105
|
+
* Platform: Android, iOS
|
|
106
|
+
*/
|
|
36
107
|
BiometricAuthError[BiometricAuthError["USER_FALLBACK"] = 17] = "USER_FALLBACK";
|
|
37
108
|
})(BiometricAuthError || (BiometricAuthError = {}));
|
|
38
109
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,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;
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,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;AAuFD;;;;;;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":["export 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 * 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\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 * 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
|
@@ -19,24 +19,95 @@ exports.BiometryType = void 0;
|
|
|
19
19
|
// Android
|
|
20
20
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
21
21
|
})(exports.BiometryType || (exports.BiometryType = {}));
|
|
22
|
+
exports.AuthenticationStrength = void 0;
|
|
23
|
+
(function (AuthenticationStrength) {
|
|
24
|
+
/**
|
|
25
|
+
* No authentication available, even if PIN is available but useFallback = false
|
|
26
|
+
*/
|
|
27
|
+
AuthenticationStrength[AuthenticationStrength["NONE"] = 0] = "NONE";
|
|
28
|
+
/**
|
|
29
|
+
* Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).
|
|
30
|
+
* Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.
|
|
31
|
+
*/
|
|
32
|
+
AuthenticationStrength[AuthenticationStrength["STRONG"] = 1] = "STRONG";
|
|
33
|
+
/**
|
|
34
|
+
* Weak authentication: Face authentication on Android devices that consider face weak,
|
|
35
|
+
* or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).
|
|
36
|
+
*/
|
|
37
|
+
AuthenticationStrength[AuthenticationStrength["WEAK"] = 2] = "WEAK";
|
|
38
|
+
})(exports.AuthenticationStrength || (exports.AuthenticationStrength = {}));
|
|
22
39
|
/**
|
|
40
|
+
* Biometric authentication error codes.
|
|
41
|
+
* These error codes are used in both isAvailable() and verifyIdentity() methods.
|
|
42
|
+
*
|
|
23
43
|
* Keep this in sync with BiometricAuthError in README.md
|
|
24
44
|
* Update whenever `convertToPluginErrorCode` functions are modified
|
|
25
45
|
*/
|
|
26
46
|
exports.BiometricAuthError = void 0;
|
|
27
47
|
(function (BiometricAuthError) {
|
|
48
|
+
/**
|
|
49
|
+
* Unknown error occurred
|
|
50
|
+
*/
|
|
28
51
|
BiometricAuthError[BiometricAuthError["UNKNOWN_ERROR"] = 0] = "UNKNOWN_ERROR";
|
|
52
|
+
/**
|
|
53
|
+
* Biometrics are unavailable (no hardware or hardware error)
|
|
54
|
+
* Platform: Android, iOS
|
|
55
|
+
*/
|
|
29
56
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_UNAVAILABLE"] = 1] = "BIOMETRICS_UNAVAILABLE";
|
|
57
|
+
/**
|
|
58
|
+
* User has been locked out due to too many failed attempts
|
|
59
|
+
* Platform: Android, iOS
|
|
60
|
+
*/
|
|
30
61
|
BiometricAuthError[BiometricAuthError["USER_LOCKOUT"] = 2] = "USER_LOCKOUT";
|
|
62
|
+
/**
|
|
63
|
+
* No biometrics are enrolled on the device
|
|
64
|
+
* Platform: Android, iOS
|
|
65
|
+
*/
|
|
31
66
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_NOT_ENROLLED"] = 3] = "BIOMETRICS_NOT_ENROLLED";
|
|
67
|
+
/**
|
|
68
|
+
* User is temporarily locked out (Android: 30 second lockout)
|
|
69
|
+
* Platform: Android
|
|
70
|
+
*/
|
|
32
71
|
BiometricAuthError[BiometricAuthError["USER_TEMPORARY_LOCKOUT"] = 4] = "USER_TEMPORARY_LOCKOUT";
|
|
72
|
+
/**
|
|
73
|
+
* Authentication failed (user did not authenticate successfully)
|
|
74
|
+
* Platform: Android, iOS
|
|
75
|
+
*/
|
|
33
76
|
BiometricAuthError[BiometricAuthError["AUTHENTICATION_FAILED"] = 10] = "AUTHENTICATION_FAILED";
|
|
77
|
+
/**
|
|
78
|
+
* App canceled the authentication (iOS only)
|
|
79
|
+
* Platform: iOS
|
|
80
|
+
*/
|
|
34
81
|
BiometricAuthError[BiometricAuthError["APP_CANCEL"] = 11] = "APP_CANCEL";
|
|
82
|
+
/**
|
|
83
|
+
* Invalid context (iOS only)
|
|
84
|
+
* Platform: iOS
|
|
85
|
+
*/
|
|
35
86
|
BiometricAuthError[BiometricAuthError["INVALID_CONTEXT"] = 12] = "INVALID_CONTEXT";
|
|
87
|
+
/**
|
|
88
|
+
* Authentication was not interactive (iOS only)
|
|
89
|
+
* Platform: iOS
|
|
90
|
+
*/
|
|
36
91
|
BiometricAuthError[BiometricAuthError["NOT_INTERACTIVE"] = 13] = "NOT_INTERACTIVE";
|
|
92
|
+
/**
|
|
93
|
+
* Passcode/PIN is not set on the device
|
|
94
|
+
* Platform: Android, iOS
|
|
95
|
+
*/
|
|
37
96
|
BiometricAuthError[BiometricAuthError["PASSCODE_NOT_SET"] = 14] = "PASSCODE_NOT_SET";
|
|
97
|
+
/**
|
|
98
|
+
* System canceled the authentication (e.g., due to screen lock)
|
|
99
|
+
* Platform: Android, iOS
|
|
100
|
+
*/
|
|
38
101
|
BiometricAuthError[BiometricAuthError["SYSTEM_CANCEL"] = 15] = "SYSTEM_CANCEL";
|
|
102
|
+
/**
|
|
103
|
+
* User canceled the authentication
|
|
104
|
+
* Platform: Android, iOS
|
|
105
|
+
*/
|
|
39
106
|
BiometricAuthError[BiometricAuthError["USER_CANCEL"] = 16] = "USER_CANCEL";
|
|
107
|
+
/**
|
|
108
|
+
* User chose to use fallback authentication method
|
|
109
|
+
* Platform: Android, iOS
|
|
110
|
+
*/
|
|
40
111
|
BiometricAuthError[BiometricAuthError["USER_FALLBACK"] = 17] = "USER_FALLBACK";
|
|
41
112
|
})(exports.BiometricAuthError || (exports.BiometricAuthError = {}));
|
|
42
113
|
|
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 = {}));\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 BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\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","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;
|
|
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;AACvE;AACA;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AAC3E;AACA;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AACvE,CAAC,EAAEA,8BAAsB,KAAKA,8BAAsB,GAAG,EAAE,CAAC,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACWC;AACX,CAAC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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;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -18,24 +18,95 @@ var capacitorCapacitorBiometric = (function (exports, core) {
|
|
|
18
18
|
// Android
|
|
19
19
|
BiometryType[BiometryType["MULTIPLE"] = 6] = "MULTIPLE";
|
|
20
20
|
})(exports.BiometryType || (exports.BiometryType = {}));
|
|
21
|
+
exports.AuthenticationStrength = void 0;
|
|
22
|
+
(function (AuthenticationStrength) {
|
|
23
|
+
/**
|
|
24
|
+
* No authentication available, even if PIN is available but useFallback = false
|
|
25
|
+
*/
|
|
26
|
+
AuthenticationStrength[AuthenticationStrength["NONE"] = 0] = "NONE";
|
|
27
|
+
/**
|
|
28
|
+
* Strong authentication: Face ID on iOS, fingerprints on devices that consider fingerprints strong (Android).
|
|
29
|
+
* Note: PIN/pattern/password is NEVER considered STRONG, even when useFallback = true.
|
|
30
|
+
*/
|
|
31
|
+
AuthenticationStrength[AuthenticationStrength["STRONG"] = 1] = "STRONG";
|
|
32
|
+
/**
|
|
33
|
+
* Weak authentication: Face authentication on Android devices that consider face weak,
|
|
34
|
+
* or PIN/pattern/password if useFallback = true (PIN is always WEAK, never STRONG).
|
|
35
|
+
*/
|
|
36
|
+
AuthenticationStrength[AuthenticationStrength["WEAK"] = 2] = "WEAK";
|
|
37
|
+
})(exports.AuthenticationStrength || (exports.AuthenticationStrength = {}));
|
|
21
38
|
/**
|
|
39
|
+
* Biometric authentication error codes.
|
|
40
|
+
* These error codes are used in both isAvailable() and verifyIdentity() methods.
|
|
41
|
+
*
|
|
22
42
|
* Keep this in sync with BiometricAuthError in README.md
|
|
23
43
|
* Update whenever `convertToPluginErrorCode` functions are modified
|
|
24
44
|
*/
|
|
25
45
|
exports.BiometricAuthError = void 0;
|
|
26
46
|
(function (BiometricAuthError) {
|
|
47
|
+
/**
|
|
48
|
+
* Unknown error occurred
|
|
49
|
+
*/
|
|
27
50
|
BiometricAuthError[BiometricAuthError["UNKNOWN_ERROR"] = 0] = "UNKNOWN_ERROR";
|
|
51
|
+
/**
|
|
52
|
+
* Biometrics are unavailable (no hardware or hardware error)
|
|
53
|
+
* Platform: Android, iOS
|
|
54
|
+
*/
|
|
28
55
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_UNAVAILABLE"] = 1] = "BIOMETRICS_UNAVAILABLE";
|
|
56
|
+
/**
|
|
57
|
+
* User has been locked out due to too many failed attempts
|
|
58
|
+
* Platform: Android, iOS
|
|
59
|
+
*/
|
|
29
60
|
BiometricAuthError[BiometricAuthError["USER_LOCKOUT"] = 2] = "USER_LOCKOUT";
|
|
61
|
+
/**
|
|
62
|
+
* No biometrics are enrolled on the device
|
|
63
|
+
* Platform: Android, iOS
|
|
64
|
+
*/
|
|
30
65
|
BiometricAuthError[BiometricAuthError["BIOMETRICS_NOT_ENROLLED"] = 3] = "BIOMETRICS_NOT_ENROLLED";
|
|
66
|
+
/**
|
|
67
|
+
* User is temporarily locked out (Android: 30 second lockout)
|
|
68
|
+
* Platform: Android
|
|
69
|
+
*/
|
|
31
70
|
BiometricAuthError[BiometricAuthError["USER_TEMPORARY_LOCKOUT"] = 4] = "USER_TEMPORARY_LOCKOUT";
|
|
71
|
+
/**
|
|
72
|
+
* Authentication failed (user did not authenticate successfully)
|
|
73
|
+
* Platform: Android, iOS
|
|
74
|
+
*/
|
|
32
75
|
BiometricAuthError[BiometricAuthError["AUTHENTICATION_FAILED"] = 10] = "AUTHENTICATION_FAILED";
|
|
76
|
+
/**
|
|
77
|
+
* App canceled the authentication (iOS only)
|
|
78
|
+
* Platform: iOS
|
|
79
|
+
*/
|
|
33
80
|
BiometricAuthError[BiometricAuthError["APP_CANCEL"] = 11] = "APP_CANCEL";
|
|
81
|
+
/**
|
|
82
|
+
* Invalid context (iOS only)
|
|
83
|
+
* Platform: iOS
|
|
84
|
+
*/
|
|
34
85
|
BiometricAuthError[BiometricAuthError["INVALID_CONTEXT"] = 12] = "INVALID_CONTEXT";
|
|
86
|
+
/**
|
|
87
|
+
* Authentication was not interactive (iOS only)
|
|
88
|
+
* Platform: iOS
|
|
89
|
+
*/
|
|
35
90
|
BiometricAuthError[BiometricAuthError["NOT_INTERACTIVE"] = 13] = "NOT_INTERACTIVE";
|
|
91
|
+
/**
|
|
92
|
+
* Passcode/PIN is not set on the device
|
|
93
|
+
* Platform: Android, iOS
|
|
94
|
+
*/
|
|
36
95
|
BiometricAuthError[BiometricAuthError["PASSCODE_NOT_SET"] = 14] = "PASSCODE_NOT_SET";
|
|
96
|
+
/**
|
|
97
|
+
* System canceled the authentication (e.g., due to screen lock)
|
|
98
|
+
* Platform: Android, iOS
|
|
99
|
+
*/
|
|
37
100
|
BiometricAuthError[BiometricAuthError["SYSTEM_CANCEL"] = 15] = "SYSTEM_CANCEL";
|
|
101
|
+
/**
|
|
102
|
+
* User canceled the authentication
|
|
103
|
+
* Platform: Android, iOS
|
|
104
|
+
*/
|
|
38
105
|
BiometricAuthError[BiometricAuthError["USER_CANCEL"] = 16] = "USER_CANCEL";
|
|
106
|
+
/**
|
|
107
|
+
* User chose to use fallback authentication method
|
|
108
|
+
* Platform: Android, iOS
|
|
109
|
+
*/
|
|
39
110
|
BiometricAuthError[BiometricAuthError["USER_FALLBACK"] = 17] = "USER_FALLBACK";
|
|
40
111
|
})(exports.BiometricAuthError || (exports.BiometricAuthError = {}));
|
|
41
112
|
|
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 = {}));\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 BiometricAuthError[BiometricAuthError[\"UNKNOWN_ERROR\"] = 0] = \"UNKNOWN_ERROR\";\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_UNAVAILABLE\"] = 1] = \"BIOMETRICS_UNAVAILABLE\";\n BiometricAuthError[BiometricAuthError[\"USER_LOCKOUT\"] = 2] = \"USER_LOCKOUT\";\n BiometricAuthError[BiometricAuthError[\"BIOMETRICS_NOT_ENROLLED\"] = 3] = \"BIOMETRICS_NOT_ENROLLED\";\n BiometricAuthError[BiometricAuthError[\"USER_TEMPORARY_LOCKOUT\"] = 4] = \"USER_TEMPORARY_LOCKOUT\";\n BiometricAuthError[BiometricAuthError[\"AUTHENTICATION_FAILED\"] = 10] = \"AUTHENTICATION_FAILED\";\n BiometricAuthError[BiometricAuthError[\"APP_CANCEL\"] = 11] = \"APP_CANCEL\";\n BiometricAuthError[BiometricAuthError[\"INVALID_CONTEXT\"] = 12] = \"INVALID_CONTEXT\";\n BiometricAuthError[BiometricAuthError[\"NOT_INTERACTIVE\"] = 13] = \"NOT_INTERACTIVE\";\n BiometricAuthError[BiometricAuthError[\"PASSCODE_NOT_SET\"] = 14] = \"PASSCODE_NOT_SET\";\n BiometricAuthError[BiometricAuthError[\"SYSTEM_CANCEL\"] = 15] = \"SYSTEM_CANCEL\";\n BiometricAuthError[BiometricAuthError[\"USER_CANCEL\"] = 16] = \"USER_CANCEL\";\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","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;
|
|
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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,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;;;;;;;;;;;;;;;"}
|
|
@@ -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.5.1"
|
|
13
13
|
public let identifier = "NativeBiometricPlugin"
|
|
14
14
|
public let jsName = "NativeBiometric"
|
|
15
15
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -41,24 +41,35 @@ public class NativeBiometricPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
41
41
|
var obj = JSObject()
|
|
42
42
|
|
|
43
43
|
obj["isAvailable"] = false
|
|
44
|
-
obj["
|
|
44
|
+
obj["authenticationStrength"] = 0 // NONE
|
|
45
45
|
|
|
46
46
|
let useFallback = call.getBool("useFallback", false)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
|
|
48
|
+
// Check biometric-only policy first
|
|
49
|
+
let biometricPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics
|
|
50
|
+
let hasBiometric = context.canEvaluatePolicy(biometricPolicy, error: &error)
|
|
51
|
+
|
|
52
|
+
// Check device credentials policy if fallback is enabled
|
|
53
|
+
var hasDeviceCredentials = false
|
|
54
|
+
if useFallback {
|
|
55
|
+
let devicePolicy = LAPolicy.deviceOwnerAuthentication
|
|
56
|
+
var deviceError: NSError?
|
|
57
|
+
hasDeviceCredentials = context.canEvaluatePolicy(devicePolicy, error: &deviceError)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if hasBiometric {
|
|
61
|
+
// Biometric available - Face ID and Touch ID are both considered STRONG on iOS
|
|
62
|
+
obj["authenticationStrength"] = 1 // STRONG
|
|
63
|
+
obj["isAvailable"] = true
|
|
64
|
+
call.resolve(obj)
|
|
65
|
+
} else if hasDeviceCredentials {
|
|
66
|
+
// Only device credentials (PIN/password) available when useFallback is true
|
|
67
|
+
// PIN/password is ALWAYS considered WEAK, never STRONG
|
|
68
|
+
obj["authenticationStrength"] = 2 // WEAK
|
|
59
69
|
obj["isAvailable"] = true
|
|
60
70
|
call.resolve(obj)
|
|
61
71
|
} else {
|
|
72
|
+
// No authentication available
|
|
62
73
|
guard let authError = error else {
|
|
63
74
|
obj["errorCode"] = 0
|
|
64
75
|
call.resolve(obj)
|
package/package.json
CHANGED