# samyak2403/firebase-otp-verifaction architecture

> Architecture diagram of the GitHub repository samyak2403/firebase-otp-verifaction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/samyak2403/firebase-otp-verifaction
- Repository: https://github.com/samyak2403/firebase-otp-verifaction

## Overview

This Android app takes a user from phone-number entry through Firebase phone verification, OTP entry or SMS auto-retrieval, and a post-verification screen. The main domain stages are sending and verifying the code; OTPReceiver is the internal SMS parsing layer. The README also documents resend and automatic retrieval. Source excerpts show these paths, but do not show an explicit request to start the SMS Retriever service, so that integration is not represented as a confirmed call.

Main entry points: [`app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt) (Verify OTP), [`app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt) (Send OTP), [`app/src/main/java/com/samyak2403/firebaseotpverifaction/OTPReceiver.kt`](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OTPReceiver.kt) (SMS Parser), [`app/src/main/java/com/samyak2403/firebaseotpverifaction/MainActivity.kt`](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/MainActivity.kt) (Main Screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Phone Authentication"]
  node_send["Send OTP<br/>[OtpSendActivity.kt]"]
  node_verify["Verify OTP"]
end

subgraph group_otp["OTP Handling"]
  node_receiver["SMS Parser<br/>[OTPReceiver.kt]"]
end

subgraph group_screens["App Screens"]
  node_main["Main Screen<br/>[MainActivity.kt]"]
end

node_user(("User"))
node_firebase{{"Firebase Authentication"}}
node_sms{{"SMS Retriever"}}

node_user -->|"enters phone"| node_send
node_send -->|"requests code"| node_firebase
node_firebase -->|"returns verification ID"| node_send
node_send -->|"opens with ID"| node_verify
node_user -->|"enters or resends"| node_verify
node_verify -->|"verifies credential"| node_firebase
node_firebase -->|"returns auth result"| node_verify
node_verify -->|"registers receiver"| node_receiver
node_sms -.->|"delivers SMS event"| node_receiver
node_receiver -->|"supplies parsed code"| node_verify
node_verify -->|"opens on success"| node_main

click node_send "https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt"
click node_verify "https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt"
click node_receiver "https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OTPReceiver.kt"
click node_main "https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/MainActivity.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_send,node_verify,node_user toneBlue
class node_receiver toneAmber
class node_main toneMint
class node_firebase,node_sms toneIndigo
```

## Components

### Phone Authentication

- [Send OTP](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt): `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`
- [Verify OTP](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt): `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`

### OTP Handling

- [SMS Parser](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/OTPReceiver.kt): `app/src/main/java/com/samyak2403/firebaseotpverifaction/OTPReceiver.kt`

### App Screens

- [Main Screen](https://github.com/samyak2403/firebase-otp-verifaction/blob/master/app/src/main/java/com/samyak2403/firebaseotpverifaction/MainActivity.kt): `app/src/main/java/com/samyak2403/firebaseotpverifaction/MainActivity.kt`

### Other components

- **User**
- **Firebase Authentication**
- **SMS Retriever**

## Connections

- User → Send OTP: enters phone (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`)
- Send OTP → Firebase Authentication: requests code (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`)
- Firebase Authentication → Send OTP: returns verification ID (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`)
- Send OTP → Verify OTP: opens with ID (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpSendActivity.kt`)
- User → Verify OTP: enters or resends (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
- Verify OTP → Firebase Authentication: verifies credential (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
- Firebase Authentication → Verify OTP: returns auth result (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
- Verify OTP → SMS Parser: registers receiver (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
- SMS Retriever → SMS Parser: delivers SMS event
- SMS Parser → Verify OTP: supplies parsed code (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
- Verify OTP → Main Screen: opens on success (evidence: `app/src/main/java/com/samyak2403/firebaseotpverifaction/OtpVerifyActivity.kt`)
