@aparajita/capacitor-biometric-auth 4.0.0 β 5.0.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 +3 -3
- package/android/build.gradle +13 -11
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/aparajita/capacitor/biometricauth/AuthActivity.java +0 -4
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/index.js +1 -3
- package/dist/esm/native.js +1 -1
- package/dist/esm/web-utils.js +1 -1
- package/dist/esm/web.js +1 -1
- package/dist/plugin.cjs.js +4 -10
- package/dist/plugin.js +4 -10
- package/ios/Plugin/Plugin.m +0 -2
- package/package.json +22 -24
- package/dist/esm/info.json +0 -4
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# capacitor-biometric-auth [](https://badge.fury.io/js/@aparajita%2Fcapacitor-biometric-auth)
|
|
4
4
|
|
|
5
|
-
This plugin for [Capacitor
|
|
5
|
+
This plugin for [Capacitor 5](https://capacitorjs.com) provides access to native biometry on iOS and Android. It supports every type of biometry and every configuration option on both platforms. In addition, biometry is simulated on the web so you can test your logic without making any changes to your code.
|
|
6
6
|
|
|
7
|
-
π **NOTE:** This plugin only works with Capacitor
|
|
7
|
+
π **NOTE:** This plugin only works with Capacitor 5. If you are upgrading from the Capacitor 2 version, note that the plugin name has changed to `BiometricAuth`.
|
|
8
8
|
|
|
9
9
|
π **BREAKING CHANGE:** If you are upgrading from a version prior to 3.0.0, please note that `androidMaxAttempts` is no longer supported. See the documentation for [`authenticate()`](#authenticate) for more information.
|
|
10
10
|
|
|
@@ -32,7 +32,7 @@ The API is extensively documented in the [TypeScript definitions file](src/defin
|
|
|
32
32
|
|
|
33
33
|
### Checking availability
|
|
34
34
|
|
|
35
|
-
Before giving the user the option to use biometry (such as displaying a biometry icon), call [`checkBiometry`](#checkbiometry) and inspect the [`CheckBiometryResult`](#checkbiometryresult) to see what (if any) biometry is available on the device. Note that `isAvailable` may be `false` but `biometryType` may indicate the presence of biometry on the device. This occurs if the current user is not enrolled in biometry, or if biometry has been disabled for the current app. In such cases the `reason` will tell you why.
|
|
35
|
+
Before giving the user the option to use biometry (such as displaying a biometry icon), call [`checkBiometry`](#checkbiometry) and inspect the [`CheckBiometryResult`](#checkbiometryresult) to see what (if any) biometry is available on the device. Note that `isAvailable` may be `false` but `biometryType` may indicate the presence of biometry on the device. This occurs if the current user is not enrolled in biometry, or if biometry has been disabled for the current app. In such cases the `reason` and `code` will tell you why.
|
|
36
36
|
|
|
37
37
|
Because the availability of biometry can change while your app is in the background, itβs important to check availability when your app resumes. By calling [`addResumeListener`](#addresumelistener) you can register a callback that is passed a [`CheckBiometryResult`](#checkbiometryresult) when your app resumes.
|
|
38
38
|
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
buildscript {
|
|
@@ -10,17 +11,18 @@ buildscript {
|
|
|
10
11
|
mavenCentral()
|
|
11
12
|
}
|
|
12
13
|
dependencies {
|
|
13
|
-
classpath 'com.android.tools.build:gradle:
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.0.2'
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
apply plugin: 'com.android.library'
|
|
18
19
|
|
|
19
20
|
android {
|
|
20
|
-
|
|
21
|
+
namespace "com.aparajita.capacitor.biometricauth"
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
21
23
|
defaultConfig {
|
|
22
24
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
23
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
24
26
|
versionCode 1
|
|
25
27
|
versionName "1.0"
|
|
26
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -35,8 +37,8 @@ android {
|
|
|
35
37
|
abortOnError false
|
|
36
38
|
}
|
|
37
39
|
compileOptions {
|
|
38
|
-
sourceCompatibility JavaVersion.
|
|
39
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -50,11 +52,11 @@ dependencies {
|
|
|
50
52
|
implementation 'androidx.biometric:biometric:1.1.0'
|
|
51
53
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
52
54
|
implementation project(':capacitor-android')
|
|
53
|
-
implementation 'androidx.appcompat:appcompat:1.
|
|
54
|
-
implementation 'com.google.android.material:material:1.
|
|
55
|
+
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
56
|
+
implementation 'com.google.android.material:material:1.9.0'
|
|
55
57
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
56
|
-
implementation 'androidx.navigation:navigation-fragment:2.
|
|
57
|
-
implementation 'androidx.navigation:navigation-ui:2.
|
|
58
|
+
implementation 'androidx.navigation:navigation-fragment:2.6.0'
|
|
59
|
+
implementation 'androidx.navigation:navigation-ui:2.6.0'
|
|
58
60
|
testImplementation "junit:junit:$junitVersion"
|
|
59
61
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
60
62
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -35,10 +35,6 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
35
35
|
String title = intent.getStringExtra(BiometricAuthNative.TITLE);
|
|
36
36
|
String subtitle = intent.getStringExtra(BiometricAuthNative.SUBTITLE);
|
|
37
37
|
String description = intent.getStringExtra(BiometricAuthNative.REASON);
|
|
38
|
-
final int maxAttempts = intent.getIntExtra(
|
|
39
|
-
BiometricAuthNative.MAX_ATTEMPTS,
|
|
40
|
-
BiometricAuthNative.DEFAULT_MAX_ATTEMPTS
|
|
41
|
-
);
|
|
42
38
|
allowDeviceCredential = false;
|
|
43
39
|
|
|
44
40
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
@@ -163,7 +163,7 @@ export interface CheckBiometryResult {
|
|
|
163
163
|
/**
|
|
164
164
|
* The signature of the callback passed to `addResumeListener()`.
|
|
165
165
|
*/
|
|
166
|
-
export
|
|
166
|
+
export type ResumeListener = (info: CheckBiometryResult) => void;
|
|
167
167
|
export interface BiometricAuthPlugin extends WebPlugin {
|
|
168
168
|
/**
|
|
169
169
|
* Check to see what biometry type (if any) is available.
|
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
import info from './info.json';
|
|
3
|
-
console.log(`loaded ${info.name} v${info.version}`);
|
|
4
2
|
const proxy = registerPlugin('BiometricAuthNative', {
|
|
5
3
|
web: async () => import('./web').then((module) => new module.BiometricAuthWeb()),
|
|
6
4
|
ios: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy)),
|
|
7
|
-
android: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy))
|
|
5
|
+
android: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy)),
|
|
8
6
|
});
|
|
9
7
|
export * from './definitions';
|
|
10
8
|
export * from './web-utils';
|
package/dist/esm/native.js
CHANGED
|
@@ -13,7 +13,7 @@ export class BiometricAuthNative extends BiometricAuthBase {
|
|
|
13
13
|
isAvailable: true,
|
|
14
14
|
biometryType: BiometryType.none,
|
|
15
15
|
reason: '',
|
|
16
|
-
code: BiometryErrorType.none
|
|
16
|
+
code: BiometryErrorType.none,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
package/dist/esm/web-utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const kBiometryTypeNameMap = {
|
|
|
5
5
|
[BiometryType.faceId]: 'Face ID',
|
|
6
6
|
[BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
|
|
7
7
|
[BiometryType.faceAuthentication]: 'Face Authentication',
|
|
8
|
-
[BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
8
|
+
[BiometryType.irisAuthentication]: 'Iris Authentication',
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Return a human-readable name for a BiometryType.
|
package/dist/esm/web.js
CHANGED
|
@@ -12,7 +12,7 @@ export class BiometricAuthWeb extends BiometricAuthBase {
|
|
|
12
12
|
isAvailable: this.biometryType !== BiometryType.none,
|
|
13
13
|
biometryType: this.biometryType,
|
|
14
14
|
reason: '',
|
|
15
|
-
code: BiometryErrorType.none
|
|
15
|
+
code: BiometryErrorType.none,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
async authenticate(options) {
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
var app = require('@capacitor/app');
|
|
5
5
|
|
|
6
|
-
var info = {
|
|
7
|
-
name: "@aparajita/capacitor-biometric-auth",
|
|
8
|
-
version: "4.0.0"
|
|
9
|
-
};
|
|
10
|
-
|
|
11
6
|
exports.BiometryType = void 0;
|
|
12
7
|
(function (BiometryType) {
|
|
13
8
|
/**
|
|
@@ -72,7 +67,7 @@ const kBiometryTypeNameMap = {
|
|
|
72
67
|
[exports.BiometryType.faceId]: 'Face ID',
|
|
73
68
|
[exports.BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
|
|
74
69
|
[exports.BiometryType.faceAuthentication]: 'Face Authentication',
|
|
75
|
-
[exports.BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
70
|
+
[exports.BiometryType.irisAuthentication]: 'Iris Authentication',
|
|
76
71
|
};
|
|
77
72
|
/**
|
|
78
73
|
* Return a human-readable name for a BiometryType.
|
|
@@ -82,11 +77,10 @@ function getBiometryName(type) {
|
|
|
82
77
|
return kBiometryTypeNameMap[type] || '';
|
|
83
78
|
}
|
|
84
79
|
|
|
85
|
-
console.log(`loaded ${info.name} v${info.version}`);
|
|
86
80
|
const proxy = core.registerPlugin('BiometricAuthNative', {
|
|
87
81
|
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
|
|
88
82
|
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
89
|
-
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
|
|
83
|
+
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
90
84
|
});
|
|
91
85
|
|
|
92
86
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -115,7 +109,7 @@ class BiometricAuthWeb extends BiometricAuthBase {
|
|
|
115
109
|
isAvailable: this.biometryType !== exports.BiometryType.none,
|
|
116
110
|
biometryType: this.biometryType,
|
|
117
111
|
reason: '',
|
|
118
|
-
code: exports.BiometryErrorType.none
|
|
112
|
+
code: exports.BiometryErrorType.none,
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
async authenticate(options) {
|
|
@@ -168,7 +162,7 @@ class BiometricAuthNative extends BiometricAuthBase {
|
|
|
168
162
|
isAvailable: true,
|
|
169
163
|
biometryType: exports.BiometryType.none,
|
|
170
164
|
reason: '',
|
|
171
|
-
code: exports.BiometryErrorType.none
|
|
165
|
+
code: exports.BiometryErrorType.none,
|
|
172
166
|
});
|
|
173
167
|
}
|
|
174
168
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
package/dist/plugin.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
var capacitorBiometricAuth = (function (exports, core, app) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var info = {
|
|
5
|
-
name: "@aparajita/capacitor-biometric-auth",
|
|
6
|
-
version: "4.0.0"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
4
|
exports.BiometryType = void 0;
|
|
10
5
|
(function (BiometryType) {
|
|
11
6
|
/**
|
|
@@ -70,7 +65,7 @@ var capacitorBiometricAuth = (function (exports, core, app) {
|
|
|
70
65
|
[exports.BiometryType.faceId]: 'Face ID',
|
|
71
66
|
[exports.BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
|
|
72
67
|
[exports.BiometryType.faceAuthentication]: 'Face Authentication',
|
|
73
|
-
[exports.BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
68
|
+
[exports.BiometryType.irisAuthentication]: 'Iris Authentication',
|
|
74
69
|
};
|
|
75
70
|
/**
|
|
76
71
|
* Return a human-readable name for a BiometryType.
|
|
@@ -80,11 +75,10 @@ var capacitorBiometricAuth = (function (exports, core, app) {
|
|
|
80
75
|
return kBiometryTypeNameMap[type] || '';
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
console.log(`loaded ${info.name} v${info.version}`);
|
|
84
78
|
const proxy = core.registerPlugin('BiometricAuthNative', {
|
|
85
79
|
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
|
|
86
80
|
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
87
|
-
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
|
|
81
|
+
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
88
82
|
});
|
|
89
83
|
|
|
90
84
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -113,7 +107,7 @@ var capacitorBiometricAuth = (function (exports, core, app) {
|
|
|
113
107
|
isAvailable: this.biometryType !== exports.BiometryType.none,
|
|
114
108
|
biometryType: this.biometryType,
|
|
115
109
|
reason: '',
|
|
116
|
-
code: exports.BiometryErrorType.none
|
|
110
|
+
code: exports.BiometryErrorType.none,
|
|
117
111
|
});
|
|
118
112
|
}
|
|
119
113
|
async authenticate(options) {
|
|
@@ -166,7 +160,7 @@ var capacitorBiometricAuth = (function (exports, core, app) {
|
|
|
166
160
|
isAvailable: true,
|
|
167
161
|
biometryType: exports.BiometryType.none,
|
|
168
162
|
reason: '',
|
|
169
|
-
code: exports.BiometryErrorType.none
|
|
163
|
+
code: exports.BiometryErrorType.none,
|
|
170
164
|
});
|
|
171
165
|
}
|
|
172
166
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
package/ios/Plugin/Plugin.m
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <Capacitor/Capacitor.h>
|
|
3
3
|
|
|
4
|
-
// Generated by @aparajita/capacitor-native-decorator/make-ios-plugin
|
|
5
|
-
|
|
6
4
|
CAP_PLUGIN(BiometricAuthNative, "BiometricAuthNative",
|
|
7
5
|
CAP_PLUGIN_METHOD(checkBiometry, CAPPluginReturnPromise);
|
|
8
6
|
CAP_PLUGIN_METHOD(authenticate, CAPPluginReturnPromise);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparajita/capacitor-biometric-auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Provides access to the native biometric auth APIs for Capacitor apps",
|
|
5
5
|
"author": "Aparajita Fishman",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,46 +56,44 @@
|
|
|
56
56
|
"@aparajita/eslint-config-base": "^1.1.5",
|
|
57
57
|
"@aparajita/prettier-config": "^1.0.0",
|
|
58
58
|
"@aparajita/swiftly": "^1.0.4",
|
|
59
|
-
"@capacitor/cli": "^
|
|
60
|
-
"@commitlint/cli": "^17.5
|
|
61
|
-
"@commitlint/config-conventional": "^17.
|
|
59
|
+
"@capacitor/cli": "^5.0.5",
|
|
60
|
+
"@commitlint/cli": "^17.6.5",
|
|
61
|
+
"@commitlint/config-conventional": "^17.6.5",
|
|
62
62
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
63
63
|
"@rollup/plugin-json": "^6.0.0",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
66
|
-
"@typescript-eslint/parser": "^5.
|
|
67
|
-
"commit-and-tag-version": "^11.2.
|
|
68
|
-
"eslint": "^8.
|
|
64
|
+
"@types/node": "^20.3.1",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
|
66
|
+
"@typescript-eslint/parser": "^5.59.11",
|
|
67
|
+
"commit-and-tag-version": "^11.2.1",
|
|
68
|
+
"eslint": "^8.42.0",
|
|
69
69
|
"eslint-config-prettier": "^8.8.0",
|
|
70
|
-
"eslint-config-standard": "^17.
|
|
71
|
-
"eslint-import-resolver-typescript": "^3.5.
|
|
70
|
+
"eslint-config-standard": "^17.1.0",
|
|
71
|
+
"eslint-import-resolver-typescript": "^3.5.5",
|
|
72
72
|
"eslint-plugin-import": "^2.27.5",
|
|
73
|
-
"eslint-plugin-n": "^
|
|
73
|
+
"eslint-plugin-n": "^16.0.0",
|
|
74
74
|
"eslint-plugin-prettier": "^4.2.1",
|
|
75
75
|
"eslint-plugin-promise": "^6.1.1",
|
|
76
|
-
"husky": "^8.0.3",
|
|
77
76
|
"nodemon": "^2.0.22",
|
|
78
|
-
"prettier": "^2.8.
|
|
77
|
+
"prettier": "^2.8.8",
|
|
79
78
|
"prettier-plugin-java": "^2.1.0",
|
|
80
|
-
"rimraf": "^
|
|
81
|
-
"rollup": "^3.
|
|
82
|
-
"swiftlint": "^1.0.
|
|
83
|
-
"typescript": "~
|
|
79
|
+
"rimraf": "^5.0.1",
|
|
80
|
+
"rollup": "^3.25.1",
|
|
81
|
+
"swiftlint": "^1.0.2",
|
|
82
|
+
"typescript": "~5.1.3"
|
|
84
83
|
},
|
|
85
84
|
"dependencies": {
|
|
86
|
-
"@capacitor/android": "^
|
|
87
|
-
"@capacitor/app": "^
|
|
88
|
-
"@capacitor/core": "^
|
|
89
|
-
"@capacitor/ios": "^
|
|
85
|
+
"@capacitor/android": "^5.0.5",
|
|
86
|
+
"@capacitor/app": "^5.0.3",
|
|
87
|
+
"@capacitor/core": "^5.0.5",
|
|
88
|
+
"@capacitor/ios": "^5.0.5"
|
|
90
89
|
},
|
|
91
90
|
"scripts": {
|
|
92
91
|
"clean": "rimraf dist",
|
|
93
|
-
"extract-info": "node scripts/extractPackageInfo.js",
|
|
94
92
|
"lint.eslint": "eslint --fix --cache --ext .js,.cjs,.mjs,.ts --max-warnings 0",
|
|
95
93
|
"lint.prettier": "prettier --write --cache --list-different",
|
|
96
94
|
"lint.tsc": "tsc --noEmit",
|
|
97
95
|
"lint": "pnpm lint.eslint . && pnpm lint.prettier . && pnpm lint.tsc",
|
|
98
|
-
"prebuilder": "pnpm clean
|
|
96
|
+
"prebuilder": "pnpm clean",
|
|
99
97
|
"builder": "tsc ${SOURCE_MAP:-} && rollup -c rollup.config.mjs",
|
|
100
98
|
"prebuild": "pnpm lint",
|
|
101
99
|
"build": "pnpm builder",
|
package/dist/esm/info.json
DELETED