You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Android 7-9 rely on a manual authentication dialog. Provide `authenticationPrompt` strings whenever you request biometric/device credential protection so the library can display localized UI ahead of decrypting secrets.
129
+
112
130
### iOS Setup
113
131
114
132
Add to `Info.plist`:
@@ -151,7 +169,7 @@ const result = await SensitiveInfo.getItem('auth-token', {
@@ -215,6 +233,9 @@ When enabled, biometric authentication is required to access encrypted data:
215
233
- On success: Key is unlocked, value is decrypted
216
234
- On failure/cancellation: Access denied, exception thrown
217
235
236
+
> [!NOTE]
237
+
> On Android 7-9 the library displays its own dialog before touching the keystore. On Android 10+ the OS handles the biometric/device credential UI directly.
238
+
218
239
**Protection against**:
219
240
- ✅ Screen reading (encryption)
220
241
- ✅ Device theft (biometric + device passcode)
@@ -234,9 +255,9 @@ interface SetOptions {
234
255
keychainService?:string; // Service namespace (app package by default)
> Run your suite on both an Android 13+ emulator **and** an Android 8/9 emulator to validate the automatic keystore dialog and the manual pre-auth dialog paths.
-**StrongBox**: Available Android 9+ (secure processor)
391
-
-**AndroidKeyStore**: Isolated key storage
392
-
-**Hardware Requirements**: Biometric sensor for fingerprint
393
-
-**Permissions**: USE_BIOMETRIC + USE_FINGERPRINT in AndroidManifest.xml
414
+
-**Authentication Flow**: API 29+ (Android 10+) relies on keystore-gated OS dialogs, while API 24-28 (Android 7-9) shows a library-provided dialog before key use.
415
+
-**StrongBox**: Hardware-backed keys automatically prefer StrongBox where present (Android 9+).
416
+
-**Activity Hook**: Ensure `ActivityContextHolder.setActivity(this)` runs in `MainActivity.onCreate` so prompts attach to the foreground activity.
417
+
-**Permissions**: Declare `USE_BIOMETRIC` and `USE_FINGERPRINT` in `AndroidManifest.xml`.
394
418
395
419
### macOS
396
420
@@ -505,6 +529,11 @@ try {
505
529
}
506
530
```
507
531
532
+
### `E_AUTHENTICATION_REQUIRED` on Android 7-9
533
+
534
+
**Cause**: `authenticationPrompt` text is missing, so the manual dialog cannot be rendered before hitting the keystore.
535
+
**Solution**: Provide at least a `title` (and ideally description) when storing or reading biometric-protected secrets.
Copy file name to clipboardExpand all lines: example/README.md
+7-22Lines changed: 7 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
-
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
1
+
This example showcases the latest `react-native-sensitive-info` flows, including the manual biometric prompt path for Android 7-9 and the keystore-gated dialog on Android 10+.
2
2
3
3
# Getting Started
4
4
5
-
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
5
+
> [!NOTE]
6
+
> Follow the [main README](../README.md) for library-specific setup details such as permissions and biometric prompt strings.
6
7
7
8
## Step 1: Start Metro
8
9
@@ -32,6 +33,9 @@ npm run android
32
33
yarn android
33
34
```
34
35
36
+
> [!TIP]
37
+
> Run the app on an Android 13 emulator **and** an Android 8/9 emulator to verify both authentication flows.
38
+
35
39
### iOS
36
40
37
41
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
@@ -75,23 +79,4 @@ When you want to forcefully reload, for example to reset the state of your app,
75
79
76
80
## Congratulations! :tada:
77
81
78
-
You've successfully run and modified your React Native App. :partying_face:
79
-
80
-
### Now what?
81
-
82
-
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
83
-
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
84
-
85
-
# Troubleshooting
86
-
87
-
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
88
-
89
-
# Learn More
90
-
91
-
To learn more about React Native, take a look at the following resources:
92
-
93
-
-[React Native Website](https://reactnative.dev) - learn more about React Native.
94
-
-[Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
95
-
-[Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
96
-
-[Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
97
-
-[`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
82
+
You've successfully run and modified the example. Switch between emulators or devices to experience both Android authentication paths and to confirm iOS prompt metadata is surfaced correctly in the console logs.
0 commit comments