# sudo-anu/deep-sheild architecture

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

- Interactive diagram: https://gitdiagram.com/sudo-anu/deep-sheild
- Repository: https://github.com/sudo-anu/deep-sheild

## Overview

DeepShield is a privacy-first Chrome extension that analyzes webpage video and audio locally, then presents per-modality confidence and a combined risk indicator. The main workflow runs from webpage media capture through the background message bridge to offscreen ONNX inference and back to the in-page and popup interfaces. The graph also preserves the model/runtime and session-state roles. Some links are documented in the README rather than visible in the partial source excerpts; unsampled implementation details are not inferred.

Main entry points: [`extension-root/background.js`](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js) (Message bridge), [`extension-root/offscreen/offscreen.js`](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js) (Offscreen processor), [`extension-root/content/content.js`](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js) (Video capture), [`extension-root/assets/deepfake_efficientnet_b0_int8.onnx`](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/assets/deepfake_efficientnet_b0_int8.onnx) (Video model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Media capture"]
  node_video_capture["Video capture<br/>[content.js]"]
  node_audio_capture["Audio capture<br/>[content.js]"]
end

subgraph group_inference["Local inference"]
  node_offscreen["Offscreen processor<br/>[offscreen.js]"]
  node_video_preprocess["Frame preprocessing<br/>[offscreen.js]"]
  node_video_model["Video model"]
  node_audio_preprocess["Audio features<br/>[offscreen.js]"]
  node_audio_model["Audio model"]
  node_onnx_runtime["ONNX Runtime"]
end

subgraph group_coordination["Extension coordination"]
  node_background["Message bridge<br/>[background.js]"]
  node_session_state[("Tab session state<br/>[background.js]")]
  node_score_merge["Score merge<br/>[background.js]"]
end

subgraph group_interfaces["User interfaces"]
  node_traffic_light["Page indicator<br/>[content.js]"]
  node_popup["Results popup<br/>[popup.js]"]
end

node_webpage(("Webpage media"))

node_webpage -->|"provides frames"| node_video_capture
node_webpage -->|"provides audio"| node_audio_capture
node_video_capture -->|"requests capture"| node_background
node_background -->|"forwards screenshot"| node_offscreen
node_offscreen -->|"decodes frame"| node_video_preprocess
node_video_preprocess -->|"prepares input"| node_video_model
node_offscreen -->|"runs inference"| node_onnx_runtime
node_video_model -->|"returns score"| node_offscreen
node_audio_capture -->|"sends samples"| node_background
node_background -->|"forwards samples"| node_offscreen
node_offscreen -->|"resamples audio"| node_audio_preprocess
node_audio_preprocess -->|"creates tensor"| node_audio_model
node_audio_model -->|"returns score"| node_offscreen
node_offscreen -->|"reports results"| node_background
node_background -->|"merges scores"| node_score_merge
node_background -->|"stores scores"| node_session_state
node_background -->|"sends updates"| node_traffic_light
node_background -->|"broadcasts updates"| node_popup
node_popup -->|"queries status"| node_background
node_video_capture -->|"renders indicator"| node_traffic_light

click node_video_capture "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js"
click node_audio_capture "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js"
click node_background "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js"
click node_offscreen "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js"
click node_video_preprocess "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js"
click node_video_model "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/assets/deepfake_efficientnet_b0_int8.onnx"
click node_audio_preprocess "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js"
click node_audio_model "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/assets/audio_clone_detector.onnx"
click node_onnx_runtime "https://github.com/sudo-anu/deep-sheild/tree/main/extension-root/lib"
click node_session_state "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js"
click node_score_merge "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js"
click node_traffic_light "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js"
click node_popup "https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/popup/popup.js"

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_video_capture,node_audio_capture toneBlue
class node_offscreen,node_video_preprocess,node_video_model,node_audio_preprocess,node_audio_model,node_onnx_runtime toneAmber
class node_background,node_session_state,node_score_merge toneMint
class node_traffic_light,node_popup toneRose
class node_webpage toneIndigo
```

## Components

### Media capture

- [Video capture](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js): `extension-root/content/content.js`
- [Audio capture](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js): `extension-root/content/content.js`

### Local inference

- [Offscreen processor](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js): `extension-root/offscreen/offscreen.js`
- [Frame preprocessing](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js): `extension-root/offscreen/offscreen.js`
- [Video model](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/assets/deepfake_efficientnet_b0_int8.onnx): `extension-root/assets/deepfake_efficientnet_b0_int8.onnx`
- [Audio features](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/offscreen/offscreen.js): `extension-root/offscreen/offscreen.js`
- [Audio model](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/assets/audio_clone_detector.onnx): `extension-root/assets/audio_clone_detector.onnx`
- [ONNX Runtime](https://github.com/sudo-anu/deep-sheild/tree/main/extension-root/lib): `extension-root/lib`

### Extension coordination

- [Message bridge](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js): `extension-root/background.js`
- [Tab session state](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js): `extension-root/background.js`
- [Score merge](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/background.js): `extension-root/background.js`

### User interfaces

- [Page indicator](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/content/content.js): `extension-root/content/content.js`
- [Results popup](https://github.com/sudo-anu/deep-sheild/blob/main/extension-root/popup/popup.js): `extension-root/popup/popup.js`

### Other components

- **Webpage media**

## Connections

- Webpage media → Video capture: provides frames (evidence: `README.md`)
- Webpage media → Audio capture: provides audio (evidence: `README.md`)
- Video capture → Message bridge: requests capture (evidence: `extension-root/background.js`)
- Message bridge → Offscreen processor: forwards screenshot (evidence: `extension-root/background.js`)
- Offscreen processor → Frame preprocessing: decodes frame (evidence: `extension-root/offscreen/offscreen.js`)
- Frame preprocessing → Video model: prepares input (evidence: `extension-root/offscreen/offscreen.js`)
- Offscreen processor → ONNX Runtime: runs inference (evidence: `README.md`)
- Video model → Offscreen processor: returns score (evidence: `README.md`)
- Audio capture → Message bridge: sends samples (evidence: `README.md`)
- Message bridge → Offscreen processor: forwards samples (evidence: `extension-root/background.js`)
- Offscreen processor → Audio features: resamples audio (evidence: `extension-root/offscreen/offscreen.js`)
- Audio features → Audio model: creates tensor (evidence: `extension-root/offscreen/offscreen.js`)
- Audio model → Offscreen processor: returns score (evidence: `README.md`)
- Offscreen processor → Message bridge: reports results (evidence: `README.md`)
- Message bridge → Score merge: merges scores (evidence: `extension-root/background.js`)
- Message bridge → Tab session state: stores scores (evidence: `extension-root/background.js`)
- Message bridge → Page indicator: sends updates (evidence: `extension-root/background.js`)
- Message bridge → Results popup: broadcasts updates (evidence: `extension-root/background.js`)
- Results popup → Message bridge: queries status (evidence: `extension-root/popup/popup.js`)
- Video capture → Page indicator: renders indicator (evidence: `extension-root/content/content.js`)
