CodexGuild
skills/ android/skills

phone-number-verification

Verify user phone numbers without SMS in an Android app using the Credential

Installs
New
Files scanned
3
Scan passedmethodology
Source on GitHub

Security scan

Scan passed

No risky patterns were found in the scanned files.

3 files scannedscanner v1.4.0Nov 23, 2026

Content sha256 2d56ba9dfecdeb8b… — run codexguild_scan_skills after installing to verify your local copy.

Static analysis is a first line of defense, not a guarantee. Read the source

SKILL.md

exact scanned copy

Implement phishing-resistant, SMS-free phone number verification in an Android app using Credential Manager's DigitalCredential API to request an encrypted, carrier-issued TS.43 token over OpenID4VP and exchange it with an aggregator or mobile carrier backend for the verified phone number. When reviewing TS.43 architecture and security standards, consult About verifying phone numbers. When implementing client and server code snippets, consult Implement phone number verification. When verifying general mso_mdoc or dc+sd-jwt wallet credentials, suggest the credential-verifier skill.

Prerequisites and setup

  • Android version compatibility: Runtime support for the Phone Number Verification API requires Android 10 (API level 29) or higher (while the androidx.credentials library compiles with minSdk 23 or higher).
  • Aggregator account: Requires an account with a mobile carrier or cellular aggregator endpoint that supplies DCQL parameters and exchanges TS.43 tokens.
  • Manifest permission for carrier precheck: Declare <uses-permission android:name="android.permission.READ_PHONE_STATE" /> in app/src/main/AndroidManifest.xml to query TelephonyManager.getSimCarrierId() before invoking Credential Manager.
  • Build config permission: Ask for user confirmation before modifying settings.gradle.kts, root build.gradle.kts, or gradle/libs.versions.toml, unless already requested by the user or running non-interactively.
  • Dependencies and package mapping: Add the Credential Manager artifacts to the app module build script (app/build.gradle.kts or app/build.gradle; when checking the latest version declarations, consult Implement phone number verification):
ArtifactKey classes, constructor signatures, and package
androidx.credentials:credentials:1.7.0-alpha03 (or 1.6.0+)CredentialManager, GetCredentialRequest, GetCredentialResponse, GetDigitalCredentialOption(requestJson: String), DigitalCredential, and ExperimentalDigitalCredentialApi in androidx.credentials; GetCredentialException, GetCredentialCancellationException, GetCredentialInterruptedException, GetCredentialUnsupportedException, and NoCredentialException in androidx.credentials.exceptions
androidx.credentials:credentials-play-services-auth:1.7.0-alpha03 (or 1.6.0+)Play services provider integration for Credential Manager

Expected inputs and file scope

  • Required inputs: Whether the app is retrieving the device phone number (number-verification/device-phone-number/ts43) or verifying an existing user-entered phone number (number-verification/verify/ts43), whether dual SIM (subscription_hint) or biometric/screen-lock verification (user_verification_hint) is needed, and the fallback verification flow when the carrier or device is unsupported.
  • Files to modify: app/build.gradle.kts, app/src/main/AndroidManifest.xml (for READ_PHONE_STATE), phone number verification client or repository classes, ViewModels, and UI screens or Activity classes (such as MainActivity.kt).
  • Forbidden substitutions: Don't use TelephonyManager.getLine1Number(), READ_PHONE_NUMBERS, SmsRetriever, or SMS OTP APIs as a substitute for the Credential Manager DigitalCredential TS.43 verification flow (only use TelephonyManager.getSimCarrierId() for the carrier support precheck, and fall back to SMS only when the carrier or device is unsupported).

Codebase exploration

Search the Android project before modifying files:

  1. Validate baseline build and inspect configuration: Run ./gradlew assembleDebug to confirm the project compiles before making changes, check app/build.gradle.kts and gradle/libs.versions.toml for minSdk and androidx.credentials dependencies, and check app/src/main/AndroidManifest.xml for READ_PHONE_STATE.
  2. Locate UI entry points: Identify the Activity or Compose screen (such as MainActivity.kt or TasksScreen.kt) where phone number verification is triggered so you pass an Activity Context to credentialManager.getCredential().

Critical implementation mandates

Follow the end-to-end steps and code snippets in Implement phone number verification and apply these rules:

  • Opt in to experimental APIs: Annotate classes or functions referencing GetDigitalCredentialOption and DigitalCredential with @OptIn(androidx.credentials.ExperimentalDigitalCredentialApi::class) (omitted from the Kotlin snippet in Implement phone number verification).
  • Perform the carrier TS.43 precheck and handle unsupported fallbacks: Declare READ_PHONE_STATE in AndroidManifest.xml, query telephonyManager.getSimCarrierId(), and check whether the user's carrier supports TS.43 with the app's aggregator backend before calling credentialManager.getCredential(). If the carrier is unsupported, or if the device runs below Android 10 (API level 29) or throws GetCredentialUnsupportedException or GetCredentialCancellationException, trigger a fallback verification flow (such as SMS).
  • Configure DCQL parameters and optional hints: In each { ... } credential entry inside requests[0].data.dcql_query.credentials (with "protocol": "openid4vp-v1-unsigned", "response_type": "vp_token", "response_mode": "dc_api", and a "nonce" matching the aggregator DCQL request):
    • Set "format": "dc-authorization+sd-jwt" and include meta.credential_authorization_jwt from the aggregator.
    • Set meta.vct_values to ["number-verification/device-phone-number/ts43"] to retrieve the device phone number, or ["number-verification/verify/ts43"] (with {"path": ["phone_number_hint"], "values": [...]} in claims) to verify an existing phone number.
    • Include {"path": ["subscription_hint"], "values": [...]} in claims when targeting a specific SIM subscription slot, and {"path": ["user_verification_hint"]} when requiring biometric or screen-lock authentication (which returns "user_verification_hint" as "success", "absent", or "error" in the response payload, or throws GetCredentialCancellationException if the user dismisses the prompt).
  • Avoid syntax pitfalls in the reference server snippets: When referencing the backend examples in Implement phone number verification, note that the Python GenerateDCRequest snippet contains a Kotlin-style val dc_request = typo, the response JSON example includes # comments, and the error JSON example has a trailing comma; strip those invalid tokens when writing JSON or backend code, check data.error (invalid_request or server_error) first, and index the encrypted token from data.vp_token[<aggregator_id>][0].

Troubleshooting

SymptomCauseFix
Experimental API compilation errorGetDigitalCredentialOption and DigitalCredential require @ExperimentalDigitalCredentialApiAdd @OptIn(androidx.credentials.ExperimentalDigitalCredentialApi::class) to the calling class or function.
Empty result or GetCredentialCancellationExceptionUser canceled (including dismissing biometric user_verification_hint), feature unavailable, or SIM carrier does not support TS.43Run the TelephonyManager.getSimCarrierId() precheck before calling getCredential() and fall back to an alternate flow when unsupported.
GetCredentialUnsupportedException thrownDevice or OS version does not support the Phone Number Verification API (requires Android 10, API 29+)Check Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q and handle GetCredentialUnsupportedException with a fallback flow.
Response JSON contains "error": "invalid_request"Malformed OpenID4VP or DCQL request JSON or mismatched nonceVerify protocol is openid4vp-v1-unsigned, format is dc-authorization+sd-jwt, credentials is a JSON array of { ... } objects, and the outer nonce matches the aggregator DCQL nonce.

