Skip to content

feat(android): add support for Firebase Phone Number Verification (PNV)#9045

Open
just1and0 wants to merge 9 commits into
mainfrom
feat/phone-number-verification
Open

feat(android): add support for Firebase Phone Number Verification (PNV)#9045
just1and0 wants to merge 9 commits into
mainfrom
feat/phone-number-verification

Conversation

@just1and0

@just1and0 just1and0 commented Jun 10, 2026

Copy link
Copy Markdown

Description

Adds a new @react-native-firebase/phone-number-verification package implementing the Firebase Phone Number Verification (PNV) SDK, which is now Generally Available.

PNV enables carrier-level phone number verification directly from the device's SIM — no SMS required. This is Android-only as the Firebase PNV SDK (com.google.firebase:firebase-pnv) has no iOS counterpart.

API:

  • enableTestSession(token) — enable SIM-less testing with a Firebase Console token
  • getVerificationSupportInfo() — check if the device's SIM supports PNV
  • getVerifiedPhoneNumber() — full verification flow (consent UI + carrier check)
  • getDigitalCredentialPayload(nonce) — for custom flows using Android Credential Manager
  • exchangeCredentialResponseForPhoneNumber(dcApiResponse) — exchange a Credential Manager JWT for a verified phone number

Both namespaced (firebase.phoneNumberVerification()) and modular APIs are supported. iOS gracefully rejects all calls with an "only supported on Android" error.

Related issues

Release Summary

Added @react-native-firebase/phone-number-verification — a new package for Firebase's Phone Number Verification (PNV) SDK. Supports carrier-level phone number verification on Android without SMS.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/**/e2e
    • jest tests added or updated in packages/**/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Tested on Android emulator via the manual test component at tests/local-tests/pnv/pnv-test.jsx:

  • App launches without crash
  • PNV test component renders with all three action buttons
  • getVerificationSupportInfo() returns successfully with [{"isSupported": false}] (expected on emulator with no SIM)
  • JS → Native bridge confirmed working end-to-end via logcat (fpnvgms: [FpnvImpl] FpnvImpl created)
Screen.Recording.2026-06-10.at.14.29.33.mov

…r Verification (PNV)

## Summary
Adds a new `@react-native-firebase/phone-number-verification` package implementing the Firebase Phone Number Verification (PNV) SDK, which is now Generally Available.

PNV enables carrier-level phone number verification directly from the device's SIM — no SMS required. This is Android-only as the Firebase PNV SDK (`com.google.firebase:firebase-pnv`) has no iOS counterpart.

### API
- `enableTestSession(token)` — enable SIM-less testing with a Firebase Console token
- `getVerificationSupportInfo()` — check if the device's SIM supports PNV
- `getVerifiedPhoneNumber()` — full verification flow (consent UI + carrier check)
- `getDigitalCredentialPayload(nonce)` — for custom flows using Android Credential Manager
- `exchangeCredentialResponseForPhoneNumber(dcApiResponse)` — exchange a Credential Manager JWT for a verified phone number

Both namespaced (`firebase.phoneNumberVerification()`) and modular (`import { getVerifiedPhoneNumber } from '@react-native-firebase/phone-number-verification'`) APIs are supported.

iOS gracefully rejects all calls with an "only supported on Android" error.

Closes #9013
@just1and0 just1and0 requested review from InvertaseBot and mikehardy and removed request for InvertaseBot June 10, 2026 13:31
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@just1and0 just1and0 changed the title feat(phone-number-verification): add support for Firebase Phone Numbe… feat(android): add support for Firebase Phone Numbe… Jun 10, 2026
@just1and0 just1and0 changed the title feat(android): add support for Firebase Phone Numbe… feat(android): add support for Firebase Phone Number Verification (PNV) Jun 10, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

Java formatting: the CI runs a formatter (google-java-format). Keep `rejectPromiseWithCodeAndMessage` calls on a single line — don't break across lines even if it's long.
e2e tests must NOT call `firebase.app()` directly — it triggers `Deprecated API usage detected while in strict mode`. Use the modular `getApp()` or module-specific getters (e.g., `getPhoneNumberVerification()`) instead.

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solid start - main things I see:

  • should be modular only
  • eliminate platforms that don't have implementations entirely, error at JS/TS layer
  • no typedoc config for the package, so yarn reference:api won't build these types out into the reference API, looking at the generated reference docs to make sure they look good should be part of the implementation loop
  • no docs.json entry for this new package, so it won't be discoverable, and no docs for it in general (README and CHANGELOG in the package itself, docs for it in the main docs tree. Should at least be a one-pager linking to the main upstream docs, embed their youtube, and show an example of how to use it from start to finish in a similar way to the upstream docs show android

