Skip to main content

A zero-config, local-first privacy layer for AI APIs with semantic-preserving de-identification.

Project description

🛡️ YinShield (隐)

Make your data invisible to AI, like a shadow.
让你的数据对 AI 隐形,如影随形。

PyPI version License


☯️ What is YinShield? | 什么是隐盾?

Yin (隐) in Chinese means Hidden or Invisible.

YinShield is a lightweight, zero-config Python library designed to protect your privacy when using AI APIs (like OpenAI, DeepSeek, Claude). It intercepts sensitive information locally, replaces it with semantically-consistent tokens, and restores it automatically after the AI responds.

隐盾 (YinShield) 是一款轻量级、零配置的 Python 库,专为保护 AI API 使用过程中的隐私而生。它在本地拦截敏感信息,将其替换为保持语义一致的占位符,并在 AI 回复后自动还原。

🌟 Key Features | 核心特性

  • 🚀 Zero Config: pip install and you are ready. No complex setups or local servers required.
  • 🧠 Semantic Preservation: Unlike brute-force masking, YinShield uses "Semantic Aliases" (e.g., replacing "Zhang San" with "Li Si") to keep the AI's reasoning capabilities intact.
  • 🔒 Local-First: All detection and masking happen on your machine. No sensitive data ever leaves your device.
  • 🇨🇳 Optimized for China: Built-in support for Chinese-specific PII (WeChat ID, ID cards, Chinese addresses, etc.).
  • 🔌 Drop-in Replacement: Seamlessly integrates with your existing AI SDK calls.

🛠️ Quick Start | 快速上手

Installation | 安装

pip install yinshield

Basic Usage | 基本用法 (Coming Soon)

from yinshield import Shield

# Initialize the shield
shield = Shield()

raw_text = "我叫张三,我的手机号是13812345678,我住在北京市朝阳区。"

# 1. Locally mask sensitive data
masked_text, mapping = shield.mask(raw_text)
# masked_text becomes: "我叫<PERSON_1>,我的手机号是<PHONE_1>,我住在<LOC_1>。"

# 2. Call your AI API with masked_text...
# (AI processes the data without knowing who you are)

# 3. Restore the response locally
final_response = shield.unmask(ai_response, mapping)

🗺️ Roadmap | 开发路线图

  • v0.1.0: Core Regex-based Chinese PII masking.
  • v0.2.0: Lightweight ONNX model integration for high-accuracy NER.
  • v0.3.0: Semantic Alias engine (Consistent persona mapping).
  • v0.4.0: Image/OCR privacy protection.

🤝 Contributing | 贡献

YinShield is an open-source project. We welcome contributions to help make AI safer for everyone!

📄 License | 许可证

Apache-2.0 License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yinshield-0.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yinshield-0.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file yinshield-0.0.1.tar.gz.

File metadata

  • Download URL: yinshield-0.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for yinshield-0.0.1.tar.gz
Algorithm Hash digest
SHA256 81673e796176281abea3aaef01dc6b46accb6d201d34fd64a43652ca2324a13a
MD5 f2248e69471ddcfb4dbe3aed9711598c
BLAKE2b-256 9ad0f00abb138e5b1b3cf7d0b63e670ec6f0cb75c36b8bb03549257b841a18f6

See more details on using hashes here.

File details

Details for the file yinshield-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: yinshield-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for yinshield-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 973550e70746b84111cbd318a25e83005e322db356442e1c7d73e5c13a73f49c
MD5 d89378dbc9b5c5f7b7611083e69cba04
BLAKE2b-256 cac8b7ebb135fbb5a9c0ed01c1ca6447baaf29558b2d3d3b810e3d65441e0b75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page