npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-otp-verify-remastered

v1.1.0

Published

Verify SMS messages natively through React-Native without requiring additional permissions.

Downloads

171

Readme

react-native-otp-verify-remastered

Test publish GitHub license GitHub issues PR's Welcome GitHub pull-requests GitHub contributors NPM Version GitHub last commit

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

import RNOtpVerify from 'react-native-otp-verify-remastered';


// THIS PACKAGE ONLY FOR ANDROID

getHash = () =>
    RNOtpVerify.getHash()
    .then(console.log)
    .catch(console.log);

startListeningForOtp = () =>
    RNOtpVerify.getOtp()
    .then(p => RNOtpVerify.addListener(this.otpHandler))
    .catch(p => console.log(p));

otpHandler = (message: string) => {
        const otp = /(\d{4})/g.exec(message)[1];
        this.setState({ otp });
        RNOtpVerify.removeListener();
        Keyboard.dismiss();
}

getMobilehint = () => {
    RNOtpVerify.requestHint()
    .then((h) => console.log(h))
    .catch((e) => console.log(e));
}

componentWillUnmount() {
    RNOtpVerify.removeListener();
}

Example React Native App

This project includes an example React Native app. You can run the apps by following these steps:

  1. Clone the repository
cd ~
git clone [email protected]:pushpender-singh-ap/react-native-otp-verify-remastered.git
  1. cd to example
cd react-native-otp-verify-remastered/example
  1. Install dependencies
npm install
  1. 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.