expo-local-authentication 12.1.1 → 12.2.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/CHANGELOG.md +21 -1
- package/README.md +3 -3
- package/android/build.gradle +25 -10
- package/android/src/main/java/expo/modules/localauthentication/LocalAuthenticationModule.kt +2 -0
- package/build/ExpoLocalAuthentication.d.ts +1 -0
- package/build/ExpoLocalAuthentication.d.ts.map +1 -0
- package/build/ExpoLocalAuthentication.web.d.ts +1 -0
- package/build/ExpoLocalAuthentication.web.d.ts.map +1 -0
- package/build/LocalAuthentication.d.ts +3 -1
- package/build/LocalAuthentication.d.ts.map +1 -0
- package/build/LocalAuthentication.js +2 -1
- package/build/LocalAuthentication.js.map +1 -1
- package/build/LocalAuthentication.types.d.ts +8 -0
- package/build/LocalAuthentication.types.d.ts.map +1 -0
- package/build/LocalAuthentication.types.js.map +1 -1
- package/package.json +3 -3
- package/src/LocalAuthentication.ts +2 -1
- package/src/LocalAuthentication.types.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 12.
|
|
13
|
+
## 12.2.0 — 2022-04-18
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Add the ability to set confirmation requirement on Android. ([#16793](https://github.com/expo/expo/pull/16793) by [@fguitton](https://github.com/fguitton))
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- On Android fixed `BiometricPrompt.ERROR_CANCELED` returned when fallbacking to PIN/Pattern/Password authentication method. ([#16927](https://github.com/expo/expo/pull/16927) by [@bbarthec](https://github.com/bbarthec), [@Polidoro-root](https://github.com/Polidoro-root))
|
|
22
|
+
|
|
23
|
+
### 💡 Others
|
|
24
|
+
|
|
25
|
+
- Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
|
|
26
|
+
- Updated `androix.biometric.biometric` from `1.1.0` to `1.2.0-alphas04`. ([#16927](https://github.com/expo/expo/pull/16927) by [@bbarthec](https://github.com/bbarthec), ([#16927](https://github.com/expo/expo/pull/16927) by [@bbarthec](https://github.com/bbarthec), [@Polidoro-root](https://github.com/Polidoro-root))
|
|
27
|
+
- Bumped `compileSdkVersion` from `30` to `31`. ([#16927](https://github.com/expo/expo/pull/16927) by [@bbarthec](https://github.com/bbarthec), ([#16927](https://github.com/expo/expo/pull/16927) by [@bbarthec](https://github.com/bbarthec), [@Polidoro-root](https://github.com/Polidoro-root))
|
|
28
|
+
|
|
29
|
+
### ⚠️ Notices
|
|
30
|
+
|
|
31
|
+
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
|
|
32
|
+
|
|
33
|
+
## 12.1.1 - 2022-02-01
|
|
14
34
|
|
|
15
35
|
### 🐛 Bug fixes
|
|
16
36
|
|
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ Provides an API for FaceID and TouchID (iOS) or the Fingerprint API (Android) to
|
|
|
4
4
|
|
|
5
5
|
# API documentation
|
|
6
6
|
|
|
7
|
-
- [Documentation for the
|
|
8
|
-
- [Documentation for the latest stable release](https://docs.expo.
|
|
7
|
+
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/local-authentication.md)
|
|
8
|
+
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/local-authentication/)
|
|
9
9
|
|
|
10
10
|
# Installation in managed Expo projects
|
|
11
11
|
|
|
12
|
-
For [managed](https://docs.expo.
|
|
12
|
+
For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/local-authentication/).
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
package/android/build.gradle
CHANGED
|
@@ -3,20 +3,35 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '12.
|
|
6
|
+
version = '12.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
|
+
if (expoModulesCorePlugin.exists()) {
|
|
11
|
+
apply from: expoModulesCorePlugin
|
|
12
|
+
applyKotlinExpoModulesCorePlugin()
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
16
|
ext.safeExtGet = { prop, fallback ->
|
|
11
17
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
// Ensures backward compatibility
|
|
21
|
+
ext.getKotlinVersion = {
|
|
22
|
+
if (ext.has("kotlinVersion")) {
|
|
23
|
+
ext.kotlinVersion()
|
|
24
|
+
} else {
|
|
25
|
+
ext.safeExtGet("kotlinVersion", "1.6.10")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
repositories {
|
|
15
30
|
mavenCentral()
|
|
16
31
|
}
|
|
17
32
|
|
|
18
33
|
dependencies {
|
|
19
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${
|
|
34
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
|
|
@@ -44,22 +59,22 @@ afterEvaluate {
|
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
android {
|
|
47
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 31)
|
|
48
63
|
|
|
49
64
|
compileOptions {
|
|
50
|
-
sourceCompatibility JavaVersion.
|
|
51
|
-
targetCompatibility JavaVersion.
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
kotlinOptions {
|
|
55
|
-
jvmTarget = JavaVersion.
|
|
70
|
+
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
defaultConfig {
|
|
59
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
60
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
61
76
|
versionCode 30
|
|
62
|
-
versionName "12.
|
|
77
|
+
versionName "12.2.0"
|
|
63
78
|
}
|
|
64
79
|
lintOptions {
|
|
65
80
|
abortOnError false
|
|
@@ -69,7 +84,7 @@ android {
|
|
|
69
84
|
dependencies {
|
|
70
85
|
implementation project(':expo-modules-core')
|
|
71
86
|
|
|
72
|
-
|
|
87
|
+
implementation "androidx.biometric:biometric:1.2.0-alpha04"
|
|
73
88
|
|
|
74
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${
|
|
89
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
75
90
|
}
|
|
@@ -206,6 +206,7 @@ class LocalAuthenticationModule(context: Context) : ExportedModule(context), Act
|
|
|
206
206
|
} else {
|
|
207
207
|
false
|
|
208
208
|
}
|
|
209
|
+
val requireConfirmation = options["requireConfirmation"] as? Boolean ?: true
|
|
209
210
|
isAuthenticating = true
|
|
210
211
|
this.promise = promise
|
|
211
212
|
val executor: Executor = Executors.newSingleThreadExecutor()
|
|
@@ -224,6 +225,7 @@ class LocalAuthenticationModule(context: Context) : ExportedModule(context), Act
|
|
|
224
225
|
or BiometricManager.Authenticators.DEVICE_CREDENTIAL
|
|
225
226
|
)
|
|
226
227
|
}
|
|
228
|
+
promptInfoBuilder.setConfirmationRequired(requireConfirmation)
|
|
227
229
|
val promptInfo = promptInfoBuilder.build()
|
|
228
230
|
try {
|
|
229
231
|
biometricPrompt!!.authenticate(promptInfo)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoLocalAuthentication.d.ts","sourceRoot":"","sources":["../src/ExpoLocalAuthentication.ts"],"names":[],"mappings":";AAEA,wBAA0D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoLocalAuthentication.web.d.ts","sourceRoot":"","sources":["../src/ExpoLocalAuthentication.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;;;wBAMpD,QAAQ,OAAO,CAAC;uBAGjB,QAAQ,OAAO,CAAC;6BAGV,QAAQ,aAAa,CAAC;yCAGV,QAAQ,kBAAkB,EAAE,CAAC;;AAb1E,wBAgBE"}
|
|
@@ -39,6 +39,8 @@ export declare function getEnrolledLevelAsync(): Promise<SecurityLevel>;
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function authenticateAsync(options?: LocalAuthenticationOptions): Promise<LocalAuthenticationResult>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Cancels authentication flow.
|
|
43
|
+
* @platform android
|
|
43
44
|
*/
|
|
44
45
|
export declare function cancelAuthenticate(): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=LocalAuthentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalAuthentication.d.ts","sourceRoot":"","sources":["../src/LocalAuthentication.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,aAAa,EAAE,CAAC;AAGpG;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAKzD;AAGD;;;;;;GAMG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAKvF;AAGD;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAKxD;AAGD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAKpE;AAGD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,yBAAyB,CAAC,CAmBpC;AAGD;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKxD"}
|
|
@@ -81,7 +81,8 @@ export async function authenticateAsync(options = {}) {
|
|
|
81
81
|
}
|
|
82
82
|
// @needsAudit
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* Cancels authentication flow.
|
|
85
|
+
* @platform android
|
|
85
86
|
*/
|
|
86
87
|
export async function cancelAuthenticate() {
|
|
87
88
|
if (!ExpoLocalAuthentication.cancelAuthenticate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAuthentication.js","sourceRoot":"","sources":["../src/LocalAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEL,kBAAkB,EAElB,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAA8B,kBAAkB,EAA6B,aAAa,EAAE,CAAC;AAEpG,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC,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kB;IACtC,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,EAAE;QAC/C,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;KAClF;IACD,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\nimport invariant from 'invariant';\n\nimport ExpoLocalAuthentication from './ExpoLocalAuthentication';\nimport {\n LocalAuthenticationOptions,\n AuthenticationType,\n LocalAuthenticationResult,\n SecurityLevel,\n} from './LocalAuthentication.types';\n\nexport { LocalAuthenticationOptions, AuthenticationType, LocalAuthenticationResult, SecurityLevel };\n\n// @needsAudit\n/**\n * Determine whether a face or fingerprint scanner is available on the device.\n * @return Returns a promise which fulfils with a `boolean` value indicating whether a face or\n * fingerprint scanner is available on this device.\n */\nexport async function hasHardwareAsync(): Promise<boolean> {\n if (!ExpoLocalAuthentication.hasHardwareAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'hasHardwareAsync');\n }\n return await ExpoLocalAuthentication.hasHardwareAsync();\n}\n\n// @needsAudit\n/**\n * Determine what kinds of authentications are available on the device.\n * @return Returns a promise which fulfils to an array containing [`AuthenticationType`s](#authenticationtype).\n *\n * Devices can support multiple authentication methods- i.e. `[1,2]` means the device supports both\n * fingerprint and facial recognition. If none are supported, this method returns an empty array.\n */\nexport async function supportedAuthenticationTypesAsync(): Promise<AuthenticationType[]> {\n if (!ExpoLocalAuthentication.supportedAuthenticationTypesAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'supportedAuthenticationTypesAsync');\n }\n return await ExpoLocalAuthentication.supportedAuthenticationTypesAsync();\n}\n\n// @needsAudit\n/**\n * Determine whether the device has saved fingerprints or facial data to use for authentication.\n * @return Returns a promise which fulfils to `boolean` value indicating whether the device has\n * saved fingerprints or facial data for authentication.\n */\nexport async function isEnrolledAsync(): Promise<boolean> {\n if (!ExpoLocalAuthentication.isEnrolledAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'isEnrolledAsync');\n }\n return await ExpoLocalAuthentication.isEnrolledAsync();\n}\n\n// @needsAudit\n/**\n * Determine what kind of authentication is enrolled on the device.\n * @return Returns a promise which fulfils with [`SecurityLevel`](#securitylevel).\n * > **Note:** On Android devices prior to M, `SECRET` can be returned if only the SIM lock has been\n * enrolled, which is not the method that [`authenticateAsync`](#localauthenticationauthenticateasyncoptions)\n * prompts.\n */\nexport async function getEnrolledLevelAsync(): Promise<SecurityLevel> {\n if (!ExpoLocalAuthentication.getEnrolledLevelAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'getEnrolledLevelAsync');\n }\n return await ExpoLocalAuthentication.getEnrolledLevelAsync();\n}\n\n// @needsAudit\n/**\n * Attempts to authenticate via Fingerprint/TouchID (or FaceID if available on the device).\n * > **Note:** Apple requires apps which use FaceID to provide a description of why they use this API.\n * If you try to use FaceID on an iPhone with FaceID without providing `infoPlist.NSFaceIDUsageDescription`\n * in `app.json`, the module will authenticate using device passcode. For more information about\n * usage descriptions on iOS, see [Deploying to App Stores](/distribution/app-stores#system-permissions-dialogs-on-ios).\n * @param options\n * @return Returns a promise which fulfils with [`LocalAuthenticationResult`](#localauthenticationresult).\n */\nexport async function authenticateAsync(\n options: LocalAuthenticationOptions = {}\n): Promise<LocalAuthenticationResult> {\n if (!ExpoLocalAuthentication.authenticateAsync) {\n throw new UnavailabilityError('expo-local-authentication', 'authenticateAsync');\n }\n\n if (options.hasOwnProperty('promptMessage')) {\n invariant(\n typeof options.promptMessage === 'string' && options.promptMessage.length,\n 'LocalAuthentication.authenticateAsync : `options.promptMessage` must be a non-empty string.'\n );\n }\n\n const promptMessage = options.promptMessage || 'Authenticate';\n const result = await ExpoLocalAuthentication.authenticateAsync({ ...options, promptMessage });\n\n if (result.warning) {\n console.warn(result.warning);\n }\n return result;\n}\n\n// @needsAudit\n/**\n * Cancels authentication flow.\n * @platform android\n */\nexport async function cancelAuthenticate(): Promise<void> {\n if (!ExpoLocalAuthentication.cancelAuthenticate) {\n throw new UnavailabilityError('expo-local-authentication', 'cancelAuthenticate');\n }\n await ExpoLocalAuthentication.cancelAuthenticate();\n}\n"]}
|
|
@@ -52,6 +52,13 @@ export declare type LocalAuthenticationOptions = {
|
|
|
52
52
|
* policy. Defaults to `false`.
|
|
53
53
|
*/
|
|
54
54
|
disableDeviceFallback?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Sets a hint to the system for whether to require user confirmation after authentication.
|
|
57
|
+
* This may be ignored by the system if the user has disabled implicit authentication in Settings
|
|
58
|
+
* or if it does not apply to a particular biometric modality. Defaults to `true`.
|
|
59
|
+
* @platform android
|
|
60
|
+
*/
|
|
61
|
+
requireConfirmation?: boolean;
|
|
55
62
|
/**
|
|
56
63
|
* Allows to customize the default `Use Passcode` label shown after several failed
|
|
57
64
|
* authentication attempts. Setting this option to an empty string disables this button from
|
|
@@ -60,3 +67,4 @@ export declare type LocalAuthenticationOptions = {
|
|
|
60
67
|
*/
|
|
61
68
|
fallbackLabel?: string;
|
|
62
69
|
};
|
|
70
|
+
//# sourceMappingURL=LocalAuthentication.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalAuthentication.types.d.ts","sourceRoot":"","sources":["../src/LocalAuthentication.types.ts"],"names":[],"mappings":"AAAA,oBAAY,yBAAyB,GACjC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GACjB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAGxD,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,kBAAkB,IAAI;IACtB;;;OAGG;IACH,IAAI,IAAI;CACT;AAGD,oBAAY,aAAa;IACvB;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,MAAM,IAAI;IACV;;OAEG;IACH,SAAS,IAAI;CACd;AAGD,oBAAY,0BAA0B,GAAG;IACvC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAuthentication.types.js","sourceRoot":"","sources":["../src/LocalAuthentication.types.ts"],"names":[],"mappings":"AAIA,cAAc;AACd,MAAM,CAAN,IAAY,kBAcX;AAdD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,yEAAe,CAAA;IACf;;OAEG;IACH,uFAAsB,CAAA;IACtB;;;OAGG;IACH,2DAAQ,CAAA;AACV,CAAC,EAdW,kBAAkB,KAAlB,kBAAkB,QAc7B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB;;OAEG;IACH,iDAAQ,CAAA;IACR;;OAEG;IACH,qDAAU,CAAA;IACV;;OAEG;IACH,2DAAa,CAAA;AACf,CAAC,EAbW,aAAa,KAAb,aAAa,QAaxB","sourcesContent":["export type LocalAuthenticationResult =\n | { success: true }\n | { success: false; error: string; warning?: string };\n\n// @needsAudit\nexport enum AuthenticationType {\n /**\n * Indicates fingerprint support.\n */\n FINGERPRINT = 1,\n /**\n * Indicates facial recognition support.\n */\n FACIAL_RECOGNITION = 2,\n /**\n * Indicates iris recognition support.\n * @platform android\n */\n IRIS = 3,\n}\n\n// @needsAudit\nexport enum SecurityLevel {\n /**\n * Indicates no enrolled authentication.\n */\n NONE = 0,\n /**\n * Indicates non-biometric authentication (e.g. PIN, Pattern).\n */\n SECRET = 1,\n /**\n * Indicates biometric authentication.\n */\n BIOMETRIC = 2,\n}\n\n// @needsAudit\nexport type LocalAuthenticationOptions = {\n /**\n * A message that is shown alongside the TouchID or FaceID prompt.\n */\n promptMessage?: string;\n /**\n * Allows to customize the default `Cancel` label shown.\n */\n cancelLabel?: string;\n /**\n * After several failed attempts the system will fallback to the device passcode. This setting\n * allows you to disable this option and instead handle the fallback yourself. This can be\n * preferable in certain custom authentication workflows. This behaviour maps to using the iOS\n * [LAPolicyDeviceOwnerAuthenticationWithBiometrics](https://developer.apple.com/documentation/localauthentication/lapolicy/lapolicydeviceownerauthenticationwithbiometrics?language=objc)\n * policy rather than the [LAPolicyDeviceOwnerAuthentication](https://developer.apple.com/documentation/localauthentication/lapolicy/lapolicydeviceownerauthentication?language=objc)\n * policy. Defaults to `false`.\n */\n disableDeviceFallback?: boolean;\n /**\n * Allows to customize the default `Use Passcode` label shown after several failed\n * authentication attempts. Setting this option to an empty string disables this button from\n * showing in the prompt.\n * @platform ios\n */\n fallbackLabel?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"LocalAuthentication.types.js","sourceRoot":"","sources":["../src/LocalAuthentication.types.ts"],"names":[],"mappings":"AAIA,cAAc;AACd,MAAM,CAAN,IAAY,kBAcX;AAdD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,yEAAe,CAAA;IACf;;OAEG;IACH,uFAAsB,CAAA;IACtB;;;OAGG;IACH,2DAAQ,CAAA;AACV,CAAC,EAdW,kBAAkB,KAAlB,kBAAkB,QAc7B;AAED,cAAc;AACd,MAAM,CAAN,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB;;OAEG;IACH,iDAAQ,CAAA;IACR;;OAEG;IACH,qDAAU,CAAA;IACV;;OAEG;IACH,2DAAa,CAAA;AACf,CAAC,EAbW,aAAa,KAAb,aAAa,QAaxB","sourcesContent":["export type LocalAuthenticationResult =\n | { success: true }\n | { success: false; error: string; warning?: string };\n\n// @needsAudit\nexport enum AuthenticationType {\n /**\n * Indicates fingerprint support.\n */\n FINGERPRINT = 1,\n /**\n * Indicates facial recognition support.\n */\n FACIAL_RECOGNITION = 2,\n /**\n * Indicates iris recognition support.\n * @platform android\n */\n IRIS = 3,\n}\n\n// @needsAudit\nexport enum SecurityLevel {\n /**\n * Indicates no enrolled authentication.\n */\n NONE = 0,\n /**\n * Indicates non-biometric authentication (e.g. PIN, Pattern).\n */\n SECRET = 1,\n /**\n * Indicates biometric authentication.\n */\n BIOMETRIC = 2,\n}\n\n// @needsAudit\nexport type LocalAuthenticationOptions = {\n /**\n * A message that is shown alongside the TouchID or FaceID prompt.\n */\n promptMessage?: string;\n /**\n * Allows to customize the default `Cancel` label shown.\n */\n cancelLabel?: string;\n /**\n * After several failed attempts the system will fallback to the device passcode. This setting\n * allows you to disable this option and instead handle the fallback yourself. This can be\n * preferable in certain custom authentication workflows. This behaviour maps to using the iOS\n * [LAPolicyDeviceOwnerAuthenticationWithBiometrics](https://developer.apple.com/documentation/localauthentication/lapolicy/lapolicydeviceownerauthenticationwithbiometrics?language=objc)\n * policy rather than the [LAPolicyDeviceOwnerAuthentication](https://developer.apple.com/documentation/localauthentication/lapolicy/lapolicydeviceownerauthentication?language=objc)\n * policy. Defaults to `false`.\n */\n disableDeviceFallback?: boolean;\n /**\n * Sets a hint to the system for whether to require user confirmation after authentication.\n * This may be ignored by the system if the user has disabled implicit authentication in Settings\n * or if it does not apply to a particular biometric modality. Defaults to `true`.\n * @platform android\n */\n requireConfirmation?: boolean;\n /**\n * Allows to customize the default `Use Passcode` label shown after several failed\n * authentication attempts. Setting this option to an empty string disables this button from\n * showing in the prompt.\n * @platform ios\n */\n fallbackLabel?: string;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-local-authentication",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "Provides an API for FaceID and TouchID (iOS) or the Fingerprint API (Android) to authenticate the user with a face or fingerprint scan.",
|
|
5
5
|
"main": "build/LocalAuthentication.js",
|
|
6
6
|
"types": "build/LocalAuthentication.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"preset": "expo-module-scripts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expo/config-plugins": "^4.0.
|
|
41
|
+
"@expo/config-plugins": "^4.0.14",
|
|
42
42
|
"invariant": "^2.2.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"expo": "*"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "22dce752354bb429c84851bc4389abe47a766b1f"
|
|
51
51
|
}
|
|
@@ -102,7 +102,8 @@ export async function authenticateAsync(
|
|
|
102
102
|
|
|
103
103
|
// @needsAudit
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Cancels authentication flow.
|
|
106
|
+
* @platform android
|
|
106
107
|
*/
|
|
107
108
|
export async function cancelAuthenticate(): Promise<void> {
|
|
108
109
|
if (!ExpoLocalAuthentication.cancelAuthenticate) {
|
|
@@ -54,6 +54,13 @@ export type LocalAuthenticationOptions = {
|
|
|
54
54
|
* policy. Defaults to `false`.
|
|
55
55
|
*/
|
|
56
56
|
disableDeviceFallback?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Sets a hint to the system for whether to require user confirmation after authentication.
|
|
59
|
+
* This may be ignored by the system if the user has disabled implicit authentication in Settings
|
|
60
|
+
* or if it does not apply to a particular biometric modality. Defaults to `true`.
|
|
61
|
+
* @platform android
|
|
62
|
+
*/
|
|
63
|
+
requireConfirmation?: boolean;
|
|
57
64
|
/**
|
|
58
65
|
* Allows to customize the default `Use Passcode` label shown after several failed
|
|
59
66
|
* authentication attempts. Setting this option to an empty string disables this button from
|