Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for NanoShield

Live demo: https://nanoshield-2026.web.app · Demo video: https://youtu.be/t1ZOTRXctbw · Source: https://github.com/matrixneoaiagent/nanoshield

Inspiration

Every day people paste contracts, support tickets, logs and customer records into AI tools. Once the text leaves the browser, the sensitive parts are gone. NanoShield flips that: find and mask the PII first, send only the redacted text to any model, then put the real values back into the reply locally.

What it does

  • Detects 7 PII categories: names, emails, phones, payment cards, SSN/national IDs, addresses and secrets (API keys, tokens, connection strings).
  • Presets for customer support, healthcare, DevOps and legal text, plus strict mode, a confidence threshold and three mask styles ([REDACTED_NAME_1], ****1234, stable hash).
  • Side-by-side diff, copy-clean, export/import a token vault, and one-click De-Anonymize for the model's reply.
  • OCR for screenshots/images with local canvas redaction boxes.
  • Audit history in Firestore: SHA-256 integrity proof, entity counts, mask style and latency only — no PII is written to Firestore.

How we built it

NanoShield is a Vite web app built on Firebase AI Logic Hybrid Inference. getGenerativeModel is created with InferenceMode.PREFER_ON_DEVICE: on Chrome with the Prompt API and Gemini Nano available, the request runs on-device; otherwise Firebase AI Logic falls back to Gemini 3.5 Flash Lite in the cloud. The UI badge always says which path served the request (ON_DEVICE or IN_CLOUD) — the demo runs on Linux Chromium, where Nano is unavailable, so the honest label is IN_CLOUD.

Every AI Logic and Firestore call is attested by Firebase App Check (reCAPTCHA v3 in production, a registered debug token for local development). Remote Config supplies the policy: strict mode, mask style, enabled entity types, hybrid policy and confidence threshold. Anonymous Auth gives a zero-friction session, and Firestore uses persistentLocalCache for offline-first audit history. The redaction pipeline is in src/ai.js, src/redactor.js and src/diff.js; the token map never leaves the tab.

Challenges we ran into

  • Making the hybrid path honest: the same UI must not pretend a cloud call is on-device. The badge and the README state the actual path.
  • Keeping PII out of the audit trail: only SHA-256 hashes, counts and settings are stored.
  • Handling arbitrary pasted text: presets plus strict mode and a confidence threshold reduce misses, and the diff makes every redaction reviewable.

Accomplishments that we're proud of

  • A working, deployed app with real Firebase AI Logic, App Check, Remote Config, anonymous auth and Firestore audit — not a mock.
  • A one-minute demo that shows the full loop: load a support ticket, redact names/emails/phones/card, show the cloud-fallback badge, de-anonymize, and open the hash-only audit history.
  • Apache-2.0 source with setup instructions and six real screenshots.

What we learned

On-device inference is the right default for privacy, but availability is uneven. A hybrid SDK plus an explicit provenance badge gives users both privacy and a working product, without overclaiming.

What's next for NanoShield

  • Add more on-device platforms (Android Gemini Nano, iOS Apple Foundation Models) through the same Firebase AI Logic layer.
  • Add team policy sync and a browser extension that redacts before text reaches any web LLM.
  • Expand the entity set (IBANs, medical record numbers) and add a local-only evaluation suite.

Built With

  • chrome-prompt-api
  • cloud-firestore
  • css
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-remote-config
  • gemini
  • gemini-nano
  • html
  • javascript
  • vite
Share this project:

Updates

Submission history