# funduck386/cipher architecture

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

- Interactive diagram: https://gitdiagram.com/funduck386/cipher
- Repository: https://github.com/funduck386/cipher

## Overview

CIPHER appears to be an Android encrypted-messaging app, with screens for login, inbox, composing and chatting, plus key requests. The tree also shows cryptography, message/key data types, and a Supabase client provider. No README or application-source excerpts were provided, so the workflow links below are dashed and unverified; they reflect likely screen and component responsibilities, not inspected call paths.

Main entry points: [`app/src/main/java/com/example/cipher/MainActivity.kt`](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MainActivity.kt) (Main screen), [`app/src/main/java/com/example/cipher/InboxActivity.kt`](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/InboxActivity.kt) (Inbox), [`app/src/main/java/com/example/cipher/ComposeMessageActivity.kt`](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ComposeMessageActivity.kt) (Compose message), [`app/src/main/java/com/example/cipher/ChatActivity.kt`](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatActivity.kt) (Chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screens["Messaging screens"]
  node_main["Main screen<br/>[MainActivity.kt]"]
  node_login["Login<br/>[LoginActivity.kt]"]
  node_inbox["Inbox<br/>[InboxActivity.kt]"]
  node_compose["Compose message"]
  node_chat["Chat<br/>[ChatActivity.kt]"]
  node_sent["Sent confirmation"]
  node_keyrequests["Key requests"]
  node_messageadapter["Message list adapter<br/>[MessageAdapter.kt]"]
  node_chatadapter["Chat adapter<br/>[ChatAdapter.kt]"]
  node_keyadapter["Key request adapter"]
end

subgraph group_data["Message and key data"]
  node_message["Message record<br/>[MessageRecord.kt]"]
  node_chatmessage["Chat message<br/>[ChatMessage.kt]"]
  node_encryptedmessage["Encrypted message"]
  node_contact["Contact<br/>[Contact.kt]"]
  node_keyrequest["Key request<br/>[KeyRequest.kt]"]
  node_publickey["Public key record<br/>[PublicKeyRecord.kt]"]
end

subgraph group_security["Crypto and backend"]
  node_encryption["Encryption helper"]
  node_payload["Encrypted payload"]
  node_keymanager["Key manager<br/>[KeyManager.kt]"]
  node_supabaseprovider["Supabase provider"]
end

node_user(("User"))
node_supabase[("Supabase")]

node_user -.->|"opens"| node_main
node_main -.->|"offers login"| node_login
node_main -.->|"opens inbox"| node_inbox
node_inbox -.->|"starts composing"| node_compose
node_inbox -.->|"opens chat"| node_chat
node_compose -.->|"encrypts"| node_encryption
node_encryption -.->|"produces"| node_payload
node_compose -.->|"shows confirmation"| node_sent
node_chat -.->|"decrypts"| node_encryption
node_chat -.->|"displays messages"| node_chatadapter
node_inbox -.->|"displays messages"| node_messageadapter
node_main -.->|"opens requests"| node_keyrequests
node_keyrequests -.->|"displays requests"| node_keyadapter
node_keymanager -.->|"manages keys"| node_publickey
node_supabaseprovider -.->|"connects to"| node_supabase

click node_main "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MainActivity.kt"
click node_login "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/LoginActivity.kt"
click node_inbox "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/InboxActivity.kt"
click node_compose "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ComposeMessageActivity.kt"
click node_chat "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatActivity.kt"
click node_sent "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageSentActivity.kt"
click node_keyrequests "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequestsActivity.kt"
click node_messageadapter "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageAdapter.kt"
click node_chatadapter "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatAdapter.kt"
click node_keyadapter "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequestAdapter.kt"
click node_message "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageRecord.kt"
click node_chatmessage "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatMessage.kt"
click node_encryptedmessage "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/EncryptedMessage.kt"
click node_contact "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/Contact.kt"
click node_keyrequest "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequest.kt"
click node_publickey "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/PublicKeyRecord.kt"
click node_encryption "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/EncryptionHelper.kt"
click node_payload "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/EncryptedPayload.kt"
click node_keymanager "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/KeyManager.kt"
click node_supabaseprovider "https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/SupabaseClientProvider.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_main,node_login,node_inbox,node_compose,node_chat,node_sent,node_keyrequests,node_messageadapter,node_chatadapter,node_keyadapter,node_user toneBlue
class node_message,node_chatmessage,node_encryptedmessage,node_contact,node_keyrequest,node_publickey,node_supabase toneAmber
class node_encryption,node_payload,node_keymanager,node_supabaseprovider toneMint
```

## Components

### Messaging screens

- [Main screen](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MainActivity.kt): `app/src/main/java/com/example/cipher/MainActivity.kt`
- [Login](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/LoginActivity.kt): `app/src/main/java/com/example/cipher/LoginActivity.kt`
- [Inbox](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/InboxActivity.kt): `app/src/main/java/com/example/cipher/InboxActivity.kt`
- [Compose message](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ComposeMessageActivity.kt): `app/src/main/java/com/example/cipher/ComposeMessageActivity.kt`
- [Chat](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatActivity.kt): `app/src/main/java/com/example/cipher/ChatActivity.kt`
- [Sent confirmation](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageSentActivity.kt): `app/src/main/java/com/example/cipher/MessageSentActivity.kt`
- [Key requests](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequestsActivity.kt): `app/src/main/java/com/example/cipher/KeyRequestsActivity.kt`
- [Message list adapter](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageAdapter.kt): `app/src/main/java/com/example/cipher/MessageAdapter.kt`
- [Chat adapter](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatAdapter.kt): `app/src/main/java/com/example/cipher/ChatAdapter.kt`
- [Key request adapter](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequestAdapter.kt): `app/src/main/java/com/example/cipher/KeyRequestAdapter.kt`

### Message and key data

- [Message record](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/MessageRecord.kt): `app/src/main/java/com/example/cipher/MessageRecord.kt`
- [Chat message](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/ChatMessage.kt): `app/src/main/java/com/example/cipher/ChatMessage.kt`
- [Encrypted message](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/EncryptedMessage.kt): `app/src/main/java/com/example/cipher/EncryptedMessage.kt`
- [Contact](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/Contact.kt): `app/src/main/java/com/example/cipher/Contact.kt`
- [Key request](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/KeyRequest.kt): `app/src/main/java/com/example/cipher/KeyRequest.kt`
- [Public key record](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/PublicKeyRecord.kt): `app/src/main/java/com/example/cipher/PublicKeyRecord.kt`

### Crypto and backend

- [Encryption helper](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/EncryptionHelper.kt): `app/src/main/java/com/example/cipher/crypto/EncryptionHelper.kt`
- [Encrypted payload](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/EncryptedPayload.kt): `app/src/main/java/com/example/cipher/crypto/EncryptedPayload.kt`
- [Key manager](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/crypto/KeyManager.kt): `app/src/main/java/com/example/cipher/crypto/KeyManager.kt`
- [Supabase provider](https://github.com/funduck386/cipher/blob/main/app/src/main/java/com/example/cipher/SupabaseClientProvider.kt): `app/src/main/java/com/example/cipher/SupabaseClientProvider.kt`

### Other components

- **User**
- **Supabase**

## Connections

- User → Main screen: opens
- Main screen → Login: offers login
- Main screen → Inbox: opens inbox
- Inbox → Compose message: starts composing
- Inbox → Chat: opens chat
- Compose message → Encryption helper: encrypts
- Encryption helper → Encrypted payload: produces
- Compose message → Sent confirmation: shows confirmation
- Chat → Encryption helper: decrypts
- Chat → Chat adapter: displays messages
- Inbox → Message list adapter: displays messages
- Main screen → Key requests: opens requests
- Key requests → Key request adapter: displays requests
- Key manager → Public key record: manages keys
- Supabase provider → Supabase: connects to
