feat(android): add support for Firebase Phone Number Verification (PNV)#9045
feat(android): add support for Firebase Phone Number Verification (PNV)#9045just1and0 wants to merge 9 commits into
Conversation
…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
|
|
|
Warning Gemini encountered an error creating the summary. You can try again by commenting |
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.
There was a problem hiding this comment.
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:apiwon'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
-
- looks like there may be a good icon for PNV (e.g. https://www.gstatic.com/mobilesdk/251124_mobilesdk/fpnv-image.png - this one is close but I bet they have one without the mobile on bottom right - we have been referencing the docs from static.invertase.io which probably doesn't have one, but a sidequest to update the icons there with fresh svgs and then reference the PNV one would be more professional if it were possible - you can see google has a suite of icons on this page https://firebase.google.com/products-build)
|
Two other notes
|
- 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
There was a problem hiding this comment.
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
|
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 😁
|
- 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
Description
Adds a new
@react-native-firebase/phone-number-verificationpackage 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 tokengetVerificationSupportInfo()— check if the device's SIM supports PNVgetVerifiedPhoneNumber()— full verification flow (consent UI + carrier check)getDigitalCredentialPayload(nonce)— for custom flows using Android Credential ManagerexchangeCredentialResponseForPhoneNumber(dcApiResponse)— exchange a Credential Manager JWT for a verified phone numberBoth 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
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/**/e2ejesttests added or updated inpackages/**/__tests__Test Plan
Tested on Android emulator via the manual test component at
tests/local-tests/pnv/pnv-test.jsx:getVerificationSupportInfo()returns successfully with[{"isSupported": false}](expected on emulator with no SIM)fpnvgms: [FpnvImpl] FpnvImpl created)Screen.Recording.2026-06-10.at.14.29.33.mov