Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-android-otp-retriever

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-android-otp-retriever

A react native wrapper for the SMS User Consent API to request user consent to read a single SMS verification message sent by any phone number or from a specific phone number if required. If the user consents, the API returns the text of the message, fro

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rn-android-sms-retriever

A react native wrapper for the SMS User Consent API to request user consent to read a single SMS verification message sent by any phone number or from a specific phone number if required. If the user consents, the API returns the text of the message, from which you can get the verification code and complete the verification process.

Installation

NPM:

npm install rn-dynamic-app-icon

YARN:

yarn add rn-dynamic-app-icon

Usage

import { getOtp, getSms, SMSRetrieverErrors } from 'rn-android-sms-retriever';

// Read the next SMS
const readNextSmsRequest = async () => {
  try {
    const sms = await getSms(/*option sender's phone number*/);
  } catch (e) {
    if (e.toString().includes(SMSRetrieverErrors.CONSENT_DENIED)) {
      console.log('User denied SMS read request');
    }
  }
};

// Read OTP from SMS
const readNextOtpRequest = async (otpLength) => {
  try {
    const sms = await getOTP(otpLength, /*optional sender's phone number*/); //Can only read numeric OTP values
  } catch (e) {
    if (e.toString().includes(SMSRetrieverErrors.REGEX_MISMATCH)) {
        readNextOtpRequest(otpLength);
    }
  }
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Built by true-hamid & mustfaibra

Keywords

FAQs

Package last updated on 30 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc