privylayer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: privylayer
3
+ Version: 0.1.0
4
+ Summary: Privacy layer for AI prompts
5
+ Author: Nithish
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+
10
+ # ๐Ÿ” PrivyLayer
11
+
12
+ > Privacy layer for AI systems โ€” protect sensitive data *before* it reaches AI.
13
+
14
+ ---
15
+
16
+ ## ๐Ÿš€ Overview
17
+
18
+ **PrivyLayer** is a lightweight Python library that acts as a **security layer between user input and AI models**.
19
+
20
+ It detects sensitive information (PII), replaces it with secure placeholders, and restores it after the AI response โ€” ensuring **zero data exposure**.
21
+
22
+ ---
23
+
24
+ ## โšก Why PrivyLayer?
25
+
26
+ Modern AI systems process user input directly, which may include:
27
+
28
+ * ๐Ÿ“ฑ Phone numbers
29
+ * ๐Ÿ“ง Emails
30
+ * ๐Ÿชช Aadhaar / PAN
31
+ * ๐Ÿฆ Bank details
32
+
33
+ This creates a **privacy risk**.
34
+
35
+ ๐Ÿ‘‰ PrivyLayer solves this by introducing a **reversible masking system**.
36
+
37
+ ---
38
+
39
+ ## ๐Ÿง  How It Works
40
+
41
+ ```
42
+ User Input
43
+ โ†“
44
+ PrivyLayer (detect + mask)
45
+ โ†“
46
+ AI Model
47
+ โ†“
48
+ PrivyLayer (restore)
49
+ โ†“
50
+ Final Output
51
+ ```
52
+
53
+ ---
54
+
55
+ ## โœจ Features
56
+
57
+ * ๐Ÿ” Detects sensitive data using regex patterns
58
+ * ๐Ÿ” Reversible masking (no data loss)
59
+ * ๐Ÿง  Smart tokenization system
60
+ * โšก Fast and lightweight
61
+ * ๐Ÿ‡ฎ๐Ÿ‡ณ India-specific PII support
62
+ * ๐Ÿ”’ No data stored globally
63
+
64
+ ---
65
+
66
+ ## ๐Ÿ“ฆ Installation
67
+
68
+ ```bash
69
+ pip install privylayer
70
+ ```
71
+
72
+ ---
73
+
74
+ ## ๐Ÿ› ๏ธ Usage
75
+
76
+ ### ๐Ÿ” Protect (Mask data)
77
+
78
+ ```python
79
+ from privylayer import protect
80
+
81
+ text = "My phone is 9876543210 and email is test@gmail.com"
82
+
83
+ mask , context , seen = main.find_p(text)
84
+
85
+ print(mask)
86
+ ```
87
+
88
+ ### Output:
89
+
90
+ ```
91
+ My phone is โŸฆPII_PHONE_x1โŸง and email is โŸฆPII_EMAIL_x2โŸง
92
+ ```
93
+
94
+ ---
95
+
96
+ ### ๐Ÿ”“ Restore (Unmask data)
97
+
98
+ ```python
99
+ from privylayer import restore
100
+
101
+ original = restore(masked, context)
102
+
103
+ print(original)
104
+ ```
105
+
106
+ ### Output:
107
+
108
+ ```
109
+ My phone is 9876543210 and email is test@gmail.com
110
+ ```
111
+
112
+ ---
113
+
114
+ ## ๐Ÿงฉ Supported Data Types
115
+
116
+ * ๐Ÿ“ฑ Phone numbers (India)
117
+ * ๐Ÿ“ง Email addresses
118
+ * ๐Ÿชช Aadhaar numbers
119
+ * ๐Ÿงพ PAN numbers
120
+ * ๐Ÿฆ IFSC codes
121
+
122
+ ---
123
+
124
+ ## ๐Ÿ” Token Format
125
+
126
+ PrivyLayer replaces sensitive data with structured tokens:
127
+
128
+ ```
129
+ โŸฆPII_TYPE_IDโŸง
130
+ ```
131
+
132
+ Example:
133
+
134
+ ```
135
+ โŸฆPII_PHONE_x1โŸง
136
+ โŸฆPII_EMAIL_x2โŸง
137
+ ```
138
+
139
+ ---
140
+
141
+ ## โš ๏ธ Limitations
142
+
143
+ * Regex-based detection (may not detect names accurately)
144
+ * Does not validate Aadhaar checksum (yet)
145
+ * Context must be preserved for restoration
146
+
147
+ ---
148
+
149
+ ## ๐Ÿš€ Roadmap
150
+
151
+ * [ ] AI-based name detection
152
+ * [ ] Risk scoring system
153
+ * [ ] Browser extension
154
+ * [ ] API gateway version
155
+ * [ ] Encryption-based token vault
156
+
157
+ ---
158
+
159
+ ## ๐Ÿค Contributing
160
+
161
+ Contributions are welcome!
162
+
163
+ * Fork the repo
164
+ * Create a feature branch
165
+ * Submit a pull request
166
+
167
+ ---
168
+
169
+ ## ๐Ÿ“„ License
170
+
171
+ MIT License
172
+
173
+ ---
174
+
175
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
176
+
177
+ Built by Nithish ๐Ÿš€
178
+
179
+ ---
180
+
181
+ ## ๐ŸŒŸ Vision
182
+
183
+ > Making AI safe for everyone by protecting sensitive data at the source.
184
+
185
+ ---
186
+
187
+ โญ If you like this project, consider giving it a star!
@@ -0,0 +1,178 @@
1
+ # ๐Ÿ” PrivyLayer
2
+
3
+ > Privacy layer for AI systems โ€” protect sensitive data *before* it reaches AI.
4
+
5
+ ---
6
+
7
+ ## ๐Ÿš€ Overview
8
+
9
+ **PrivyLayer** is a lightweight Python library that acts as a **security layer between user input and AI models**.
10
+
11
+ It detects sensitive information (PII), replaces it with secure placeholders, and restores it after the AI response โ€” ensuring **zero data exposure**.
12
+
13
+ ---
14
+
15
+ ## โšก Why PrivyLayer?
16
+
17
+ Modern AI systems process user input directly, which may include:
18
+
19
+ * ๐Ÿ“ฑ Phone numbers
20
+ * ๐Ÿ“ง Emails
21
+ * ๐Ÿชช Aadhaar / PAN
22
+ * ๐Ÿฆ Bank details
23
+
24
+ This creates a **privacy risk**.
25
+
26
+ ๐Ÿ‘‰ PrivyLayer solves this by introducing a **reversible masking system**.
27
+
28
+ ---
29
+
30
+ ## ๐Ÿง  How It Works
31
+
32
+ ```
33
+ User Input
34
+ โ†“
35
+ PrivyLayer (detect + mask)
36
+ โ†“
37
+ AI Model
38
+ โ†“
39
+ PrivyLayer (restore)
40
+ โ†“
41
+ Final Output
42
+ ```
43
+
44
+ ---
45
+
46
+ ## โœจ Features
47
+
48
+ * ๐Ÿ” Detects sensitive data using regex patterns
49
+ * ๐Ÿ” Reversible masking (no data loss)
50
+ * ๐Ÿง  Smart tokenization system
51
+ * โšก Fast and lightweight
52
+ * ๐Ÿ‡ฎ๐Ÿ‡ณ India-specific PII support
53
+ * ๐Ÿ”’ No data stored globally
54
+
55
+ ---
56
+
57
+ ## ๐Ÿ“ฆ Installation
58
+
59
+ ```bash
60
+ pip install privylayer
61
+ ```
62
+
63
+ ---
64
+
65
+ ## ๐Ÿ› ๏ธ Usage
66
+
67
+ ### ๐Ÿ” Protect (Mask data)
68
+
69
+ ```python
70
+ from privylayer import protect
71
+
72
+ text = "My phone is 9876543210 and email is test@gmail.com"
73
+
74
+ mask , context , seen = main.find_p(text)
75
+
76
+ print(mask)
77
+ ```
78
+
79
+ ### Output:
80
+
81
+ ```
82
+ My phone is โŸฆPII_PHONE_x1โŸง and email is โŸฆPII_EMAIL_x2โŸง
83
+ ```
84
+
85
+ ---
86
+
87
+ ### ๐Ÿ”“ Restore (Unmask data)
88
+
89
+ ```python
90
+ from privylayer import restore
91
+
92
+ original = restore(masked, context)
93
+
94
+ print(original)
95
+ ```
96
+
97
+ ### Output:
98
+
99
+ ```
100
+ My phone is 9876543210 and email is test@gmail.com
101
+ ```
102
+
103
+ ---
104
+
105
+ ## ๐Ÿงฉ Supported Data Types
106
+
107
+ * ๐Ÿ“ฑ Phone numbers (India)
108
+ * ๐Ÿ“ง Email addresses
109
+ * ๐Ÿชช Aadhaar numbers
110
+ * ๐Ÿงพ PAN numbers
111
+ * ๐Ÿฆ IFSC codes
112
+
113
+ ---
114
+
115
+ ## ๐Ÿ” Token Format
116
+
117
+ PrivyLayer replaces sensitive data with structured tokens:
118
+
119
+ ```
120
+ โŸฆPII_TYPE_IDโŸง
121
+ ```
122
+
123
+ Example:
124
+
125
+ ```
126
+ โŸฆPII_PHONE_x1โŸง
127
+ โŸฆPII_EMAIL_x2โŸง
128
+ ```
129
+
130
+ ---
131
+
132
+ ## โš ๏ธ Limitations
133
+
134
+ * Regex-based detection (may not detect names accurately)
135
+ * Does not validate Aadhaar checksum (yet)
136
+ * Context must be preserved for restoration
137
+
138
+ ---
139
+
140
+ ## ๐Ÿš€ Roadmap
141
+
142
+ * [ ] AI-based name detection
143
+ * [ ] Risk scoring system
144
+ * [ ] Browser extension
145
+ * [ ] API gateway version
146
+ * [ ] Encryption-based token vault
147
+
148
+ ---
149
+
150
+ ## ๐Ÿค Contributing
151
+
152
+ Contributions are welcome!
153
+
154
+ * Fork the repo
155
+ * Create a feature branch
156
+ * Submit a pull request
157
+
158
+ ---
159
+
160
+ ## ๐Ÿ“„ License
161
+
162
+ MIT License
163
+
164
+ ---
165
+
166
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
167
+
168
+ Built by Nithish ๐Ÿš€
169
+
170
+ ---
171
+
172
+ ## ๐ŸŒŸ Vision
173
+
174
+ > Making AI safe for everyone by protecting sensitive data at the source.
175
+
176
+ ---
177
+
178
+ โญ If you like this project, consider giving it a star!
@@ -0,0 +1 @@
1
+ from .core import mask, unmask
@@ -0,0 +1,47 @@
1
+ import detect_patterns as dp
2
+ import uuid
3
+
4
+ uu_id = str(uuid.uuid1())
5
+
6
+ detect_patterns = {"Phone" : dp.pattern_num , "email": dp.pattern_email , "Aadhaar" : dp.pattern_aadhaar , "PAN" : dp.pattern_pan , "IFSC" : dp.pattern_ifsc}
7
+
8
+
9
+
10
+
11
+
12
+ def mask(prompt):
13
+
14
+ context = {}
15
+ seen = {}
16
+ counter = 1
17
+ value = ""
18
+ masked_txt = prompt
19
+ for i , k in detect_patterns.items():
20
+ matches = k.finditer(masked_txt)
21
+
22
+ for j in matches:
23
+ value = j.group()
24
+
25
+ if value in seen:
26
+ token = seen[value]
27
+
28
+ else:
29
+ token_id = f"x_{counter}"
30
+ token = f"โŸฆPII_{i}_{token_id}โŸง"
31
+
32
+ context[token] = value
33
+ seen[value] = token
34
+ counter+=1
35
+ masked_txt = masked_txt.replace(value , token)
36
+
37
+
38
+ return masked_txt , context , seen
39
+
40
+ def unmask(masked_txt, context):
41
+ for token, value in context.items():
42
+ masked_txt = masked_txt.replace(token, value)
43
+
44
+ unmask_txt = masked_txt
45
+
46
+ return unmask_txt
47
+
@@ -0,0 +1,7 @@
1
+ import re
2
+
3
+ pattern_num = re.compile(r"\b[5-9]\d{9}\b")
4
+ pattern_email = re.compile(r"[a-zA-Z0-9.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]+")
5
+ pattern_aadhaar = re.compile(r"\b[1-9]\d{11}\b")
6
+ pattern_pan = re.compile(r"\b[A-Z]{5}\d{4}[A-Z]\b")
7
+ pattern_ifsc = re.compile(r"\b[A-Z]{4}0\d{6}\b")
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: privylayer
3
+ Version: 0.1.0
4
+ Summary: Privacy layer for AI prompts
5
+ Author: Nithish
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+
10
+ # ๐Ÿ” PrivyLayer
11
+
12
+ > Privacy layer for AI systems โ€” protect sensitive data *before* it reaches AI.
13
+
14
+ ---
15
+
16
+ ## ๐Ÿš€ Overview
17
+
18
+ **PrivyLayer** is a lightweight Python library that acts as a **security layer between user input and AI models**.
19
+
20
+ It detects sensitive information (PII), replaces it with secure placeholders, and restores it after the AI response โ€” ensuring **zero data exposure**.
21
+
22
+ ---
23
+
24
+ ## โšก Why PrivyLayer?
25
+
26
+ Modern AI systems process user input directly, which may include:
27
+
28
+ * ๐Ÿ“ฑ Phone numbers
29
+ * ๐Ÿ“ง Emails
30
+ * ๐Ÿชช Aadhaar / PAN
31
+ * ๐Ÿฆ Bank details
32
+
33
+ This creates a **privacy risk**.
34
+
35
+ ๐Ÿ‘‰ PrivyLayer solves this by introducing a **reversible masking system**.
36
+
37
+ ---
38
+
39
+ ## ๐Ÿง  How It Works
40
+
41
+ ```
42
+ User Input
43
+ โ†“
44
+ PrivyLayer (detect + mask)
45
+ โ†“
46
+ AI Model
47
+ โ†“
48
+ PrivyLayer (restore)
49
+ โ†“
50
+ Final Output
51
+ ```
52
+
53
+ ---
54
+
55
+ ## โœจ Features
56
+
57
+ * ๐Ÿ” Detects sensitive data using regex patterns
58
+ * ๐Ÿ” Reversible masking (no data loss)
59
+ * ๐Ÿง  Smart tokenization system
60
+ * โšก Fast and lightweight
61
+ * ๐Ÿ‡ฎ๐Ÿ‡ณ India-specific PII support
62
+ * ๐Ÿ”’ No data stored globally
63
+
64
+ ---
65
+
66
+ ## ๐Ÿ“ฆ Installation
67
+
68
+ ```bash
69
+ pip install privylayer
70
+ ```
71
+
72
+ ---
73
+
74
+ ## ๐Ÿ› ๏ธ Usage
75
+
76
+ ### ๐Ÿ” Protect (Mask data)
77
+
78
+ ```python
79
+ from privylayer import protect
80
+
81
+ text = "My phone is 9876543210 and email is test@gmail.com"
82
+
83
+ mask , context , seen = main.find_p(text)
84
+
85
+ print(mask)
86
+ ```
87
+
88
+ ### Output:
89
+
90
+ ```
91
+ My phone is โŸฆPII_PHONE_x1โŸง and email is โŸฆPII_EMAIL_x2โŸง
92
+ ```
93
+
94
+ ---
95
+
96
+ ### ๐Ÿ”“ Restore (Unmask data)
97
+
98
+ ```python
99
+ from privylayer import restore
100
+
101
+ original = restore(masked, context)
102
+
103
+ print(original)
104
+ ```
105
+
106
+ ### Output:
107
+
108
+ ```
109
+ My phone is 9876543210 and email is test@gmail.com
110
+ ```
111
+
112
+ ---
113
+
114
+ ## ๐Ÿงฉ Supported Data Types
115
+
116
+ * ๐Ÿ“ฑ Phone numbers (India)
117
+ * ๐Ÿ“ง Email addresses
118
+ * ๐Ÿชช Aadhaar numbers
119
+ * ๐Ÿงพ PAN numbers
120
+ * ๐Ÿฆ IFSC codes
121
+
122
+ ---
123
+
124
+ ## ๐Ÿ” Token Format
125
+
126
+ PrivyLayer replaces sensitive data with structured tokens:
127
+
128
+ ```
129
+ โŸฆPII_TYPE_IDโŸง
130
+ ```
131
+
132
+ Example:
133
+
134
+ ```
135
+ โŸฆPII_PHONE_x1โŸง
136
+ โŸฆPII_EMAIL_x2โŸง
137
+ ```
138
+
139
+ ---
140
+
141
+ ## โš ๏ธ Limitations
142
+
143
+ * Regex-based detection (may not detect names accurately)
144
+ * Does not validate Aadhaar checksum (yet)
145
+ * Context must be preserved for restoration
146
+
147
+ ---
148
+
149
+ ## ๐Ÿš€ Roadmap
150
+
151
+ * [ ] AI-based name detection
152
+ * [ ] Risk scoring system
153
+ * [ ] Browser extension
154
+ * [ ] API gateway version
155
+ * [ ] Encryption-based token vault
156
+
157
+ ---
158
+
159
+ ## ๐Ÿค Contributing
160
+
161
+ Contributions are welcome!
162
+
163
+ * Fork the repo
164
+ * Create a feature branch
165
+ * Submit a pull request
166
+
167
+ ---
168
+
169
+ ## ๐Ÿ“„ License
170
+
171
+ MIT License
172
+
173
+ ---
174
+
175
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
176
+
177
+ Built by Nithish ๐Ÿš€
178
+
179
+ ---
180
+
181
+ ## ๐ŸŒŸ Vision
182
+
183
+ > Making AI safe for everyone by protecting sensitive data at the source.
184
+
185
+ ---
186
+
187
+ โญ If you like this project, consider giving it a star!
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ privylayer/__init__.py
4
+ privylayer/core.py
5
+ privylayer/detect_patterns.py
6
+ privylayer.egg-info/PKG-INFO
7
+ privylayer.egg-info/SOURCES.txt
8
+ privylayer.egg-info/dependency_links.txt
9
+ privylayer.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ privylayer
@@ -0,0 +1,12 @@
1
+ [project]
2
+ name = "privylayer"
3
+ version = "0.1.0"
4
+ description = "Privacy layer for AI prompts"
5
+ authors = [{ name="Nithish" }]
6
+ readme = "README.md"
7
+ license = { text = "MIT" }
8
+ requires-python = ">=3.8"
9
+
10
+ [build-system]
11
+ requires = ["setuptools", "wheel"]
12
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+