Skip to content

Commit 323b7f2

Browse files
chore(update-plugins): Mon May 19 08:06:14 UTC 2025
1 parent ee13bbb commit 323b7f2

File tree

8 files changed

+2467
-0
lines changed

8 files changed

+2467
-0
lines changed

content/plugins/fingerprint-auth.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,168 @@ editUrl: https://github.com/NativeScript/plugins/tree/main/packages/fingerprint-
88
<p>
99
<ViewOnGitHubButton href="https://github.com/NativeScript/plugins/tree/main/packages/fingerprint-auth"/>
1010
</p>
11+
12+
## Replacement notice
13+
14+
This plugin is replaced by [@nativescript/biometrics](../biometrics)
15+
16+
# @nativescript/fingerprint-auth
17+
18+
```cli
19+
npm install @nativescript/fingerprint-auth
20+
```
21+
22+
Then open `App_Resources/Android/app.gradle` and look for `minSdkVersion`.
23+
If that's set to a version less than 23, add this `overrideLibrary` line to `App_Resources/Android/src/main/AndroidManifest.xml`:
24+
25+
```xml
26+
<uses-sdk
27+
android:minSdkVersion="17"
28+
android:targetSdkVersion="__APILEVEL__"
29+
tools:overrideLibrary="com.jesusm.kfingerprintmanager"/>
30+
```
31+
32+
## API
33+
34+
Want a nicer guide than these raw code samples? Read [Nic Raboy's blog post about this plugin](https://www.thepolyglotdeveloper.com/2016/03/add-touch-id-authentication-support-to-your-nativescript-app/).
35+
36+
### `available`
37+
38+
#### JavaScript
39+
40+
```js
41+
var fingerprintAuthPlugin = require('@nativescript/fingerprint-auth')
42+
var fingerprintAuth = new fingerprintAuthPlugin.FingerprintAuth()
43+
44+
fingerprintAuth.available().then(function (avail) {
45+
console.log('Available? ' + avail)
46+
})
47+
```
48+
49+
#### TypeScript
50+
51+
```typescript
52+
import { FingerprintAuth, BiometricIDAvailableResult } from "@nativescript/fingerprint-auth";
53+
54+
class MyClass {
55+
private fingerprintAuth: FingerprintAuth;
56+
57+
constructor() {
58+
this.fingerprintAuth = new FingerprintAuth();
59+
}
60+
61+
this.fingerprintAuth.available().then((result: BiometricIDAvailableResult) => {
62+
console.log(`Biometric ID available? ${result.any}`);
63+
console.log(`Touch? ${result.touch}`);
64+
console.log(`Face? ${result.face}`);
65+
});
66+
}
67+
```
68+
69+
### `verifyFingerprint`
70+
71+
Note that on the iOS simulator this will just `resolve()`.
72+
73+
```typescript
74+
fingerprintAuth
75+
.verifyFingerprint({
76+
title: 'Android title', // optional title (used only on Android)
77+
message: 'Scan yer finger', // optional (used on both platforms) - for FaceID on iOS see the notes about NSFaceIDUsageDescription
78+
})
79+
.then((enteredPassword?: string) => {
80+
if (enteredPassword === undefined) {
81+
console.log('Biometric ID OK')
82+
} else {
83+
// compare enteredPassword to the one the user previously configured for your app (which is not the users system password!)
84+
}
85+
})
86+
.catch((err) => console.log(`Biometric ID NOT OK: ${JSON.stringify(err)}`))
87+
```
88+
89+
### `verifyFingerprintWithCustomFallback` (iOS only, falls back to `verifyFingerprint` on Android)
90+
91+
Instead of falling back to the default Passcode UI of iOS you can roll your own.
92+
Just show that when the error callback is invoked.
93+
94+
```typescript
95+
fingerprintAuth
96+
.verifyFingerprintWithCustomFallback({
97+
message: 'Scan yer finger', // optional, shown in the fingerprint dialog (default: 'Scan your finger').
98+
fallbackMessage: 'Enter PIN', // optional, the button label when scanning fails (default: 'Enter password').
99+
authenticationValidityDuration: 10, // optional (used on Android, default 5)
100+
})
101+
.then(
102+
() => {
103+
console.log('Fingerprint was OK')
104+
},
105+
(error) => {
106+
// when error.code === -3, the user pressed the button labeled with your fallbackMessage
107+
console.log(
108+
'Fingerprint NOT OK. Error code: ' +
109+
error.code +
110+
'. Error message: ' +
111+
error.message,
112+
)
113+
},
114+
)
115+
```
116+
117+
## Face ID (iOS)
118+
119+
iOS 11 added support for Face ID and was first supported by the iPhone X.
120+
The developer needs to provide a value for `NSFaceIDUsageDescription`, otherwise your app may crash.
121+
122+
You can provide this value (the reason for using Face ID) by adding something like this to `app/App_Resources/ios/Info.plist`:
123+
124+
```xml
125+
<key>NSFaceIDUsageDescription</key>
126+
<string>For easy authentication with our app.</string>
127+
```
128+
129+
## Security++ (iOS)
130+
131+
Since iOS9 it's possible to check whether or not the list of enrolled fingerprints changed since
132+
the last time you checked it. It's recommended you add this check so you can counter hacker attacks
133+
to your app. See [this article](https://www.linkedin.com/pulse/fingerprint-trojan-per-thorsheim/) for more details.
134+
135+
So instead of checking the fingerprint after `available` add another check.
136+
In case `didFingerprintDatabaseChange` returns `true` you probably want to re-authenticate your user
137+
before accepting valid fingerprints again.
138+
139+
```typescript
140+
fingerprintAuth.available().then((avail) => {
141+
if (!avail) {
142+
return
143+
}
144+
fingerprintAuth.didFingerprintDatabaseChange().then((changed) => {
145+
if (changed) {
146+
// re-auth the user by asking for his credentials before allowing a fingerprint scan again
147+
} else {
148+
// call the fingerprint scanner
149+
}
150+
})
151+
})
152+
```
153+
154+
## Changelog
155+
156+
- 6.2.0 [Fixed a potential bypass on iOS](https://github.com/EddyVerbruggen/nativescript-fingerprint-auth/issues/41).
157+
- 6.1.0 [Fixed potentioal bypasses on Android](https://github.com/EddyVerbruggen/nativescript-fingerprint-auth/milestone/8?closed=1).
158+
- 6.0.3 [Android interfered with other plugins' Intents](https://github.com/EddyVerbruggen/nativescript-fingerprint-auth/pull/28).
159+
- 6.0.2 [Plugin not working correctly on iOS production builds / TestFlight](https://github.com/EddyVerbruggen/nativescript-fingerprint-auth/issues/27).
160+
- 6.0.1 Fixed a compatibility issues with NativeScript 3.4.
161+
- 6.0.0 Allow custom UI on Android.
162+
- 5.0.0 Better `Face ID` support. Breaking change, see the API for `available`.
163+
- 4.0.1 Aligned with [the official NativeScript plugin seed](https://github.com/NativeScript/nativescript-plugin-seed). Requires NativeScript 3.0.0+. Thanks, @angeltsvetkov!
164+
- 4.0.0 Converted to TypeScript. Changed the error response type of `verifyFingerprintWithCustomFallback`.
165+
- 3.0.0 Android support added. Renamed `nativescript-touchid` to `nativescript-fingerprint-auth` (sorry for any inconvenience!).
166+
- 2.1.1 Xcode 8 compatibility - requires NativeScript 2.3.0+.
167+
- 2.1.0 Added `didFingerprintDatabaseChange` for enhanced security.
168+
- 2.0.0 Added `verifyFingerprintWithCustomFallback`, `verifyFingerprint` now falls back to the passcode.
169+
- 1.2.0 You can now use the built-in passcode interface as fallback.
170+
- 1.1.1 Added TypeScript definitions.
171+
- 1.1.0 Added Android platform which will always return false for `touchid.available`.
172+
173+
## License
174+
175+
Apache License Version 2.0

content/plugins/firebase-admob.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ editUrl: https://github.com/NativeScript/firebase/tree/main/packages/firebase-ad
88
<p>
99
<ViewOnGitHubButton href="undefined"/>
1010
</p>
11+
12+
404: Not Found

0 commit comments

Comments
 (0)