react-native-otp-auto-verify 0.1.3 → 0.1.5
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/README.md +42 -31
- package/package.json +22 -35
package/README.md
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
# react-native-otp-auto-verify
|
|
2
2
|
|
|
3
|
-
<div align="center">
|
|
4
3
|
|
|
5
|
-
[](https://www.npmjs.com/package/react-native-otp-auto-verify)
|
|
4
|
+
[](https://www.npmjs.com/package/react-native-otp-auto-verify) [](https://www.npmjs.com/package/react-native-otp-auto-verify) [](https://github.com/kailas-rathod/react-native-otp-auto-verify/blob/main/LICENSE) [](https://www.typescriptlang.org/)
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
[](https://github.com/kailas-rathod/react-native-otp-auto-verify/blob/main/LICENSE)
|
|
6
|
+
**react-native-otp-auto-verify** is a lightweight and secure React Native OTP auto-verification library for Android, built on the official Google SMS Retriever API. It enables automatic OTP detection without requiring READ_SMS or RECEIVE_SMS permissions, ensuring full Google Play Store compliance and enhanced user trust. Designed for modern authentication flows, this library is ideal for fintech apps, banking applications, e-commerce platforms, and secure login systems.
|
|
9
7
|
|
|
8
|
+
With minimal dependencies and clean architecture, it integrates seamlessly into both React Native Old Architecture and the New Architecture (TurboModule) environments. The solution improves user experience by eliminating manual OTP entry on Android while maintaining strong server-side validation standards.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
Works best for onboarding/login flows in **banking**, **fintech**, and authentication-heavy apps.
|
|
11
|
+
Supports both RN Old Architecture and React Native **New Architecture** (TurboModule).
|
|
12
|
+
**Android**: automatic OTP detection.
|
|
13
|
+
**iOS**: auto-OTP is not supported—use manual OTP entry as fallback.
|
|
12
14
|
|
|
15
|
+
---
|
|
16
|
+
<img width="1536" height="1024" alt="otp" src="https://github.com/user-attachments/assets/e4908e99-e7d1-4a96-a6d2-b92c50090db0" />
|
|
13
17
|
|
|
14
18
|
|
|
15
19
|
## Features
|
|
16
20
|
|
|
17
|
-
Automatic
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
- ✅ **Automatic OTP detection**: receives OTP from matching SMS and exposes it as `otp` (hook) or `extractedOtp` (listener)
|
|
22
|
+
- ✅ **No SMS permissions**: no access to inbox, avoids sensitive permissions and reduces compliance friction
|
|
23
|
+
- ✅ **App hash security**: OTP SMS must end with your **11-character hash** (only your app can receive it)
|
|
24
|
+
- ✅ **Hook + Imperative API**: `useOtpVerification()` for screens, `activateOtpListener()` for custom flows
|
|
25
|
+
- ✅ **TypeScript**: typed options and return values
|
|
26
|
+
- ✅ **New Architecture ready**: TurboModule implementation; works with Old Architecture too
|
|
27
|
+
---
|
|
24
28
|
|
|
25
29
|
## Platform support
|
|
26
30
|
|
|
27
31
|
| Platform | Support | Notes |
|
|
28
32
|
| -------- | ------- | --------------------------------------- |
|
|
29
33
|
| Android | ✅ | Requires Google Play services on device |
|
|
30
|
-
| iOS | ⚠️ | Safe no-op (no auto-read) |
|
|
31
34
|
|
|
32
35
|
## Requirements
|
|
33
36
|
|
|
34
37
|
- React Native: **0.60+** (autolinking)
|
|
35
38
|
- Android: **minSdkVersion 24+**
|
|
36
|
-
- iOS: supported as a **no-op** (you still need manual OTP UI)
|
|
37
39
|
|
|
38
40
|
## Installation
|
|
39
41
|
|
|
@@ -45,11 +47,6 @@ yarn add react-native-otp-auto-verify
|
|
|
45
47
|
pnpm add react-native-otp-auto-verify
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
iOS (React Native CLI projects):
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
npx pod-install
|
|
52
|
-
```
|
|
53
50
|
|
|
54
51
|
## Usage
|
|
55
52
|
|
|
@@ -77,9 +74,10 @@ Requirements:
|
|
|
77
74
|
Recommended format:
|
|
78
75
|
|
|
79
76
|
```
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
Dear Kailas Rathod, 321500 is your OTP for mobile authentication. This OTP is valid for the next 15 minutes. Please DO NOT share it with anyone.
|
|
78
|
+
uW87Uq6teXc
|
|
82
79
|
```
|
|
80
|
+
nots :- not need for <#> starting
|
|
83
81
|
|
|
84
82
|
### 3) Hook usage (recommended)
|
|
85
83
|
|
|
@@ -132,19 +130,28 @@ sub.remove();
|
|
|
132
130
|
removeListener();
|
|
133
131
|
```
|
|
134
132
|
|
|
135
|
-
##
|
|
133
|
+
## react-native-otp-auto-verify Architecture Flow
|
|
134
|
+
<img width="1536" height="1024" alt="react-native-otp-auto-verify Architecture Flow" src="https://github.com/user-attachments/assets/11582523-81cb-4904-9de0-56af05b3a3b4" />
|
|
135
|
+
|
|
136
|
+
## API Reference
|
|
136
137
|
|
|
137
138
|
### `useOtpVerification(options?)`
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
Use this on your OTP screen. It manages:
|
|
141
|
+
- getting the app hash (`hashCode`)
|
|
142
|
+
- starting/stopping the SMS Retriever listener
|
|
143
|
+
- extracting OTP and exposing it as `otp`
|
|
144
|
+
|
|
145
|
+
| Property | Type | Default | Description |
|
|
146
|
+
|----------|------|---------|-------------|
|
|
147
|
+
| `numberOfDigits` | `4 \| 5 \| 6` | `6` | OTP length to extract |
|
|
148
|
+
| `hashCode` | `string` | `''` | App hash (send to backend) |
|
|
149
|
+
| `otp` | `string \| null` | `null` | Extracted OTP |
|
|
150
|
+
| `sms` | `string \| null` | `null` | Full SMS text |
|
|
151
|
+
| `timeoutError` | `boolean` | `false` | Timeout occurred |
|
|
152
|
+
| `startListening` | `() => Promise<void>` | — | Start listening |
|
|
153
|
+
| `stopListening` | `() => void` | — | Stop listening |
|
|
154
|
+
|
|
148
155
|
|
|
149
156
|
### `getHash(): Promise<string[]>`
|
|
150
157
|
|
|
@@ -236,6 +243,10 @@ See [`./example`](./example).
|
|
|
236
243
|
|
|
237
244
|
See [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
238
245
|
|
|
246
|
+
|
|
247
|
+
## Keywork
|
|
248
|
+
react native otp auto verify, react native sms retriever api, automatic otp detection android, react native otp autofill, sms retriever react native, otp verification library react native, google play compliant otp library
|
|
249
|
+
|
|
239
250
|
## License
|
|
240
251
|
|
|
241
252
|
MIT
|
package/package.json
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-otp-auto-verify",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "react-native-otp-auto-verify is a React Native library for automatic OTP
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "react-native-otp-auto-verify is a React Native library for automatic OTP verification on Android and iOS. It uses the Google SMS Retriever API to detect OTP codes automatically without requiring the READ_SMS permission. The library is fully Play Store compliant, improves user login experience, supports TurboModule, and works with the React Native New Architecture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"react-native-library",
|
|
8
|
+
"react-native-otp",
|
|
9
|
+
"react-native-otp-auto-verify",
|
|
10
|
+
"react-native-sms",
|
|
11
|
+
"otp",
|
|
12
|
+
"otp-verification",
|
|
13
|
+
"otp-auto-verify",
|
|
14
|
+
"otp-auto-read",
|
|
15
|
+
"sms",
|
|
16
|
+
"sms-retriever",
|
|
17
|
+
"google-sms-retriever",
|
|
18
|
+
"android-otp",
|
|
19
|
+
"ios-otp",
|
|
20
|
+
"otp-without-permission",
|
|
21
|
+
"play-store-compliant",
|
|
22
|
+
"react-native-new-architecture",
|
|
23
|
+
"turbo-module"
|
|
9
24
|
],
|
|
10
|
-
"homepage": "https://github.com/kailas-rathod/react-native-otp-auto-verify
|
|
25
|
+
"homepage": "https://github.com/kailas-rathod/react-native-otp-auto-verify?tab=readme-ov-file",
|
|
11
26
|
"bugs": {
|
|
12
27
|
"url": "https://github.com/kailas-rathod/react-native-otp-auto-verify/issues"
|
|
13
28
|
},
|
|
@@ -18,14 +33,6 @@
|
|
|
18
33
|
"license": "MIT",
|
|
19
34
|
"author": "Kailas Rathod (https://github.com/kailas-rathod)",
|
|
20
35
|
"type": "commonjs",
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"source": "./src/index.tsx",
|
|
24
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
25
|
-
"default": "./lib/module/index.js"
|
|
26
|
-
},
|
|
27
|
-
"./package.json": "./package.json"
|
|
28
|
-
},
|
|
29
36
|
"main": "./lib/module/index.js",
|
|
30
37
|
"types": "./lib/typescript/src/index.d.ts",
|
|
31
38
|
"directories": {
|
|
@@ -50,20 +57,13 @@
|
|
|
50
57
|
"!**/__mocks__",
|
|
51
58
|
"!**/.*"
|
|
52
59
|
],
|
|
53
|
-
"workspaces": [
|
|
54
|
-
"example"
|
|
55
|
-
],
|
|
56
60
|
"scripts": {
|
|
57
|
-
"example": "yarn workspace react-native-otp-auto-verify-example",
|
|
58
61
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
59
62
|
"prepare": "bob build",
|
|
60
63
|
"typecheck": "tsc",
|
|
61
64
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
62
65
|
"test": "jest",
|
|
63
66
|
"release": "release-it --only-version"
|
|
64
|
-
},
|
|
65
|
-
"dependencies": {
|
|
66
|
-
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@commitlint/config-conventional": "^19.8.1",
|
|
@@ -71,23 +71,21 @@
|
|
|
71
71
|
"@eslint/eslintrc": "^3.3.1",
|
|
72
72
|
"@eslint/js": "^9.35.0",
|
|
73
73
|
"@react-native/babel-preset": "0.83.0",
|
|
74
|
-
"@react-native/eslint-config": "0.83.0",
|
|
74
|
+
"@react-native/eslint-config": "^0.83.0",
|
|
75
75
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
76
76
|
"@types/jest": "^29.5.14",
|
|
77
77
|
"@types/react": "^19.2.0",
|
|
78
78
|
"commitlint": "^19.8.1",
|
|
79
|
-
"del-cli": "^6.0.0",
|
|
80
79
|
"eslint": "^9.35.0",
|
|
81
80
|
"eslint-config-prettier": "^10.1.8",
|
|
82
81
|
"eslint-plugin-prettier": "^5.5.4",
|
|
82
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
83
83
|
"jest": "^29.7.0",
|
|
84
|
-
"lefthook": "^2.0.3",
|
|
85
84
|
"prettier": "^2.8.8",
|
|
86
85
|
"react": "19.2.0",
|
|
87
86
|
"react-native": "0.83.0",
|
|
88
87
|
"react-native-builder-bob": "0.39.1",
|
|
89
88
|
"release-it": "^19.0.4",
|
|
90
|
-
"turbo": "^2.5.6",
|
|
91
89
|
"typescript": "^5.9.2"
|
|
92
90
|
},
|
|
93
91
|
"peerDependencies": {
|
|
@@ -161,16 +159,5 @@
|
|
|
161
159
|
}
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
|
-
},
|
|
165
|
-
"create-react-native-library": {
|
|
166
|
-
"type": "turbo-module",
|
|
167
|
-
"languages": "kotlin-objc",
|
|
168
|
-
"tools": [
|
|
169
|
-
"eslint",
|
|
170
|
-
"jest",
|
|
171
|
-
"lefthook",
|
|
172
|
-
"release-it"
|
|
173
|
-
],
|
|
174
|
-
"version": "0.57.0"
|
|
175
162
|
}
|
|
176
163
|
}
|