Comment thread packages/phone-number-verification/ios/RNFBPnv/RNFBPnvModule.h Outdated
Comment thread packages/phone-number-verification/lib/types/namespaced.ts Outdated
Comment thread packages/phone-number-verification/lib/web/RNFBPnvModule.android.ts Outdated
Comment thread packages/phone-number-verification/lib/index.ts Outdated
Comment thread packages/phone-number-verification/lib/modular.ts Outdated
Comment thread packages/phone-number-verification/lib/modular.ts
Comment thread tests/local-tests/index.js
@mikehardy mikehardy removed the request for review from InvertaseBot June 10, 2026 22:25
@mikehardy

Copy link
Copy Markdown
Collaborator

Two other notes

  • Looks like you need to sign the CLA with a user that has the same email associated with it in github as was used in your commits
  • Can you run the test app on a real phone? I don't think there is any proper way to test this except with a real phone - the test app should be connected to a project where PNV will work...I think

- Remove namespaced API (lib/namespaced.ts, types/namespaced.ts, types/internal.ts)
- Remove iOS native stubs (ios/, RNFBPnv.podspec)
- Remove web fallback stubs (lib/web/)
- Add react-native.config.js with ios: null to disable iOS autolinking
- Rewrite modular.ts to call native module directly via getReactNativeModule
- Add Platform.OS guard with clear error for non-Android
- Remove phoneNumberVerification from KNOWN_NAMESPACES
- Update e2e and local tests for standalone modular API
Adds documentation and discoverability for the phone-number-verification package per review feedback.

- Add typedoc.json with entry points for API reference generation
- Add package to root typedoc.json so `yarn reference:api` includes it
- Add sidebar entry in docs.json for docs site navigation
- Add docs page with installation, usage examples, testing, and platform handling
- Update navigation chain (perf -> pnv -> vertexai)
- Add README.md with standard badges and package description
- Add CHANGELOG.md with initial entry

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really quick turn and handled all the code feedback, awesome

  • Bit more of a thought on constraining the API to modular-only
  • Thought on augmenting the doc just a touch
  • Looks like CLA is still blocked
  • Any results from an attempt to run the e2e app on real device? or are you iOS only locally? I can use a phone I have as a test sled if needed - I have an android with valid SIM
  • PR description no longer matches the implementation

Comment thread docs/phone-number-verification/usage/index.mdx Outdated
Comment thread docs/phone-number-verification/usage/index.mdx
Comment thread packages/phone-number-verification/e2e/pnv.e2e.js Outdated
Comment thread packages/phone-number-verification/lib/modular.ts
Comment thread packages/phone-number-verification/lib/modular.ts Outdated
Comment thread packages/phone-number-verification/CHANGELOG.md Outdated
Comment thread packages/phone-number-verification/react-native.config.js
Comment thread packages/phone-number-verification/typedoc.json
@just1and0

Copy link
Copy Markdown
Author

I actually don't have a physical Android device to test it, I planned on popping out in a bit to go buy a small Android device to test. I'd be happy if you can help on this one so not to delay the work.

Thanks in advance 😁

Really quick turn and handled all the code feedback, awesome

  • Bit more of a thought on constraining the API to modular-only

  • Thought on augmenting the doc just a touch

  • Looks like CLA is still blocked

  • Any results from an attempt to run the e2e app on real device? or are you iOS only locally? I can use a phone I have as a test sled if needed - I have an android with valid SIM

  • PR description no longer matches the implementation

- Remove getPhoneNumberVerification() convenience wrapper per modular-only API guidance
- Remove PhoneNumberVerification interface from types
- Rename e2e "iOS unsupported" to "only Android supported" and add Other platform test
- Remove YouTube embed from docs (invalid video ID)
- Add consent info to docs for getVerifiedPhoneNumber()
- Remove convenience object section from docs
- Clear CHANGELOG.md to stub for release automation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Firebase Phone Number Verification as it is generally available now

3 participants