Socket
Socket
Sign inDemoInstall

rn-android-sms-retriever

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    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. If the user consents, the API returns the text of the message, from which you can get the verification code and complete the verificatio


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

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. 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-android-sms-retriever

YARN:

yarn add rn-android-sms-retriever

Usage

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

// Read the next SMS
const readNextSmsRequest = async () => {
  try {
    const sms = await getSms();
  } 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); //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

Last updated on 23 Sep 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc