Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ jobs:
python-version: "3.12"
- run: pip install numpy fastapi uvicorn faster-whisper
- run: python server/test_cutter.py
- run: python server/test_privacy.py
67 changes: 67 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Privacy: what Nazar does with your call

Nazar listens to phone calls, the most private conversations people have. So privacy is not a feature here; it is the rule every part of Nazar is built around.

> **In one line:** in the on-device version, your call never leaves your device, is never saved, and is forgotten as the call goes on. Nazar is a smoke detector, not a recorder.

## What Nazar never does

- ❌ **Never records** your call. There is no audio file and no transcript file, anywhere.
- ❌ **Never sends your call** to us, to a cloud, or to any company (on-device mode).
- ❌ **Never keeps** what was said. After 30 seconds, a line is reduced to its scam warning words, or erased completely.
- ❌ **Never tells your family what was said.** The alert only says that a call looks like a scam.
- ❌ **Never needs an account.** No sign-up, no login, no phone number collected by us.
- ❌ **Never shows ads or tracks you.** There is no analytics or tracking code in this project.

## What happens to your call, step by step (on-device version)

| Step | Where it happens | What is kept |
|---|---|---|
| 1. The laptop microphone hears the call on speaker | Your device | Nothing: audio goes straight to step 2, in memory |
| 2. Speech is turned into text, sentence by sentence (Whisper) | **Your device** (server bound to `127.0.0.1`, unreachable from the network) | Nothing: each audio sentence is discarded after it becomes text |
| 3. The text is checked for the scam pattern | Your browser, on your device | The text of the **last 30 seconds** only |
| 4. After 30 seconds | Your browser | Only the scam warning words of a line (e.g. "CBI · arrest warrant"); normal talk is erased |
| 5. You press Stop | Your browser | **Everything is wiped** |
| 6. If it is a scam | Your choice: WhatsApp, Telegram, copy or share | Only: *"possible scam call right now, risk 70/100, steps seen: authority, fear, time"* |

## What the family alert contains

```
Nazar alert: possible scam call right now (for Rahul)
Risk: HIGH (70/100)
Steps seen: authority, fear
Time: 10:42 AM
Please call them now and tell them to hang up. Do not share any OTP.
```

That is all. No words from the call, no phone number of the caller, no recording.
The alert is only sent through the apps **you** set up (Telegram or WhatsApp), to the person **you** chose.

## What is stored on your device

Only your settings, in your own browser: the call language, text size, the family member's name, and your Telegram/WhatsApp details for alerts.
They never leave your device except when an alert is sent, and you can delete them by clearing the site's data in your browser.

## The one exception: website mode, by your choice

The website (nazar-codevators.vercel.app) cannot run the speech model, so live listening there uses your **browser's own speech service** (Google in Chrome), which means **audio goes to Google**.
Nazar never switches to this silently: you must choose "Browser speech (cloud)" yourself, and the page warns you first. The privacy badge then changes from 🔒 *On-device* to ⚠️ *Cloud speech*.
Sample calls and typed lines never use the microphone or any cloud service. Like any website host, Vercel may log page visits (not call data).

## On a real phone (product design)

- Nazar would listen **only to calls from unknown numbers**, never to saved contacts.
- It would turn on **only when a call starts** and stop when it ends.
- Everything above still applies: on the phone, nothing recorded, nothing sent.

## How these promises are checked

Promises are only worth something if they are tested. `npm test` and `python server/test_privacy.py` run on every change (GitHub Actions) and fail if:

- the speech server listens on anything other than `127.0.0.1`,
- the server prints or writes call text, or opens files for writing,
- the 30-second memory or the wipe on Stop is removed,
- the family alert starts including call text,
- tracking or analytics code is added to the page.

Found a way Nazar could leak your call? Please report it privately: see [SECURITY.md](SECURITY.md).
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</p>

<p align="center">
<a href="#-your-privacy-comes-first">Privacy</a> ·
<a href="#-the-problem">Problem</a> ·
<a href="#-how-it-works">How it works</a> ·
<a href="#-results">Results</a> ·
Expand All @@ -35,6 +36,19 @@

---

## 🔒 Your privacy comes first

Nazar listens to phone calls, so privacy is the rule everything is built around:

- 🎙️ **Your call never leaves your device.** Speech is turned into text on your own laptop; the speech server cannot even be reached from the network.
- 💾 **Nothing is recorded or saved.** No audio files, no transcripts. Each sentence is discarded once it has been checked.
- ⏱️ **Nazar forgets as it goes.** After 30 seconds only scam warning words are kept; pressing Stop wipes everything.
- 👨‍👩‍👧 **Your family is told *that* it is a scam, never *what* was said.**
- 🚫 **No account, no ads, no tracking.**
- ✅ **Tested, not just promised:** privacy tests run on every change and fail if any of this is broken.

