@symbiote-native/local-auth 0.0.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +252 -24
- package/build/angular/index.d.ts +1 -0
- package/build/angular/index.js +4 -0
- package/build/core/index.d.ts +2 -0
- package/build/core/index.js +2 -0
- package/build/core/local-authentication.d.ts +33 -0
- package/build/core/local-authentication.js +75 -0
- package/build/core/native-module.d.ts +13 -0
- package/build/core/native-module.js +3 -0
- package/build/core/types.d.ts +83 -0
- package/build/core/types.js +55 -0
- package/build/react/index.d.ts +1 -0
- package/build/react/index.js +6 -0
- package/build/svelte/index.d.ts +1 -0
- package/build/svelte/index.js +6 -0
- package/build/vue/index.d.ts +1 -0
- package/build/vue/index.js +4 -0
- package/build-ngc/angular/index.d.ts +1 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/index.d.ts +2 -0
- package/build-ngc/core/index.js +3 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/local-authentication.d.ts +33 -0
- package/build-ngc/core/local-authentication.js +76 -0
- package/build-ngc/core/local-authentication.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +13 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/types.d.ts +83 -0
- package/build-ngc/core/types.js +56 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +17 -0
- package/package.json +110 -3
- package/src/angular/index.ts +4 -0
- package/src/core/index.ts +16 -0
- package/src/core/local-authentication.ts +96 -0
- package/src/core/native-module.ts +27 -0
- package/src/core/types.ts +130 -0
- package/src/react/index.ts +6 -0
- package/src/svelte/index.ts +6 -0
- package/src/vue/index.ts +4 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// expo-local-authentication's own types file imports Platform from the `expo` meta-package. We
|
|
2
|
+
// never depend on `expo` itself (it drags in a second Metro/babel pipeline — see the
|
|
3
|
+
// symbiote-expo-native-module skill) so this pulls Platform straight from expo-modules-core,
|
|
4
|
+
// which is where `expo` re-exports it from — same source device-sensor.ts (packages/sensors)
|
|
5
|
+
// uses for the same reason.
|
|
6
|
+
import { Platform } from 'expo-modules-core';
|
|
7
|
+
|
|
8
|
+
export type ILocalAuthenticationResult =
|
|
9
|
+
| { success: true }
|
|
10
|
+
| {
|
|
11
|
+
success: false;
|
|
12
|
+
error: ILocalAuthenticationError;
|
|
13
|
+
warning?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export enum AuthenticationType {
|
|
17
|
+
/** Indicates fingerprint support. */
|
|
18
|
+
FINGERPRINT = 1,
|
|
19
|
+
/** Indicates facial recognition support. */
|
|
20
|
+
FACIAL_RECOGNITION = 2,
|
|
21
|
+
/**
|
|
22
|
+
* Indicates iris recognition support.
|
|
23
|
+
* @platform android
|
|
24
|
+
*/
|
|
25
|
+
IRIS = 3,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum SecurityLevel {
|
|
29
|
+
/** Indicates no enrolled authentication. */
|
|
30
|
+
NONE = 0,
|
|
31
|
+
/** Indicates non-biometric authentication (e.g. PIN, Pattern). */
|
|
32
|
+
SECRET = 1,
|
|
33
|
+
/**
|
|
34
|
+
* Indicates biometric authentication.
|
|
35
|
+
* @deprecated please use `BIOMETRIC_STRONG` or `BIOMETRIC_WEAK` instead.
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
BIOMETRIC = Platform.OS === 'android'
|
|
39
|
+
? SecurityLevel.BIOMETRIC_WEAK
|
|
40
|
+
: SecurityLevel.BIOMETRIC_STRONG,
|
|
41
|
+
/**
|
|
42
|
+
* Indicates weak biometric authentication. For example, a 2D image-based face unlock. There
|
|
43
|
+
* are currently no weak biometric authentication options on iOS.
|
|
44
|
+
*/
|
|
45
|
+
BIOMETRIC_WEAK = 2,
|
|
46
|
+
/** Indicates strong biometric authentication. For example, a fingerprint scan or 3D face unlock. */
|
|
47
|
+
BIOMETRIC_STRONG = 3,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Upstream deprecation shim: SecurityLevel.BIOMETRIC used to be a real enum member; it's now a
|
|
51
|
+
// getter aliasing to the platform-correct strong/weak member, so old call sites still resolve
|
|
52
|
+
// but see a console warning steering them to the non-deprecated name.
|
|
53
|
+
Object.defineProperty(SecurityLevel, 'BIOMETRIC', {
|
|
54
|
+
get() {
|
|
55
|
+
const additionalMessage =
|
|
56
|
+
Platform.OS === 'android'
|
|
57
|
+
? '. `SecurityLevel.BIOMETRIC` is currently an alias for `SecurityLevel.BIOMETRIC_WEAK` on Android, which might lead to unexpected behaviour.'
|
|
58
|
+
: '';
|
|
59
|
+
console.warn(
|
|
60
|
+
'`SecurityLevel.BIOMETRIC` has been deprecated. Use `SecurityLevel.BIOMETRIC_WEAK` or `SecurityLevel.BIOMETRIC_STRONG` instead' +
|
|
61
|
+
additionalMessage,
|
|
62
|
+
);
|
|
63
|
+
return Platform.OS === 'android'
|
|
64
|
+
? SecurityLevel.BIOMETRIC_WEAK
|
|
65
|
+
: SecurityLevel.BIOMETRIC_STRONG;
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Security level of the biometric authentication to allow.
|
|
71
|
+
* @platform android
|
|
72
|
+
*/
|
|
73
|
+
export type IBiometricsSecurityLevel = 'weak' | 'strong';
|
|
74
|
+
|
|
75
|
+
export type ILocalAuthenticationOptions = {
|
|
76
|
+
/** A message that is shown alongside the TouchID or FaceID prompt. */
|
|
77
|
+
promptMessage?: string;
|
|
78
|
+
/**
|
|
79
|
+
* A subtitle displayed below the prompt message in the authentication prompt.
|
|
80
|
+
* @platform android
|
|
81
|
+
*/
|
|
82
|
+
promptSubtitle?: string;
|
|
83
|
+
/**
|
|
84
|
+
* A description displayed in the middle of the authentication prompt.
|
|
85
|
+
* @platform android
|
|
86
|
+
*/
|
|
87
|
+
promptDescription?: string;
|
|
88
|
+
/** Allows customizing the default `Cancel` label shown. */
|
|
89
|
+
cancelLabel?: string;
|
|
90
|
+
/**
|
|
91
|
+
* After several failed attempts, the system falls back to the device passcode. This setting
|
|
92
|
+
* allows you to disable this option and instead handle the fallback yourself. Defaults to `false`.
|
|
93
|
+
*/
|
|
94
|
+
disableDeviceFallback?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Sets a hint to the system for whether to require user confirmation after authentication.
|
|
97
|
+
* Defaults to `true`.
|
|
98
|
+
* @platform android
|
|
99
|
+
*/
|
|
100
|
+
requireConfirmation?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Sets the security class of biometric authentication to allow. `strong` allows only Android
|
|
103
|
+
* Class 3 biometrics; `weak` allows both Class 3 and Class 2.
|
|
104
|
+
* @platform android
|
|
105
|
+
* @default 'weak'
|
|
106
|
+
*/
|
|
107
|
+
biometricsSecurityLevel?: IBiometricsSecurityLevel;
|
|
108
|
+
/**
|
|
109
|
+
* Allows customizing the default `Use Passcode` label shown after several failed attempts. An
|
|
110
|
+
* empty string disables the button.
|
|
111
|
+
* @platform ios
|
|
112
|
+
*/
|
|
113
|
+
fallbackLabel?: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type ILocalAuthenticationError =
|
|
117
|
+
| 'not_enrolled'
|
|
118
|
+
| 'user_cancel'
|
|
119
|
+
| 'app_cancel'
|
|
120
|
+
| 'not_available'
|
|
121
|
+
| 'lockout'
|
|
122
|
+
| 'no_space'
|
|
123
|
+
| 'timeout'
|
|
124
|
+
| 'unable_to_process'
|
|
125
|
+
| 'unknown'
|
|
126
|
+
| 'system_cancel'
|
|
127
|
+
| 'user_fallback'
|
|
128
|
+
| 'invalid_context'
|
|
129
|
+
| 'passcode_not_set'
|
|
130
|
+
| 'authentication_failed';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @symbiote-native/local-auth/react: the React entry over the framework-agnostic core.
|
|
2
|
+
// Upstream ships free async functions and two enums, no per-instance state and no event
|
|
3
|
+
// stream (unlike the sensor family in @symbiote-native/sensors) — there is nothing for a hook
|
|
4
|
+
// to wrap, so this is a plain re-export, mirroring how Pedometer's free functions pass through
|
|
5
|
+
// packages/sensors/src/react/index.ts untouched.
|
|
6
|
+
export * from '../core';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @symbiote-native/local-auth/svelte: the Svelte entry over the framework-agnostic core.
|
|
2
|
+
// Upstream ships free async functions and two enums, no per-instance state and no event stream
|
|
3
|
+
// (unlike the sensor family in @symbiote-native/sensors) — there is nothing for a rune to wrap,
|
|
4
|
+
// so this is a plain re-export. Svelte's lifecycle bucket is `runes/` (adapters/svelte/src/runes
|
|
5
|
+
// — never React's `hooks` or Vue's `composables`), and this package has none to fill.
|
|
6
|
+
export * from '../core';
|
package/src/vue/index.ts
ADDED