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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-nitro-sms-user-consent

v0.1.1

Published

react-native-nitro-sms-user-consent — Android SMS User Consent API (one-tap OTP reading) for React Native, built with Nitro

Readme

react-native-nitro-sms-user-consent

One-tap OTP reading on Android with Google's SMS User Consent API, built on Nitro Modules. No app hash, no SMS permissions.

Version Downloads License


Features

  • 📩 Reads the OTP SMS after a one-tap user consent on Android
  • 🔓 No app hash in the SMS template, and no READ_SMS/RECEIVE_SMS permissions
  • ⚡ Built with Nitro Modules: no bridge overhead
  • 🪝 Drop-in useOtpVerify hook (same shape as react-native-nitro-otp-verify)
  • ⏱️ Reports allow, deny, timeout and error outcomes
  • 🍎 iOS-safe: no-op on iOS, where the system autofill handles OTPs

Requirements

| | Minimum | | ---------------------------- | ------------------------ | | React Native | 0.76.0 (New Architecture) | | Android | API 23+ with Google Play services | | react-native-nitro-modules | 0.35.0+ |


Installation

npm install react-native-nitro-sms-user-consent react-native-nitro-modules
# or
bun add react-native-nitro-sms-user-consent react-native-nitro-modules

No extra setup is needed. The Play services dependency is included automatically.


Usage

import { useOtpVerify } from 'react-native-nitro-sms-user-consent'

export default function OtpScreen() {
  const { otp, denied, timeoutError, startListener } = useOtpVerify({
    numberOfDigits: 6,
  })

  useEffect(() => {
    if (otp) submitCode(otp)
  }, [otp])

  // Render your own OTP input. Pass `otp` into it when it arrives.
  // Show a "Try again" button that calls startListener() when `denied`/`timeoutError`.
}

How it works

  1. On mount, the hook starts a 5-minute SMS User Consent session.
  2. When an SMS with a code arrives, Google Play services shows a bottom sheet: "Allow <App> to read the message below and enter the code?"
  3. If the user taps Allow, the full SMS text is returned and the code is extracted into otp.
  4. One message per session. After allow, deny or timeout the session ends. Call startListener() to listen again.

If the SMS arrives while the app is in the background, the consent sheet opens when the user returns to the app.

Hook API

const {
  otp,          // string | null: extracted code
  message,      // string | null: full SMS text
  denied,       // boolean: user tapped "Deny"
  timeoutError, // boolean: no SMS within 5 minutes
  error,        // string | null: e.g. no Play services
  isSupported,  // boolean: false on iOS / without Play services
  isListening,  // boolean
  startListener,
  stopListener,
  hash,         // always null: kept for migration, deprecated
} = useOtpVerify({
  numberOfDigits: 6,           // length of the code to extract (default 6)
  senderPhoneNumber: '+94...', // only accept SMS from this sender (optional)
  autoStart: true,             // start on mount (default true)
  extractOtp: (sms) => ...,    // custom extraction (optional)
})

Module API

import { NitroSmsUserConsent } from 'react-native-nitro-sms-user-consent'

NitroSmsUserConsent.isSupported // boolean

await NitroSmsUserConsent.startOtpListener((event) => {
  // event.status: 'received' | 'denied' | 'timeout' | 'error'
  // event.message: full SMS text when 'received'
  // event.error: reason when 'error'
}, senderPhoneNumber /* optional */)

await NitroSmsUserConsent.stopOtpListener() // safe to call any time

SMS requirements

The consent sheet is shown only if the SMS:

  • contains a 4–10 character alphanumeric code with at least one digit;
  • comes from a sender not in the user's contacts;
  • matches senderPhoneNumber, if you set it.
Your verification code is 123456

No app hash is needed.


iOS

iOS has no API for apps to read SMS. The system detects the code itself and offers it above the keyboard. Enable it on your own OTP input:

<TextInput
  textContentType="oneTimeCode"
  autoComplete={Platform.OS === 'android' ? 'sms-otp' : 'one-time-code'}
  keyboardType="number-pad"
/>

Optionally end the SMS with a domain-bound code line so iOS only offers it on your domain:

Your verification code is 123456

@yourdomain.com #123456

On iOS the hook is a no-op (isSupported: false), so the same screen code runs on both platforms.


Migrating from react-native-nitro-otp-verify

  1. Swap the package and the import:
    - import { useOtpVerify } from 'react-native-nitro-otp-verify'
    + import { useOtpVerify } from 'react-native-nitro-sms-user-consent'
  2. Remove the 11-character app hash from your SMS template. hash is now always null.
  3. Handle denied: the user can decline the consent sheet. Offer a retry with startListener().
  4. Remember that each session reads one message. Call startListener() again for "Resend code".

Permissions

None. Google Play services reads the SMS, and the app only receives the message the user approves. The library's broadcast receiver is protected by com.google.android.gms.auth.api.phone.permission.SEND, so only Play services can deliver to it.


Platform Support

| Platform | Status | | -------- | ---------------------------------------------- | | Android | ✅ SMS User Consent API | | iOS | ✅ Safe no-op; use textContentType="oneTimeCode" |


AI agent skill

skills/react-native-nitro-sms-user-consent is an agent skill (Claude Code and other SKILL.md-compatible agents). It covers the hook, the SMS format, iOS autofill, migrating from otp-verify, and troubleshooting. To install it, copy or symlink the folder into ~/.claude/skills/:

npx degit hexhad/react-native-nitro-sms-user-consent/skills/react-native-nitro-sms-user-consent ~/.claude/skills/react-native-nitro-sms-user-consent

Credits

Bootstrapped with create-nitro-module.


License

MIT