{"id":43073493,"url":"https://github.com/mensonones/expo-ai-context-shield","last_synced_at":"2026-01-31T13:57:41.417Z","repository":{"id":331329417,"uuid":"1125907577","full_name":"mensonones/expo-ai-context-shield","owner":"mensonones","description":"The ultimate privacy layer for Expo apps. Blocks AI OCR, screen captures, and system context leakage with zero performance overhead.","archived":false,"fork":false,"pushed_at":"2026-01-01T12:22:04.000Z","size":198,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-06T09:35:03.193Z","etag":null,"topics":["ai","expo","react-native","security"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mensonones.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-31T16:07:13.000Z","updated_at":"2026-01-04T06:01:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mensonones/expo-ai-context-shield","commit_stats":null,"previous_names":["mensonones/expo-ai-context-shield"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mensonones/expo-ai-context-shield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mensonones%2Fexpo-ai-context-shield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mensonones%2Fexpo-ai-context-shield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mensonones%2Fexpo-ai-context-shield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mensonones%2Fexpo-ai-context-shield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mensonones","download_url":"https://codeload.github.com/mensonones/expo-ai-context-shield/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mensonones%2Fexpo-ai-context-shield/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28944789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T13:02:32.153Z","status":"ssl_error","status_checked_at":"2026-01-31T13:00:07.528Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","expo","react-native","security"],"created_at":"2026-01-31T13:57:41.348Z","updated_at":"2026-01-31T13:57:41.411Z","avatar_url":"https://github.com/mensonones.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛡️ Expo AI Context Shield\n\n**The ultimate privacy layer for Expo apps. Protect sensitive UI from AI vision, Screen Captures (iOS), and System Intelligence.**\n\nIn 2025/2026, OS-level AI (like Google’s Gemini Nano and Samsung’s Galaxy AI) can \"read\" your app's screen to provide context. While helpful, this poses a massive privacy risk for apps handling bank balances, health data, or private credentials.\n\n`expo-ai-context-shield` provides a **semantic security boundary** that makes your content invisible to AI OCR and system intelligence without compromising user experience or causing rendering bugs.\n\n\u003e [!WARNING]\n\u003e **iOS Support:** The iOS implementation is based on native security APIs but has **not been tested on physical devices yet**. Contributions and feedback are welcome!\n\n---\n\n## 🚀 Key Features\n\n* **AI Vision Blocking:** Prevents on-device AI (Circle to Search, Gemini Nano, Galaxy AI) from indexing or \"reading\" your sensitive UI.\n* **Hardware-Level Protection:** Automatically blocks screenshots and screen recordings on both iOS and Android using native security layers.\n* **Zero Rendering Bugs:** Optimized for React Native to ensure your content never disappears or \"blinks\" when security is toggled.\n* **Zero Performance Overhead:** Pure native implementation with no background listeners or heavy wrappers.\n* **Ultra Lightweight:** Only ~9kB (gzipped), ensuring no impact on your app's bundle size.\n\n---\n\n## 📦 Installation\n\n```bash\nnpx expo install expo-ai-context-shield\n```\n\n\u003e [!IMPORTANT]\n\u003e **This is a native module.** It requires [Development Builds](https://docs.expo.dev/development/introduction/) and will not work in Expo Go. You must run `npx expo prebuild` to use it in your project.\n\n---\n\n## 💡 Why this module?\n\n### The Privacy Risk in the Gen-AI Era\n\nYou might think: *\"If the user triggered the AI, they know what they are doing\"*. In reality, the risk is more subtle:\n\n* **Context Leakage:** When a user uses *Circle to Search* to identify a shoe, the AI captures the **entire screen**. If a bank balance or CPF is visible next to it, that sensitive data is sent to AI servers as \"context\".\n* **Activity Logs:** AI assistant captures are often saved in the user's account history (Google/Samsung/Apple). Without protection, your app's private data ends up stored permanently in third-party logs.\n* **Always-on Snapshots:** Features like \"Recall\" or \"System Timelines\" take periodic screenshots of the screen. This module ensures your app is a \"black hole\" in those automated captures.\n\n### Comparison\n\n| Feature | Standard View | `FLAG_SECURE` (Full App) | **AI Context Shield** |\n| --- | --- | --- | --- |\n| Protects against AI | ❌ | ✅ | ✅ |\n| Blocks Screenshots | ❌ | ✅ | ✅ |\n| UX Friendly | ✅ | ❌ | ✅ |\n| OCR Resistant | ❌ | ✅ | ✅ |\n\n---\n\n## ⚡ Performance \u0026 Size\n\nThis module is designed to be as transparent as possible:\n\n- **Package Size:** ~8.6 kB (compressed) / ~24 kB (unpacked).\n- **Native Footprint:** Uses standard system APIs (`FLAG_SECURE` on Android, `isSecureTextEntry` on iOS).\n- **No JS Bridge Overhead:** Communication is minimal and only happens when the `isSensitive` prop changes.\n\n---\n\n## 🛠 Usage\n\nSimply wrap your sensitive components with the `AiContextShield`.\n\n```tsx\nimport { AiContextShield } from 'expo-ai-context-shield';\nimport { Text, View } from 'react-native';\n\nexport default function SensitiveScreen() {\n  return (\n    \u003cView style={{ flex: 1 }}\u003e\n      \u003cText\u003ePublic information (visible to AI)\u003c/Text\u003e\n\n      {/* This part will be blacked out in screenshots and invisible to Gemini/Galaxy AI */}\n      \u003cAiContextShield isSensitive style={{ padding: 10 }}\u003e\n        \u003cText style={{ fontSize: 24, fontWeight: 'bold' }}\u003e\n          Balance: $1,250,000.00\n        \u003c/Text\u003e\n      \u003c/AiContextShield\u003e\n    \u003c/View\u003e\n  );\n}\n\n```\n\n\u003e [!TIP]\n\u003e You can use `\u003cAiContextShield isSensitive /\u003e` as a shorthand for `\u003cAiContextShield isSensitive={true} /\u003e`. In JSX, if you pass a prop without a value, it defaults to `true`.\n\u003e\n\u003e **Why does this work without children?**\n\u003e On Android, this module uses `FLAG_SECURE` on the **entire Activity Window**. This means that simply mounting a single `\u003cAiContextShield /\u003e` anywhere in your component tree will protect the **entire screen** from screenshots and AI analysis, even if it wraps nothing.\n\n### Screen-Level Protection (No Children)\n\nYou can use the component without children to toggle protection for the entire screen (Android).\n\n```tsx\nimport { AiContextShield } from 'expo-ai-context-shield';\nimport { View, Text } from 'react-native';\n\nexport default function SecretScreen() {\n  return (\n    \u003cView style={{ flex: 1 }}\u003e\n      {/* This will trigger FLAG_SECURE on Android, protecting the whole screen */}\n      \u003cAiContextShield isSensitive /\u003e\n      \n      \u003cText\u003eThis entire screen is now protected.\u003c/Text\u003e\n    \u003c/View\u003e\n  );\n}\n```\n\n---\n\n## 🏥 Common Use Cases\n\n| Industry | What to protect? |\n| --- | --- |\n| **Fintech** | Account balances, Credit Card numbers, CVV, QR Codes. |\n| **Healthcare** | Patient names, diagnoses, exam results. |\n| **Messaging** | Private chat content, self-destructing photos. |\n| **Auth** | Recovery keys, 2FA codes, temporary passwords. |\n\n---\n\n## ⚙️ API Reference\n\n### `AiContextShield` (Component)\n\n| Prop | Type | Default | Description |\n| --- | --- | --- | --- |\n| **`isSensitive`** | `boolean` | `false` | When `true`, enables hardware-level protection. |\n| **`style`** | `ViewStyle` | `undefined` | Standard React Native styles. |\n| **`children`** | `ReactNode` | `required` | The content you want to shield. |\n\n---\n\n## 📱 Platform Implementation\n\n* **Android (API 29+):** Uses `IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS` to block data indexing and `FLAG_SECURE` to block visual pixel capture. Tested on Samsung S23/S24 (Galaxy AI) and Pixel 8/9 (Gemini).\n* **iOS (13.4+):** Implements a hidden `UITextField` canvas layer trick. *(Note: Not yet tested on physical devices)*.\n* **Web:** Transparent fallback. Renders a standard `View` to maintain layout consistency.\n\n---\n\n## 🤝 Contributing\n\nWe are looking for help with:\n\n* Improving the instance counter for `FLAG_SECURE` on Android.\n* iOS screenshot detection events.\n\n1. Fork the repo.\n2. Install dependencies: `npm install`.\n3. Test in the example app: `cd example \u0026\u0026 npx expo run:android`.\n\n---\n\n## 📄 License\n\nMIT © @mensonones","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmensonones%2Fexpo-ai-context-shield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmensonones%2Fexpo-ai-context-shield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmensonones%2Fexpo-ai-context-shield/lists"}