Full details, including the one exception (the website's optional cloud speech, used only if you choose it): **[PRIVACY.md](PRIVACY.md)**

## 🚨 The problem

In a "digital arrest" scam, a caller poses as CBI, police, customs or a court, says you are part of a crime,
Expand Down Expand Up @@ -104,7 +118,7 @@ All test calls are fictional and written by our team, so these are not real-worl
| Wiped when the call ends | Stopping listening forgets all call text |
| Alerts carry no conversation | Family sees risk level, steps and time, never what was said |

More: [docs/privacy.md](docs/privacy.md)
More: [PRIVACY.md](PRIVACY.md) · technical notes in [docs/privacy.md](docs/privacy.md)

## ✨ Features

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Live scam-call detector for digital-arrest scams (Team CodeVators, Code Yudh 2026)",
"private": true,
"scripts": {
"test": "node web/test.js && node web/test_addressed.js && node web/test_fold.js && node web/test_score.js && node web/test_aware.js",
"test": "node web/test.js && node web/test_addressed.js && node web/test_fold.js && node web/test_score.js && node web/test_aware.js && node web/test_privacy.js",
"e2e": "node web/e2e_live.js demo-audio/S1_full.wav",
"serve": "python server/server.py"
},
Expand Down
32 changes: 32 additions & 0 deletions server/test_privacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Privacy guards for the speech server: fails if a change could leak call audio or text."""
import ast, os, re, sys

src = open(os.path.join(os.path.dirname(__file__), "server.py"), encoding="utf-8").read()
tree = ast.parse(src)
fail = []

# 1. Only reachable from this machine.
hosts = re.findall(r'host\s*=\s*"([^"]+)"', src)
if hosts != ["127.0.0.1"]:
fail.append(f"server must listen on 127.0.0.1 only, found {hosts}")

# 2. Never prints the transcribed text.
for node in ast.walk(tree):
if isinstance(node, ast.Call) and getattr(node.func, "id", "") == "print":
names = {n.id for n in ast.walk(node) if isinstance(n, ast.Name)}
if "text" in names:
fail.append(f"line {node.lineno}: print() uses the call text")

# 3. Never writes files (no recordings, no transcripts).
for node in ast.walk(tree):
if isinstance(node, ast.Call) and getattr(node.func, "id", "") == "open":
mode = node.args[1].value if len(node.args) > 1 and isinstance(node.args[1], ast.Constant) else "r"
if any(c in mode for c in "wax+"):
fail.append(f"line {node.lineno}: open() for writing")
if re.search(r"\b(sf\.write|wavfile\.write|soundfile|\.tofile\(|np\.save)", src):
fail.append("server writes audio or arrays to disk")

for f in fail:
print("FAIL", f)
print("PASS" if not fail else f"{len(fail)} failed")
sys.exit(1 if fail else 0)
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ <h2>The call</h2>
<details class="info">
<summary id="privSum">🔒 On-device · nothing recorded</summary>
<p class="privacy" id="privacy"></p>
<p class="note"><a href="https://github.com/Kunal039/Nazar_CodeVators/blob/main/PRIVACY.md" target="_blank" rel="noopener">Read our full privacy promise</a>: what Nazar never does, and what happens to your call step by step.</p>
<p class="note" id="micHelp">Put the phone call on speaker next to this laptop, or read a scam script aloud. Speech is turned into text by your browser's speech service (Chrome or Edge). Nazar's scoring runs here on this page.</p>
<label class="small">Speech engine
<select id="engine"><option value="whisper">On-device (Whisper)</option><option value="browser">Browser speech (cloud)</option></select>
Expand Down
17 changes: 17 additions & 0 deletions web/test_privacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Privacy guards for the page: fails if a change could keep, send or track call content.
const fs = require("fs");
const app = fs.readFileSync(__dirname + "/app.js", "utf8");
const html = fs.readFileSync(__dirname + "/index.html", "utf8");
let fail = 0;
function ok(name, cond) { if (!cond) { fail++; console.log("FAIL", name); } else console.log("ok ", name); }
const body = (fn) => { const i = app.indexOf("function " + fn + "("); let d = 0, j = app.indexOf("{", i); const s = j; do { if (app[j] === "{") d++; else if (app[j] === "}") d--; j++; } while (d); return app.slice(s, j); };

ok("call text is forgotten after 30 seconds", /MEMORY_MS = 30000/.test(app) && /setInterval\(\(\) => forgetLines\(MEMORY_MS\)/.test(app));
ok("Stop wipes all call text", /forgetLines\(0\)/.test(body("stopListening")));
ok("family alert never includes call text", !/session|lines|transcript|text/.test(body("familyText").replace(/textContent/g, "")));
ok("no tracking or analytics code", !/google-analytics|gtag\(|googletagmanager|mixpanel|segment\.com|hotjar|facebook\.net|clarity\.ms/i.test(app + html));
const urls = [...app.matchAll(/fetch\(\s*["'`]([^"'`]+)/g)].map((m) => m[1]);
ok("the page only talks to its own server and Telegram (alerts)", urls.every((u) => u === "/health" || u.startsWith("https://api.telegram.org/") || /\.(css|js|html|json)$/.test(u)));
ok("cloud speech needs the user's consent", /confirm\(".*cloud speech/i.test(app));
console.log(fail ? `${fail} failed` : "PASS");
process.exit(fail ? 1 : 0);
Loading