Gathering detailed insights and metrics for react-native-otp-verify-remastered
Gathering detailed insights and metrics for react-native-otp-verify-remastered
Gathering detailed insights and metrics for react-native-otp-verify-remastered
Gathering detailed insights and metrics for react-native-otp-verify-remastered
Verify SMS messages natively through React-Native without requiring additional permissions.
npm install react-native-otp-verify-remastered
Typescript
Module System
Node Version
NPM Version
Java (63.4%)
Objective-C (15.15%)
JavaScript (13.51%)
Ruby (3.24%)
TypeScript (2.67%)
Starlark (2.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Stars
13 Commits
1 Forks
1 Watchers
4 Branches
1 Contributors
Updated on May 06, 2024
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
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
Original Package react-native-otp-verify
Currently supported React Native version: >= 0.64.0
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.
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
npm i react-native-otp-verify-remastered
or
yarn add react-native-otp-verify-remastered
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}
This project includes an example React Native app. You can run the apps by following these steps:
cd ~
git clone git@github.com:pushpender-singh-ap/react-native-otp-verify-remastered.git
example
cd react-native-otp-verify-remastered/example
npm install
react-native run-android
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.
No vulnerabilities found.
No security vulnerabilities found.