Verification and reporting guidelines

  • [ ] Run ./gradlew assembleDebug to verify the project compiles without errors.
  • [ ] Verify app/build.gradle.kts includes androidx.credentials:credentials and androidx.credentials:credentials-play-services-auth.
  • [ ] Verify app/src/main/AndroidManifest.xml declares READ_PHONE_STATE and the client performs the TelephonyManager.getSimCarrierId() carrier precheck with a fallback when unsupported.
  • [ ] Verify the OpenID4VP request uses "protocol": "openid4vp-v1-unsigned", "format": "dc-authorization+sd-jwt", and "number-verification/device-phone-number/ts43" or "number-verification/verify/ts43".
  • [ ] Verify GetDigitalCredentialOption, GetCredentialRequest, credentialManager.getCredential(), and DigitalCredential are used with @OptIn(androidx.credentials.ExperimentalDigitalCredentialApi::class).

Post-implementation warnings for the human developer

Present these backend reminders after completing client-side changes:

  1. Aggregator DCQL and token exchange: Configure the app's backend service to verify carrier IDs from getSimCarrierId(), request live DCQL parameters (credential_authorization_jwt) from one or more carrier aggregators using a matching nonce, and exchange the returned TS.43 Digital Credential from data.vp_token[<aggregator_id>][0] for the verified phone number.
  2. Backend SD-JWT VC validation: Validate the nonce, Android Telephony issuer signature, issue time (iat), and expiration time (exp) of the returned ts43_digital_credential on the app's backend server.

Antipatterns

  • NEVER use TelephonyManager.getLine1Number(), READ_PHONE_NUMBERS, SmsRetriever, or SMS OTP flows as a substitute for Credential Manager's DigitalCredential API (GetDigitalCredentialOption and credentialManager.getCredential()) when implementing digital credential phone number verification.
  • NEVER skip the TelephonyManager.getSimCarrierId() carrier precheck before calling credentialManager.getCredential().
  • NEVER attempt to decrypt the encrypted TS.43 Digital Credential on the Android client; only the associated aggregator decrypts the payload.
  • NEVER mismatch the nonce in the OpenID4VP request data object and the nonce sent to the aggregator when generating the DCQL credential object.

Best practices

  • MUST annotate classes or functions using GetDigitalCredentialOption and DigitalCredential with @OptIn(androidx.credentials.ExperimentalDigitalCredentialApi::class).
  • MUST declare READ_PHONE_STATE and call telephonyManager.getSimCarrierId() to verify carrier TS.43 support before invoking Credential Manager, falling back to an alternate verification flow when unsupported.
  • MUST check both GetCredentialException (GetCredentialCancellationException and GetCredentialUnsupportedException) and OpenID4VP error JSON payloads (invalid_request and server_error).
  • MUST use number-verification/device-phone-number/ts43 to retrieve a device phone number and number-verification/verify/ts43 to verify an existing phone number.

Files

3
30.0 KB

Agent reviews

0

No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.

More from android/skills8

Related methodology skillsscan passed

playwright-expert

Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms:

Scan passed 12.2K 1
document-generate

Generate missing documentation from scratch for a feature, module, or entire project. Use for: write docs for this, generate documentation. (gstack)

Scan passed 140.4KNew
huggingface-paper-publisher

Publish and manage research papers on Hugging Face Hub. Supports creating paper pages, linking papers to models/datasets, claiming authorship, and generating professional markdown-based research articles.

Scan passed 11.2KNew
debugging-lambda-timeouts

Debugs AWS Lambda function timeout failures by systematically analyzing function configuration, CloudWatch logs and metrics, VPC/networking, cold starts, memory constraints, and downstream dependencies to identify root causes with actionable fixes. Use when a Lambda function is timing out or approac

Scan passed 3.4KNew
claude-automation-recommender

Analyze a codebase and recommend Claude Code automations (hooks, subagents, skills, plugins, MCP servers). Use when user asks for automation recommendations, wants to optimize their Claude Code setup, mentions improving Claude Code workflows, asks how to first set up Claude Code for a project, or wa

Scan passed 46.2KNew
python-anti-patterns

Use this skill when reviewing Python code for common anti-patterns to avoid. Use as a checklist when reviewing code, before finalizing implementations, or when debugging issues that might stem from known bad practices.

Scan passed 42.2KNew