@aparajita/capacitor-biometric-auth 3.0.2 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/src/main/java/com/aparajita/capacitor/biometricauth/AuthActivity.java +11 -11
- package/android/src/main/java/com/aparajita/capacitor/biometricauth/{BiometricAuth.java → BiometricAuthNative.java} +5 -5
- package/dist/esm/base.d.ts +9 -0
- package/dist/esm/base.js +16 -0
- package/dist/esm/definitions.d.ts +3 -5
- package/dist/esm/definitions.js +0 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +6 -12
- package/dist/esm/info.json +1 -1
- package/dist/esm/native.d.ts +9 -0
- package/dist/esm/native.js +26 -0
- package/dist/esm/web-utils.d.ts +5 -0
- package/dist/esm/web-utils.js +16 -0
- package/dist/esm/web.d.ts +4 -14
- package/dist/esm/web.js +20 -59
- package/dist/plugin.cjs.js +85 -64
- package/dist/plugin.js +87 -64
- package/ios/Plugin/Plugin.m +1 -1
- package/ios/Plugin/Plugin.swift +8 -2
- package/package.json +17 -24
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Check to see what biometry type (if any) is available.
|
|
|
90
90
|
### setBiometryType(...)
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
setBiometryType(type: BiometryType | string | undefined) => void
|
|
93
|
+
setBiometryType(type: BiometryType | string | undefined) => Promise<void>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
web only<br><br>On the web, this method allows you to dynamically simulate different types of biometry. You may either pass a <a href="#biometrytype">`BiometryType`</a> enum or the string name of a <a href="#biometrytype">`BiometryType`</a>. If a string is passed and it isn't a valid value, nothing happens.
|
|
@@ -32,12 +32,12 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
32
32
|
|
|
33
33
|
BiometricPrompt.PromptInfo.Builder builder = new BiometricPrompt.PromptInfo.Builder();
|
|
34
34
|
Intent intent = getIntent();
|
|
35
|
-
String title = intent.getStringExtra(
|
|
36
|
-
String subtitle = intent.getStringExtra(
|
|
37
|
-
String description = intent.getStringExtra(
|
|
35
|
+
String title = intent.getStringExtra(BiometricAuthNative.TITLE);
|
|
36
|
+
String subtitle = intent.getStringExtra(BiometricAuthNative.SUBTITLE);
|
|
37
|
+
String description = intent.getStringExtra(BiometricAuthNative.REASON);
|
|
38
38
|
final int maxAttempts = intent.getIntExtra(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
BiometricAuthNative.MAX_ATTEMPTS,
|
|
40
|
+
BiometricAuthNative.DEFAULT_MAX_ATTEMPTS
|
|
41
41
|
);
|
|
42
42
|
allowDeviceCredential = false;
|
|
43
43
|
|
|
@@ -49,7 +49,7 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
49
49
|
|
|
50
50
|
if (manager.isDeviceSecure()) {
|
|
51
51
|
allowDeviceCredential =
|
|
52
|
-
intent.getBooleanExtra(
|
|
52
|
+
intent.getBooleanExtra(BiometricAuthNative.DEVICE_CREDENTIAL, false);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -77,7 +77,7 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
77
77
|
// Android docs say that negative button text should not be set if device credential is allowed
|
|
78
78
|
if (!allowDeviceCredential) {
|
|
79
79
|
String negativeButtonText = intent.getStringExtra(
|
|
80
|
-
|
|
80
|
+
BiometricAuthNative.CANCEL_TITLE
|
|
81
81
|
);
|
|
82
82
|
builder.setNegativeButtonText(
|
|
83
83
|
negativeButtonText == null || negativeButtonText.isEmpty()
|
|
@@ -127,12 +127,12 @@ public class AuthActivity extends AppCompatActivity {
|
|
|
127
127
|
String errorMessage
|
|
128
128
|
) {
|
|
129
129
|
Intent intent = new Intent();
|
|
130
|
-
String prefix =
|
|
130
|
+
String prefix = BiometricAuthNative.RESULT_EXTRA_PREFIX;
|
|
131
131
|
|
|
132
132
|
intent
|
|
133
|
-
.putExtra(prefix +
|
|
134
|
-
.putExtra(prefix +
|
|
135
|
-
.putExtra(prefix +
|
|
133
|
+
.putExtra(prefix + BiometricAuthNative.RESULT_TYPE, resultType.toString())
|
|
134
|
+
.putExtra(prefix + BiometricAuthNative.RESULT_ERROR_CODE, errorCode)
|
|
135
|
+
.putExtra(prefix + BiometricAuthNative.RESULT_ERROR_MESSAGE, errorMessage);
|
|
136
136
|
|
|
137
137
|
setResult(RESULT_OK, intent);
|
|
138
138
|
finish();
|
|
@@ -17,8 +17,8 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
17
17
|
import java.util.HashMap;
|
|
18
18
|
|
|
19
19
|
@SuppressLint("RestrictedApi")
|
|
20
|
-
@CapacitorPlugin(name = "
|
|
21
|
-
public class
|
|
20
|
+
@CapacitorPlugin(name = "BiometricAuthNative")
|
|
21
|
+
public class BiometricAuthNative extends Plugin {
|
|
22
22
|
|
|
23
23
|
public static final String RESULT_TYPE = "type";
|
|
24
24
|
public static final String RESULT_ERROR_CODE = "errorCode";
|
|
@@ -206,7 +206,7 @@ public class BiometricAuth extends Plugin {
|
|
|
206
206
|
|
|
207
207
|
if (data != null) {
|
|
208
208
|
resultTypeName =
|
|
209
|
-
data.getStringExtra(RESULT_EXTRA_PREFIX +
|
|
209
|
+
data.getStringExtra(RESULT_EXTRA_PREFIX + BiometricAuthNative.RESULT_TYPE);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
if (resultTypeName == null) {
|
|
@@ -230,11 +230,11 @@ public class BiometricAuth extends Plugin {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
int errorCode = data.getIntExtra(
|
|
233
|
-
RESULT_EXTRA_PREFIX +
|
|
233
|
+
RESULT_EXTRA_PREFIX + BiometricAuthNative.RESULT_ERROR_CODE,
|
|
234
234
|
0
|
|
235
235
|
);
|
|
236
236
|
String errorMessage = data.getStringExtra(
|
|
237
|
-
RESULT_EXTRA_PREFIX +
|
|
237
|
+
RESULT_EXTRA_PREFIX + BiometricAuthNative.RESULT_ERROR_MESSAGE
|
|
238
238
|
);
|
|
239
239
|
|
|
240
240
|
switch (resultType) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
3
|
+
import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult, ResumeListener, BiometryType } from './definitions';
|
|
4
|
+
export declare abstract class BiometricAuthBase extends WebPlugin implements BiometricAuthPlugin {
|
|
5
|
+
abstract setBiometryType(type: BiometryType | string | undefined): Promise<void>;
|
|
6
|
+
abstract checkBiometry(): Promise<CheckBiometryResult>;
|
|
7
|
+
abstract authenticate(options?: AuthenticateOptions): Promise<void>;
|
|
8
|
+
addResumeListener(listener: ResumeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
9
|
+
}
|
package/dist/esm/base.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from '@capacitor/app';
|
|
2
|
+
import { WebPlugin } from '@capacitor/core';
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
4
|
+
export class BiometricAuthBase extends WebPlugin {
|
|
5
|
+
addResumeListener(listener) {
|
|
6
|
+
return App.addListener('appStateChange', ({ isActive }) => {
|
|
7
|
+
if (isActive) {
|
|
8
|
+
this.checkBiometry()
|
|
9
|
+
.then((info) => {
|
|
10
|
+
listener(info);
|
|
11
|
+
})
|
|
12
|
+
.catch(console.error);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PluginListenerHandle, PluginResultError } from '@capacitor/core';
|
|
1
|
+
import type { PluginListenerHandle, PluginResultError, WebPlugin } from '@capacitor/core';
|
|
3
2
|
export declare enum BiometryType {
|
|
4
3
|
/**
|
|
5
4
|
* No biometry is available
|
|
@@ -152,7 +151,7 @@ export interface CheckBiometryResult {
|
|
|
152
151
|
* The signature of the callback passed to `addResumeListener()`.
|
|
153
152
|
*/
|
|
154
153
|
export declare type ResumeListener = (info: CheckBiometryResult) => void;
|
|
155
|
-
export interface BiometricAuthPlugin extends
|
|
154
|
+
export interface BiometricAuthPlugin extends WebPlugin {
|
|
156
155
|
/**
|
|
157
156
|
* Check to see what biometry type (if any) is available.
|
|
158
157
|
*/
|
|
@@ -165,7 +164,7 @@ export interface BiometricAuthPlugin extends DecoratedNativePlugin {
|
|
|
165
164
|
* or the string name of a `BiometryType`. If a string is passed and
|
|
166
165
|
* it isn't a valid value, nothing happens.
|
|
167
166
|
*/
|
|
168
|
-
setBiometryType: (type: BiometryType | string | undefined) => void
|
|
167
|
+
setBiometryType: (type: BiometryType | string | undefined) => Promise<void>;
|
|
169
168
|
/**
|
|
170
169
|
* Prompt the user for authentication. If authorization fails for any reason,
|
|
171
170
|
* the promise is rejected with a `BiometryError`.
|
|
@@ -189,4 +188,3 @@ export interface BiometricAuthPlugin extends DecoratedNativePlugin {
|
|
|
189
188
|
*/
|
|
190
189
|
addResumeListener: (listener: ResumeListener) => Promise<PluginListenerHandle>;
|
|
191
190
|
}
|
|
192
|
-
export declare const kPluginName = "BiometricAuth";
|
package/dist/esm/definitions.js
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
1
|
+
import type { BiometricAuthPlugin } from './definitions';
|
|
2
|
+
declare const proxy: BiometricAuthPlugin;
|
|
3
3
|
export * from './definitions';
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
4
|
+
export * from './web-utils';
|
|
5
|
+
export { proxy as BiometricAuth };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
import { kPluginName } from './definitions';
|
|
3
2
|
import info from './info.json';
|
|
4
|
-
import { BiometricAuth } from './web';
|
|
5
3
|
console.log(`loaded ${info.name} v${info.version}`);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
registerPlugin(kPluginName, {
|
|
11
|
-
web: plugin,
|
|
12
|
-
ios: plugin,
|
|
13
|
-
android: plugin
|
|
4
|
+
const proxy = registerPlugin('BiometricAuthNative', {
|
|
5
|
+
web: async () => import('./web').then((module) => new module.BiometricAuthWeb()),
|
|
6
|
+
ios: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy)),
|
|
7
|
+
android: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy))
|
|
14
8
|
});
|
|
15
9
|
export * from './definitions';
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
10
|
+
export * from './web-utils';
|
|
11
|
+
export { proxy as BiometricAuth };
|
package/dist/esm/info.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BiometricAuthBase } from './base';
|
|
2
|
+
import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult } from './definitions';
|
|
3
|
+
import { BiometryType } from './definitions';
|
|
4
|
+
export declare class BiometricAuthNative extends BiometricAuthBase {
|
|
5
|
+
constructor(capProxy: BiometricAuthPlugin);
|
|
6
|
+
checkBiometry(): Promise<CheckBiometryResult>;
|
|
7
|
+
authenticate(options?: AuthenticateOptions): Promise<void>;
|
|
8
|
+
setBiometryType(type: BiometryType | string | undefined): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BiometricAuthBase } from './base';
|
|
2
|
+
import { BiometryType } from './definitions';
|
|
3
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
4
|
+
export class BiometricAuthNative extends BiometricAuthBase {
|
|
5
|
+
constructor(capProxy) {
|
|
6
|
+
super();
|
|
7
|
+
this.checkBiometry = capProxy.checkBiometry;
|
|
8
|
+
this.authenticate = capProxy.authenticate;
|
|
9
|
+
}
|
|
10
|
+
async checkBiometry() {
|
|
11
|
+
// Never used, satisfy the compiler
|
|
12
|
+
return Promise.resolve({
|
|
13
|
+
isAvailable: true,
|
|
14
|
+
biometryType: BiometryType.none,
|
|
15
|
+
reason: ''
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
19
|
+
async authenticate(options) { }
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
21
|
+
async setBiometryType(
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
+
type) {
|
|
24
|
+
throw this.unimplemented('setBiometryType is web only');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BiometryType } from './definitions';
|
|
2
|
+
const kBiometryTypeNameMap = {
|
|
3
|
+
[BiometryType.none]: '',
|
|
4
|
+
[BiometryType.touchId]: 'Touch ID',
|
|
5
|
+
[BiometryType.faceId]: 'Face ID',
|
|
6
|
+
[BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
|
|
7
|
+
[BiometryType.faceAuthentication]: 'Face Authentication',
|
|
8
|
+
[BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Return a human-readable name for a BiometryType.
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
14
|
+
export function getBiometryName(type) {
|
|
15
|
+
return kBiometryTypeNameMap[type] || '';
|
|
16
|
+
}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult, ResumeListener } from './definitions';
|
|
1
|
+
import { BiometricAuthBase } from './base';
|
|
2
|
+
import type { AuthenticateOptions, CheckBiometryResult } from './definitions';
|
|
4
3
|
import { BiometryType } from './definitions';
|
|
5
|
-
export declare class
|
|
4
|
+
export declare class BiometricAuthWeb extends BiometricAuthBase {
|
|
6
5
|
private biometryType;
|
|
7
|
-
getRegisteredPluginName(): string;
|
|
8
|
-
setBiometryType(type: BiometryType | string | undefined): void;
|
|
9
6
|
checkBiometry(): Promise<CheckBiometryResult>;
|
|
10
7
|
authenticate(options?: AuthenticateOptions): Promise<void>;
|
|
11
|
-
|
|
8
|
+
setBiometryType(type: BiometryType | string | undefined): Promise<void>;
|
|
12
9
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Return a human-readable name for a BiometryType.
|
|
15
|
-
*
|
|
16
|
-
* @param {BiometryType} type
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
export declare function getBiometryName(type: BiometryType): string;
|
package/dist/esm/web.js
CHANGED
|
@@ -1,39 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const kBiometryTypeNameMap = {
|
|
7
|
-
[BiometryType.none]: '',
|
|
8
|
-
[BiometryType.touchId]: 'Touch ID',
|
|
9
|
-
[BiometryType.faceId]: 'Face ID',
|
|
10
|
-
[BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
|
|
11
|
-
[BiometryType.faceAuthentication]: 'Face Authentication',
|
|
12
|
-
[BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
13
|
-
};
|
|
14
|
-
export class BiometricAuth extends WebPlugin {
|
|
1
|
+
import { BiometricAuthBase } from './base';
|
|
2
|
+
import { BiometryError, BiometryErrorType, BiometryType } from './definitions';
|
|
3
|
+
import { getBiometryName } from './web-utils';
|
|
4
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
5
|
+
export class BiometricAuthWeb extends BiometricAuthBase {
|
|
15
6
|
constructor() {
|
|
16
7
|
super(...arguments);
|
|
17
8
|
this.biometryType = BiometryType.none;
|
|
18
9
|
}
|
|
19
|
-
getRegisteredPluginName() {
|
|
20
|
-
return kPluginName;
|
|
21
|
-
}
|
|
22
|
-
setBiometryType(type) {
|
|
23
|
-
if (typeof type === 'undefined') {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (typeof type === 'string') {
|
|
27
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
28
|
-
if (BiometryType.hasOwnProperty(type)) {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
30
|
-
this.biometryType = BiometryType[type];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.biometryType = type;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
10
|
async checkBiometry() {
|
|
38
11
|
return Promise.resolve({
|
|
39
12
|
isAvailable: this.biometryType !== BiometryType.none,
|
|
@@ -47,7 +20,7 @@ export class BiometricAuth extends WebPlugin {
|
|
|
47
20
|
if (
|
|
48
21
|
// eslint-disable-next-line no-alert
|
|
49
22
|
confirm((options === null || options === void 0 ? void 0 : options.reason) ||
|
|
50
|
-
`Authenticate with ${
|
|
23
|
+
`Authenticate with ${getBiometryName(biometryType)}?`)) {
|
|
51
24
|
return;
|
|
52
25
|
}
|
|
53
26
|
throw new BiometryError('User cancelled', BiometryErrorType.userCancel);
|
|
@@ -55,32 +28,20 @@ export class BiometricAuth extends WebPlugin {
|
|
|
55
28
|
throw new BiometryError('Biometry not available', BiometryErrorType.biometryNotAvailable);
|
|
56
29
|
});
|
|
57
30
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
31
|
+
async setBiometryType(type) {
|
|
32
|
+
if (typeof type === 'undefined') {
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
if (typeof type === 'string') {
|
|
36
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
37
|
+
if (BiometryType.hasOwnProperty(type)) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
39
|
+
this.biometryType = BiometryType[type];
|
|
68
40
|
}
|
|
69
|
-
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.biometryType = type;
|
|
44
|
+
}
|
|
45
|
+
return Promise.resolve();
|
|
70
46
|
}
|
|
71
47
|
}
|
|
72
|
-
__decorate([
|
|
73
|
-
native()
|
|
74
|
-
], BiometricAuth.prototype, "checkBiometry", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
native()
|
|
77
|
-
], BiometricAuth.prototype, "authenticate", null);
|
|
78
|
-
/**
|
|
79
|
-
* Return a human-readable name for a BiometryType.
|
|
80
|
-
*
|
|
81
|
-
* @param {BiometryType} type
|
|
82
|
-
* @returns {string}
|
|
83
|
-
*/
|
|
84
|
-
export function getBiometryName(type) {
|
|
85
|
-
return kBiometryTypeNameMap[type] || '';
|
|
86
|
-
}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@capacitor/core');
|
|
6
|
-
var tslib = require('tslib');
|
|
7
|
-
var capacitorNativeDecorator = require('@aparajita/capacitor-native-decorator');
|
|
8
6
|
var app = require('@capacitor/app');
|
|
9
7
|
|
|
8
|
+
var info = {
|
|
9
|
+
name: "@aparajita/capacitor-biometric-auth",
|
|
10
|
+
version: "3.1.2"
|
|
11
|
+
};
|
|
12
|
+
|
|
10
13
|
exports.BiometryType = void 0;
|
|
11
14
|
(function (BiometryType) {
|
|
12
15
|
/**
|
|
@@ -63,12 +66,6 @@ class BiometryError {
|
|
|
63
66
|
this.code = exports.BiometryErrorType[code];
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
const kPluginName = 'BiometricAuth';
|
|
67
|
-
|
|
68
|
-
var info = {
|
|
69
|
-
name: "@aparajita/capacitor-biometric-auth",
|
|
70
|
-
version: "3.0.2"
|
|
71
|
-
};
|
|
72
69
|
|
|
73
70
|
const kBiometryTypeNameMap = {
|
|
74
71
|
[exports.BiometryType.none]: '',
|
|
@@ -78,29 +75,42 @@ const kBiometryTypeNameMap = {
|
|
|
78
75
|
[exports.BiometryType.faceAuthentication]: 'Face Authentication',
|
|
79
76
|
[exports.BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
80
77
|
};
|
|
81
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Return a human-readable name for a BiometryType.
|
|
80
|
+
*/
|
|
81
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
82
|
+
function getBiometryName(type) {
|
|
83
|
+
return kBiometryTypeNameMap[type] || '';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
console.log(`loaded ${info.name} v${info.version}`);
|
|
87
|
+
const proxy = core.registerPlugin('BiometricAuthNative', {
|
|
88
|
+
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
|
|
89
|
+
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
90
|
+
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
94
|
+
class BiometricAuthBase extends core.WebPlugin {
|
|
95
|
+
addResumeListener(listener) {
|
|
96
|
+
return app.App.addListener('appStateChange', ({ isActive }) => {
|
|
97
|
+
if (isActive) {
|
|
98
|
+
this.checkBiometry()
|
|
99
|
+
.then((info) => {
|
|
100
|
+
listener(info);
|
|
101
|
+
})
|
|
102
|
+
.catch(console.error);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
109
|
+
class BiometricAuthWeb extends BiometricAuthBase {
|
|
82
110
|
constructor() {
|
|
83
111
|
super(...arguments);
|
|
84
112
|
this.biometryType = exports.BiometryType.none;
|
|
85
113
|
}
|
|
86
|
-
getRegisteredPluginName() {
|
|
87
|
-
return kPluginName;
|
|
88
|
-
}
|
|
89
|
-
setBiometryType(type) {
|
|
90
|
-
if (typeof type === 'undefined') {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (typeof type === 'string') {
|
|
94
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
95
|
-
if (exports.BiometryType.hasOwnProperty(type)) {
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
97
|
-
this.biometryType = exports.BiometryType[type];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
this.biometryType = type;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
114
|
async checkBiometry() {
|
|
105
115
|
return Promise.resolve({
|
|
106
116
|
isAvailable: this.biometryType !== exports.BiometryType.none,
|
|
@@ -114,7 +124,7 @@ class BiometricAuth extends core.WebPlugin {
|
|
|
114
124
|
if (
|
|
115
125
|
// eslint-disable-next-line no-alert
|
|
116
126
|
confirm((options === null || options === void 0 ? void 0 : options.reason) ||
|
|
117
|
-
`Authenticate with ${
|
|
127
|
+
`Authenticate with ${getBiometryName(biometryType)}?`)) {
|
|
118
128
|
return;
|
|
119
129
|
}
|
|
120
130
|
throw new BiometryError('User cancelled', exports.BiometryErrorType.userCancel);
|
|
@@ -122,48 +132,59 @@ class BiometricAuth extends core.WebPlugin {
|
|
|
122
132
|
throw new BiometryError('Biometry not available', exports.BiometryErrorType.biometryNotAvailable);
|
|
123
133
|
});
|
|
124
134
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
+
async setBiometryType(type) {
|
|
136
|
+
if (typeof type === 'undefined') {
|
|
137
|
+
return Promise.resolve();
|
|
138
|
+
}
|
|
139
|
+
if (typeof type === 'string') {
|
|
140
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
141
|
+
if (exports.BiometryType.hasOwnProperty(type)) {
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
143
|
+
this.biometryType = exports.BiometryType[type];
|
|
135
144
|
}
|
|
136
|
-
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.biometryType = type;
|
|
148
|
+
}
|
|
149
|
+
return Promise.resolve();
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
|
|
153
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
154
|
+
__proto__: null,
|
|
155
|
+
BiometricAuthWeb: BiometricAuthWeb
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
159
|
+
class BiometricAuthNative extends BiometricAuthBase {
|
|
160
|
+
constructor(capProxy) {
|
|
161
|
+
super();
|
|
162
|
+
this.checkBiometry = capProxy.checkBiometry;
|
|
163
|
+
this.authenticate = capProxy.authenticate;
|
|
164
|
+
}
|
|
165
|
+
async checkBiometry() {
|
|
166
|
+
// Never used, satisfy the compiler
|
|
167
|
+
return Promise.resolve({
|
|
168
|
+
isAvailable: true,
|
|
169
|
+
biometryType: exports.BiometryType.none,
|
|
170
|
+
reason: ''
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
174
|
+
async authenticate(options) { }
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
176
|
+
async setBiometryType(
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
178
|
+
type) {
|
|
179
|
+
throw this.unimplemented('setBiometryType is web only');
|
|
180
|
+
}
|
|
153
181
|
}
|
|
154
182
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// is no need to lazy load. 😁
|
|
159
|
-
const plugin = new BiometricAuth();
|
|
160
|
-
core.registerPlugin(kPluginName, {
|
|
161
|
-
web: plugin,
|
|
162
|
-
ios: plugin,
|
|
163
|
-
android: plugin
|
|
183
|
+
var native = /*#__PURE__*/Object.freeze({
|
|
184
|
+
__proto__: null,
|
|
185
|
+
BiometricAuthNative: BiometricAuthNative
|
|
164
186
|
});
|
|
165
187
|
|
|
166
|
-
exports.BiometricAuth =
|
|
188
|
+
exports.BiometricAuth = proxy;
|
|
167
189
|
exports.BiometryError = BiometryError;
|
|
168
190
|
exports.getBiometryName = getBiometryName;
|
|
169
|
-
exports.kPluginName = kPluginName;
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
var capacitorBiometricAuth = (function (exports, core,
|
|
1
|
+
var capacitorBiometricAuth = (function (exports, core, app) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var info = {
|
|
5
|
+
name: "@aparajita/capacitor-biometric-auth",
|
|
6
|
+
version: "3.1.2"
|
|
7
|
+
};
|
|
8
|
+
|
|
4
9
|
exports.BiometryType = void 0;
|
|
5
10
|
(function (BiometryType) {
|
|
6
11
|
/**
|
|
@@ -57,12 +62,6 @@ var capacitorBiometricAuth = (function (exports, core, tslib, capacitorNativeDec
|
|
|
57
62
|
this.code = exports.BiometryErrorType[code];
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
const kPluginName = 'BiometricAuth';
|
|
61
|
-
|
|
62
|
-
var info = {
|
|
63
|
-
name: "@aparajita/capacitor-biometric-auth",
|
|
64
|
-
version: "3.0.2"
|
|
65
|
-
};
|
|
66
65
|
|
|
67
66
|
const kBiometryTypeNameMap = {
|
|
68
67
|
[exports.BiometryType.none]: '',
|
|
@@ -72,29 +71,42 @@ var capacitorBiometricAuth = (function (exports, core, tslib, capacitorNativeDec
|
|
|
72
71
|
[exports.BiometryType.faceAuthentication]: 'Face Authentication',
|
|
73
72
|
[exports.BiometryType.irisAuthentication]: 'Iris Authentication'
|
|
74
73
|
};
|
|
75
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Return a human-readable name for a BiometryType.
|
|
76
|
+
*/
|
|
77
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
78
|
+
function getBiometryName(type) {
|
|
79
|
+
return kBiometryTypeNameMap[type] || '';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(`loaded ${info.name} v${info.version}`);
|
|
83
|
+
const proxy = core.registerPlugin('BiometricAuthNative', {
|
|
84
|
+
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
|
|
85
|
+
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
|
|
86
|
+
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
90
|
+
class BiometricAuthBase extends core.WebPlugin {
|
|
91
|
+
addResumeListener(listener) {
|
|
92
|
+
return app.App.addListener('appStateChange', ({ isActive }) => {
|
|
93
|
+
if (isActive) {
|
|
94
|
+
this.checkBiometry()
|
|
95
|
+
.then((info) => {
|
|
96
|
+
listener(info);
|
|
97
|
+
})
|
|
98
|
+
.catch(console.error);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
105
|
+
class BiometricAuthWeb extends BiometricAuthBase {
|
|
76
106
|
constructor() {
|
|
77
107
|
super(...arguments);
|
|
78
108
|
this.biometryType = exports.BiometryType.none;
|
|
79
109
|
}
|
|
80
|
-
getRegisteredPluginName() {
|
|
81
|
-
return kPluginName;
|
|
82
|
-
}
|
|
83
|
-
setBiometryType(type) {
|
|
84
|
-
if (typeof type === 'undefined') {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (typeof type === 'string') {
|
|
88
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
89
|
-
if (exports.BiometryType.hasOwnProperty(type)) {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
91
|
-
this.biometryType = exports.BiometryType[type];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
this.biometryType = type;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
110
|
async checkBiometry() {
|
|
99
111
|
return Promise.resolve({
|
|
100
112
|
isAvailable: this.biometryType !== exports.BiometryType.none,
|
|
@@ -108,7 +120,7 @@ var capacitorBiometricAuth = (function (exports, core, tslib, capacitorNativeDec
|
|
|
108
120
|
if (
|
|
109
121
|
// eslint-disable-next-line no-alert
|
|
110
122
|
confirm((options === null || options === void 0 ? void 0 : options.reason) ||
|
|
111
|
-
`Authenticate with ${
|
|
123
|
+
`Authenticate with ${getBiometryName(biometryType)}?`)) {
|
|
112
124
|
return;
|
|
113
125
|
}
|
|
114
126
|
throw new BiometryError('User cancelled', exports.BiometryErrorType.userCancel);
|
|
@@ -116,54 +128,65 @@ var capacitorBiometricAuth = (function (exports, core, tslib, capacitorNativeDec
|
|
|
116
128
|
throw new BiometryError('Biometry not available', exports.BiometryErrorType.biometryNotAvailable);
|
|
117
129
|
});
|
|
118
130
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
131
|
+
async setBiometryType(type) {
|
|
132
|
+
if (typeof type === 'undefined') {
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
}
|
|
135
|
+
if (typeof type === 'string') {
|
|
136
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
137
|
+
if (exports.BiometryType.hasOwnProperty(type)) {
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
139
|
+
this.biometryType = exports.BiometryType[type];
|
|
129
140
|
}
|
|
130
|
-
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.biometryType = type;
|
|
144
|
+
}
|
|
145
|
+
return Promise.resolve();
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
|
|
149
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
150
|
+
__proto__: null,
|
|
151
|
+
BiometricAuthWeb: BiometricAuthWeb
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
155
|
+
class BiometricAuthNative extends BiometricAuthBase {
|
|
156
|
+
constructor(capProxy) {
|
|
157
|
+
super();
|
|
158
|
+
this.checkBiometry = capProxy.checkBiometry;
|
|
159
|
+
this.authenticate = capProxy.authenticate;
|
|
160
|
+
}
|
|
161
|
+
async checkBiometry() {
|
|
162
|
+
// Never used, satisfy the compiler
|
|
163
|
+
return Promise.resolve({
|
|
164
|
+
isAvailable: true,
|
|
165
|
+
biometryType: exports.BiometryType.none,
|
|
166
|
+
reason: ''
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
170
|
+
async authenticate(options) { }
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
172
|
+
async setBiometryType(
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
174
|
+
type) {
|
|
175
|
+
throw this.unimplemented('setBiometryType is web only');
|
|
176
|
+
}
|
|
147
177
|
}
|
|
148
178
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// is no need to lazy load. 😁
|
|
153
|
-
const plugin = new BiometricAuth();
|
|
154
|
-
core.registerPlugin(kPluginName, {
|
|
155
|
-
web: plugin,
|
|
156
|
-
ios: plugin,
|
|
157
|
-
android: plugin
|
|
179
|
+
var native = /*#__PURE__*/Object.freeze({
|
|
180
|
+
__proto__: null,
|
|
181
|
+
BiometricAuthNative: BiometricAuthNative
|
|
158
182
|
});
|
|
159
183
|
|
|
160
|
-
exports.BiometricAuth =
|
|
184
|
+
exports.BiometricAuth = proxy;
|
|
161
185
|
exports.BiometryError = BiometryError;
|
|
162
186
|
exports.getBiometryName = getBiometryName;
|
|
163
|
-
exports.kPluginName = kPluginName;
|
|
164
187
|
|
|
165
188
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
166
189
|
|
|
167
190
|
return exports;
|
|
168
191
|
|
|
169
|
-
})({}, capacitorExports,
|
|
192
|
+
})({}, capacitorExports, app);
|
package/ios/Plugin/Plugin.m
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// Generated by @aparajita/capacitor-native-decorator/make-ios-plugin
|
|
5
5
|
|
|
6
|
-
CAP_PLUGIN(
|
|
6
|
+
CAP_PLUGIN(BiometricAuthNative, "BiometricAuthNative",
|
|
7
7
|
CAP_PLUGIN_METHOD(checkBiometry, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(authenticate, CAPPluginReturnPromise);
|
|
9
9
|
)
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -5,8 +5,8 @@ import LocalAuthentication
|
|
|
5
5
|
private let kReason = "reason"
|
|
6
6
|
private let kMissingFaceIDUsageEntry = "The device supports Face ID, but NSFaceIDUsageDescription is not in Info.plist."
|
|
7
7
|
|
|
8
|
-
@objc(
|
|
9
|
-
public class
|
|
8
|
+
@objc(BiometricAuthNative)
|
|
9
|
+
public class BiometricAuthNative: CAPPlugin {
|
|
10
10
|
let biometryErrorCodeMap: [LAError.Code: String] = [
|
|
11
11
|
.appCancel: "appCancel",
|
|
12
12
|
.authenticationFailed: "authenticationFailed",
|
|
@@ -22,6 +22,7 @@ public class BiometricAuth: CAPPlugin {
|
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
var canEvaluatePolicy = true
|
|
25
|
+
var count = 0
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Check the device's availability and type of biometric authentication.
|
|
@@ -60,6 +61,11 @@ public class BiometricAuth: CAPPlugin {
|
|
|
60
61
|
])
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
@objc func test(_ call: CAPPluginCall) {
|
|
65
|
+
call.resolve(["count": count])
|
|
66
|
+
count += 1
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
/**
|
|
64
70
|
* Prompt the user for authentication.
|
|
65
71
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparajita/capacitor-biometric-auth",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Provides access to the native biometric auth APIs for Capacitor apps",
|
|
5
5
|
"author": "Aparajita Fishman",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,14 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"commit-and-tag-version": {
|
|
23
23
|
"scripts": {
|
|
24
|
-
"postbump": "pnpm
|
|
24
|
+
"postbump": "pnpm builder"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"ultra": {
|
|
28
|
-
"concurrent": [
|
|
29
|
-
"verify"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
27
|
"keywords": [
|
|
33
28
|
"capacitor",
|
|
34
29
|
"plugin",
|
|
@@ -66,9 +61,9 @@
|
|
|
66
61
|
"@commitlint/config-conventional": "^17.0.3",
|
|
67
62
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
68
63
|
"@rollup/plugin-json": "^4.1.0",
|
|
69
|
-
"@types/node": "^18.6.
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
71
|
-
"@typescript-eslint/parser": "^5.
|
|
64
|
+
"@types/node": "^18.6.5",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
72
67
|
"commit-and-tag-version": "^10.0.1",
|
|
73
68
|
"eslint": "^8.21.0",
|
|
74
69
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -85,16 +80,13 @@
|
|
|
85
80
|
"rimraf": "^3.0.2",
|
|
86
81
|
"rollup": "^2.77.2",
|
|
87
82
|
"swiftlint": "^1.0.1",
|
|
88
|
-
"typescript": "~4.7.4"
|
|
89
|
-
"ultra-runner": "^3.10.5"
|
|
83
|
+
"typescript": "~4.7.4"
|
|
90
84
|
},
|
|
91
85
|
"dependencies": {
|
|
92
|
-
"@aparajita/capacitor-native-decorator": "^3.0.0",
|
|
93
86
|
"@capacitor/android": "^4.0.1",
|
|
94
87
|
"@capacitor/app": "^4.0.1",
|
|
95
88
|
"@capacitor/core": "^4.0.1",
|
|
96
|
-
"@capacitor/ios": "^4.0.1"
|
|
97
|
-
"tslib": "^2.4.0"
|
|
89
|
+
"@capacitor/ios": "^4.0.1"
|
|
98
90
|
},
|
|
99
91
|
"scripts": {
|
|
100
92
|
"clean": "rimraf dist",
|
|
@@ -102,19 +94,20 @@
|
|
|
102
94
|
"lint.eslint": "eslint --fix --cache --ext .js,.cjs,.mjs,.ts --max-warnings 0",
|
|
103
95
|
"lint.prettier": "prettier --write --cache --list-different",
|
|
104
96
|
"lint.tsc": "tsc --noEmit",
|
|
105
|
-
"lint": "pnpm
|
|
106
|
-
"
|
|
107
|
-
"builder": "
|
|
108
|
-
"
|
|
109
|
-
"build
|
|
110
|
-
"
|
|
111
|
-
"
|
|
97
|
+
"lint": "pnpm lint.eslint . && pnpm lint.prettier . && pnpm lint.tsc",
|
|
98
|
+
"prebuilder": "pnpm clean && pnpm extract-info",
|
|
99
|
+
"builder": "tsc ${SOURCE_MAP:-} && rollup -c rollup.config.mjs",
|
|
100
|
+
"prebuild": "pnpm lint",
|
|
101
|
+
"build": "pnpm builder",
|
|
102
|
+
"build.dev": "SOURCE_MAP=--sourceMap pnpm build",
|
|
103
|
+
"watch": "nodemon --exec 'pnpm build.dev'",
|
|
104
|
+
"docgen": "docgen --api BiometricAuthPlugin --output-readme README.md && docgen-format && pnpm lint.prettier README.md",
|
|
112
105
|
"open.ios": "open ios/Plugin.xcworkspace",
|
|
113
106
|
"open.android": "open -b com.google.android.studio android",
|
|
114
107
|
"verify.ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -quiet && cd ..",
|
|
115
108
|
"verify.android": "cd android && ./gradlew clean build test && cd ..",
|
|
116
109
|
"verify": "pnpm verify.ios && pnpm verify.android",
|
|
117
|
-
"
|
|
118
|
-
"release": "
|
|
110
|
+
"prerelease": "scripts/ensure-clean.sh && pnpm build && pnpm docgen && git add README.md",
|
|
111
|
+
"release": "commit-and-tag-version --commit-all && git push --follow-tags && pnpm publish"
|
|
119
112
|
}
|
|
120
113
|
}
|