@pacamelo/core 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Pacamelo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @pacamelo/core
2
+
3
+ Core PII detection and redaction engine for [PURGE](https://purgedata.app).
4
+
5
+ ## Why Open Source?
6
+
7
+ This package contains all the code that touches your data. We open-source it so you can verify:
8
+
9
+ - **What patterns we search for** - See exactly which regex patterns detect PII
10
+ - **How files are parsed** - Verify no data is exfiltrated during processing
11
+ - **How masking works** - Check that sensitive data is properly hidden
12
+ - **Security measures** - Audit ReDoS protection, memory cleanup, etc.
13
+
14
+ The PURGE UI remains proprietary, but the data-processing core is transparent.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @pacamelo/core
20
+ ```
21
+
22
+ ## What's Included
23
+
24
+ ### Detection Engine
25
+ - Regex patterns for: emails, SSNs, phone numbers, credit cards, addresses, names
26
+ - Configurable sensitivity levels
27
+ - Web Worker isolation for ReDoS protection
28
+
29
+ ### Document Processors
30
+ - XLSX parser with column selection
31
+ - Metadata stripping on output
32
+ - Formula detection warnings
33
+
34
+ ### Utilities
35
+ - PII masking (partial masks, full redaction)
36
+ - Secure random ID generation
37
+ - File type validation via magic bytes
38
+
39
+ ### React Hooks
40
+ - `useDocumentProcessor` - Main processing orchestration
41
+ - `useOfflineEnforcement` - Privacy mode state machine
42
+ - `useFileEntropy` - Before/after verification
43
+
44
+ ## Usage
45
+
46
+ ```typescript
47
+ import {
48
+ regexDetectionEngine,
49
+ getProcessorForFile,
50
+ useDocumentProcessor,
51
+ type Detection,
52
+ } from '@pacamelo/core';
53
+
54
+ // Detect PII in text
55
+ const result = await regexDetectionEngine.detect(content, config);
56
+ console.log(result.detections); // Array of Detection objects
57
+
58
+ // Process a file
59
+ const processor = getProcessorForFile(file);
60
+ const parsed = await processor.parse(file);
61
+ const blob = await processor.applyRedactions(parsed, redactions);
62
+ ```
63
+
64
+ ## Security Features
65
+
66
+ - **ReDoS Protection**: Regex runs in Web Workers with enforced timeouts
67
+ - **Memory Cleanup**: Buffers zeroed after processing (best-effort in JS)
68
+ - **Metadata Stripping**: Output files rebuilt without hidden content
69
+ - **Offline Mode**: Encourages airplane mode during sensitive processing
70
+
71
+ ## License
72
+
73
+ MIT - See [LICENSE](./LICENSE)
74
+
75
+ ## Contributing
76
+
77
+ Issues and PRs welcome at [github.com/Pacamelo/purge-core](https://github.com/Pacamelo/purge-core).