Verify SMS messages natively through React-Native without requiring additional permissions.
Installations
npm install react-native-otp-verify-remastered
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
12.22.12
NPM Version
6.14.16
Releases
Contributors
Unable to fetch Contributors
Languages
Java (63.4%)
Objective-C (15.15%)
JavaScript (13.51%)
Ruby (3.24%)
TypeScript (2.67%)
Starlark (2.03%)
Developer
Download Statistics
Total Downloads
4,111
Last Day
1
Last Week
3
Last Month
25
Last Year
662
GitHub Statistics
6 Stars
13 Commits
1 Forks
1 Watching
4 Branches
1 Contributors
Bundle Size
637.00 B
Minified
365.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.1.0
Package Id
react-native-otp-verify-remastered@1.1.0
Unpacked Size
258.20 kB
Size
158.50 kB
File Count
77
NPM Version
6.14.16
Node Version
12.22.12
Total Downloads
Cumulative downloads
Total Downloads
4,111
Last day
0%
1
Compared to previous day
Last week
-72.7%
3
Compared to previous week
Last month
19%
25
Compared to previous month
Last year
-55.7%
662
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
2
react-native-otp-verify-remastered
Due to the lack of response from the maintenance team, I am deploying my own package for my projects. If you'd like to use this package, feel free to do so.
Original Package react-native-otp-verify
Currently supported React Native version: >= 0.64.0
react-native-otp-verify-remastered
The SMS Retriever API is used in Automatic SMS Verification. You can use the API to automatically verify users' identities through SMS, without requiring them to type verification codes manually or requiring them to grant additional permissions to your app.
Message Format/Structure
In order to detect the message, a hash that identifies your application must be included in the SMS. Below, you can find this hash by using the getHash() method.
For more information on the message structure, consult the official documentation here. Google developer guide
Getting started
npm i react-native-otp-verify-remastered
or
yarn add react-native-otp-verify-remastered
Usage
1import RNOtpVerify from 'react-native-otp-verify-remastered'; 2 3 4// THIS PACKAGE ONLY FOR ANDROID 5 6getHash = () => 7 RNOtpVerify.getHash() 8 .then(console.log) 9 .catch(console.log); 10 11startListeningForOtp = () => 12 RNOtpVerify.getOtp() 13 .then(p => RNOtpVerify.addListener(this.otpHandler)) 14 .catch(p => console.log(p)); 15 16otpHandler = (message: string) => { 17 const otp = /(\d{4})/g.exec(message)[1]; 18 this.setState({ otp }); 19 RNOtpVerify.removeListener(); 20 Keyboard.dismiss(); 21} 22 23getMobilehint = () => { 24 RNOtpVerify.requestHint() 25 .then((h) => console.log(h)) 26 .catch((e) => console.log(e)); 27} 28 29componentWillUnmount() { 30 RNOtpVerify.removeListener(); 31}
Example React Native App
This project includes an example React Native app. You can run the apps by following these steps:
- Clone the repository
cd ~
git clone git@github.com:pushpender-singh-ap/react-native-otp-verify-remastered.git
- cd to
example
cd react-native-otp-verify-remastered/example
- Install dependencies
npm install
- Run the apps:
Run the Android app
react-native run-android
Methods
getOtp():Promise<boolean>
Start listening for OTP/SMS. Return true if listener starts else throws error.
getOtp():Promise<boolean>
Start listening for OTP/SMS. Return true if listener starts else throws error.
getHash():Promise<string[]>
Gets the hash code for the application which should be added at the end of message. This is just a one time process.
requestHint():Promise<string[]>
This method is part of sms retreiver api and its show available phone number list.
addListener(handler:(message:string)=>any):Promise<boolean>
Adds a javascript listener to the handler passed which is called when message is received.
removeListener():void
Removes the listener.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No security vulnerabilities found.