Skip to content

Commit 8c7c519

Browse files
committed
docs: update readme and blog
1 parent 6c95330 commit 8c7c519

File tree

2 files changed

+100
-18
lines changed

2 files changed

+100
-18
lines changed

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,64 @@
22

33
![npm](https://img.shields.io/npm/v/react-native-simple-biometrics?color=%231F7AE0)
44

5-
A simple and straight forward API to ask a user to authenticate with on device biometrics. This can be used to quickly verify if the app is being used by the owner of the phone (or a trustee) before showing some sensitive info.
5+
## Overview
6+
7+
React Native Simple Biometrics is a straightforward and minimalistic React Native package designed to provide developers with an API for implementing user authentication using on-device biometrics. This library facilitates the quick verification of the app's user, ensuring that sensitive information is only accessible to authorized individuals, such as the phone owner or a trustee.
68

79
![demo](./demo.gif?raw=true "demo")
810

9-
## Getting started
11+
## Installation
12+
13+
To get started with React Native Simple Biometrics, you can add it to your project using Yarn:
1014

11-
`$ yarn add react-native-simple-biometrics`
15+
```bash
16+
$ yarn add react-native-simple-biometrics
17+
```
1218

13-
## minimum versions
19+
## Minimum Requirements
1420

1521
- iOS target: `8.0`
1622
- Android minSdkVersion: `21`
1723

18-
## iOS permission
24+
## iOS Permission
1925

20-
It is required to add an entry in your ios app's `info.plist` giving a valid reason to use the phones face ID system.
26+
To utilize the Face ID system on iOS devices, it is mandatory to include an entry in your iOS app's `info.plist`, explaining the valid reason for using biometrics:
2127

22-
```
28+
```xml
2329
<key>NSFaceIDUsageDescription</key>
2430
<string>a valid reason to use biometrics</string>
2531
```
2632

27-
Calling the authenticate function will automatically ask iOS users for the permission. For more control over when to ask permissions, use [react-native-permissions](https://www.npmjs.com/package/react-native-permissions)
33+
When you call the `authenticate` function, iOS users will be automatically prompted for permission. For more granular control over when to request permissions, you can utilize the [react-native-permissions](https://www.npmjs.com/package/react-native-permissions) package.
2834

2935
## Usage
3036

31-
Only 2 methods are exposed
37+
React Native Simple Biometrics offers two main methods:
38+
39+
1. `canAuthenticate()`: Checks whether the device supports biometric authentication. Returns `true` if the hardware is available or if permission for Face ID (iOS) was granted.
40+
41+
2. `requestBioAuth(promptTitle: string, promptMessage: string)`: Initiates the biometric authentication process, displaying a user-friendly prompt with the specified title and message. This function can be used for user authentication.
3242

33-
- `canAuthenticate()`
34-
- `requestBioAuth(promptTitle: string, promptMessage: string)`
43+
Here's a code snippet demonstrating how to use these methods:
3544

3645
```javascript
3746
import RNBiometrics from "react-native-simple-biometrics";
3847

39-
// this will be false if
40-
// - no biometrics hardware
41-
// - permission was denied for face ID (iOS only)
48+
// Check if biometric authentication is available
4249
const can = await RNBiometrics.canAuthenticate();
4350

4451
if (can) {
4552
try {
4653
await RNBiometrics.requestBioAuth("prompt-title", "prompt-message");
47-
// stuff to do when authenticated
54+
// Code to execute when authenticated
4855
// ...
4956
} catch (error) {
50-
// stuff to do when auth failed
57+
// Code to handle authentication failure
5158
// ...
5259
}
5360
}
5461
```
5562

56-
## credits
63+
## Credits
5764

58-
[react-native-biometrics](https://www.npmjs.com/package/react-native-biometrics) is a super-set of this library. For more features like keys generation, signatures, etc use react-native-biometrics.
65+
React Native Simple Biometrics is a simplified version of [react-native-biometrics](https://www.npmjs.com/package/react-native-biometrics). If you require advanced features such as key generation, signatures, and more, consider using react-native-biometrics.

blog.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Elevating Security in React Native Apps with react-native-simple-biometrics
2+
3+
4+
In today's digital age, security is paramount, especially for mobile applications that handle sensitive user data. One crucial aspect of mobile app security is biometric authentication, and the "react-native-simple-biometrics" library can enable just this! In this blog post, we will explore the usage of "react-native-simple-biometrics" and how it can enhance security in your React Native applications.
5+
6+
## Understanding Biometric Authentication
7+
8+
Biometric authentication involves using unique physical or behavioral characteristics of an individual to verify their identity. Common biometric methods include fingerprint recognition, facial recognition, and voice recognition. These methods provide a more secure and convenient way for users to access their devices or applications compared to traditional PINs or passwords.
9+
10+
## Benefits of Biometric Authentication in Mobile Apps
11+
12+
1. **Enhanced Security:** Biometric authentication methods are difficult to forge or mimic, making them highly secure.
13+
14+
2. **User Convenience:** Biometric authentication offers a frictionless user experience, reducing the need for remembering complex passwords.
15+
16+
3. **Quick Access:** Users can access their accounts or sensitive data quickly with a simple scan of their biometric features.
17+
18+
## Introducing react-native-simple-biometrics
19+
20+
React Native provides numerous libraries and plugins to extend its functionality, and "react-native-simple-biometrics" is one such package. It simplifies the integration of biometric authentication into your React Native applications.
21+
22+
### Key Features:
23+
24+
1. **Cross-Platform Compatibility:** "react-native-simple-biometrics" supports both iOS and Android platforms, ensuring broad compatibility.
25+
26+
2. **Fingerprint and Face Recognition:** The library supports fingerprint and facial recognition, allowing developers to choose the most suitable biometric method for their app.
27+
28+
3. **Simple Integration:** The library is easy to integrate into your React Native project, thanks to clear documentation and straightforward API calls.
29+
30+
4. **Customization:** Developers can customize the appearance and behavior of the biometric prompt to match the app's design and user experience.
31+
32+
## How to Use react-native-simple-biometrics
33+
34+
Now, let's dive into the practical aspect of implementing biometric authentication using "react-native-simple-biometrics." Follow these steps to get started:
35+
36+
### Step 1: Install the Package
37+
38+
You can install the library using npm or yarn:
39+
40+
```bash
41+
npm install react-native-simple-biometrics --save
42+
```
43+
44+
### Step 2: Import the Module
45+
46+
Import the "react-native-simple-biometrics" module in your JavaScript file:
47+
48+
```javascript
49+
import Biometrics from 'react-native-simple-biometrics';
50+
```
51+
52+
### Step 3: Implement Biometric Authentication
53+
54+
You can now implement biometric authentication in your app by calling the appropriate method. Here's an example of how to use fingerprint authentication:
55+
56+
```javascript
57+
const canAuthenticate = await Biometrics.canAuthenticate();
58+
59+
if (canAuthenticate) {
60+
try {
61+
await Biometrics.requestBioAuth("prompt-title", "prompt-message");
62+
// User authentication successful
63+
// ...
64+
} catch (error) {
65+
// User authentication failed
66+
// ...
67+
}
68+
}
69+
```
70+
71+
## Conclusion
72+
73+
Incorporating biometric authentication into your React Native applications is a significant step towards enhancing security and user experience. The "react-native-simple-biometrics" library simplifies the process, making it accessible to developers of all skill levels.
74+
75+
By leveraging the power of biometrics, you can ensure that your users' data remains secure while providing a seamless and convenient login experience. So, give "react-native-simple-biometrics" a try in your next project and take your app's security to the next level!

0 commit comments

Comments
 (0)