This release is a pre-release and may not be stable for production use.
DataFog Core
Find and transform sensitive data in your application.
Quickstart · Detection · Transformations · Local models · Documentation
DataFog Core is a Rust library with Python, Node.js, and browser WebAssembly bindings. Scan text or JSON for personal data and credentials, then redact, mask, remove, pseudonymize, or tokenize matched values. Findings use a consistent format across the bindings.
Rule-based scanning runs locally without model weights or downloads. Optional local model sessions add DataFog and GLiNER2 support in Rust, Python, and Node.js.
Stable: 0.4.4 · Model beta: 0.4.5-beta.3
Quickstart
Choose the package for your application:
| SDK | Install stable | Requirements |
|---|---|---|
| Python | python -m pip install datafog-core |
Python 3.10+ |
| Node.js | npm install @datafog/node |
Node.js 24.x |
| Rust | cargo add datafog-core |
Rust 1.88+ |
| Browser / WASM | npm install @datafog/wasm |
Browser with WebAssembly support |
Python
from datafog_core import scan, scan_and_transform
findings = scan("Email jane@example.com")
print(findings[0].entity_type) # EMAIL
print(findings[0].matched_text) # jane@example.com
result = scan_and_transform(
"Email jane@example.com",
{"transform": {"default": {"strategy": "redact"}}},
)
print(result.text) # Email [EMAIL]
Node.js example
import { scan, scanAndTransform } from "@datafog/node";
const findings = scan("Email jane@example.com");
console.log(findings[0].entityType); // EMAIL
console.log(findings[0].matchedText); // jane@example.com
const result = scanAndTransform("Email jane@example.com", {
transform: { default: { strategy: "redact" } },
});
console.log(result.text); // Email [EMAIL]
Rust example
use datafog_core::{
scan, scan_and_transform, PrivacyError, ScanAndTransformConfig,
TransformationConfig, TransformationStrategy,
};
fn main() -> Result<(), PrivacyError> {
let findings = scan("Email jane@example.com");
println!("{}", findings[0].entity_type); // EMAIL
println!("{}", findings[0].matched_text); // jane@example.com
let result = scan_and_transform(
"Email jane@example.com",
&ScanAndTransformConfig::new(TransformationConfig::new(
TransformationStrategy::Redact,
)),
)?;
println!("{}", result.text); // Email [EMAIL]
Ok(())
}
Browser / WASM example
import { init, scan, scanAndTransform } from "@datafog/wasm";
await init();
console.log(scan("Email jane@example.com"));
const result = scanAndTransform("Email jane@example.com", {
transform: { default: { strategy: "redact" } },
});
console.log(result.text); // Email [EMAIL]
Python and Node.js packages include prebuilt native binaries for Linux x64 and ARM64 (GNU), macOS Intel and Apple Silicon, and Windows x64 (MSVC).
Detection coverage
| Coverage | Entity types | Activation |
|---|---|---|
| Personal and financial data | EMAIL, PHONE, SSN, CREDIT_CARD, IP_ADDRESS, DATE, ZIP_CODE |
On by default |
| Credentials | API_KEY, BEARER_TOKEN, JWT, PRIVATE_KEY, CREDENTIAL_URI |
On by default |
| Labeled US identifiers | US_ROUTING_NUMBER, NPI |
On by default; requires a supported text label |
| German identifiers | IBAN, VAT ID, tax ID, social security number, postal code, passport number, residence permit number | Explicit German locale |
| UUIDs | UUID |
Explicit detect_uuid setting |
| Names in JSON fields | PERSON |
Structured scans, using name-field aliases or explicit JSON Pointer mappings |
Use structured scans to find names by JSON field, or local models to detect names and street addresses in prose.
Each finding includes its entity type, matched text, byte and code-point ranges, optional confidence, and detector name/version. Ranges are zero-based and end-exclusive. Node.js and WASM also provide UTF-16 ranges for JavaScript slice. Rule-based findings have no confidence score. Findings and ranges →
For scanning files from AI agents, use DataFog MCP.
Detection settings
- Select checks:
scan(text, {"entities": ["EMAIL", "SSN"]})in Python runs only the selected text detectors. Omitentitiesto use all enabled detectors. Selections must be nonempty, unique, exact entity names. Selecting a German type or UUID does not activate it; setlocaleordetect_uuidtoo. - German locale:
{"locale": "de"}enables the seven German detectors. These use format/context rules; IBAN checksums and account existence are not verified. See the German reference for detector rules. - ENV and SQL: choose
format: "env"orformat: "sql"to handle email boundaries in assignments and quoted strings. Source-context rules → - Phone numbers: numbers without
+use North American checks: ten digits, optionally preceded by1, with area and exchange codes starting with2–9. Numbers starting with+use a permissive 7–15 digit check, including shortened examples such as+1-555-1002. Country codes and assigned numbers are not validated; numeric identifiers can still match. - Decimal numbers and CSV: contiguous card digits after a digit and
.or,are suppressed, so3.4111111111111111and3,4111111111111111do not produce card findings. Cards containing spaces or hyphens still undergo normal checks. Parse CSV/TSV into cells before scanning so delimiters and adjacent fields do not affect matching.
Use capabilities() in Rust or Python to discover supported entities and their activation rules.
Transformations
| Strategy | Result | Application provider | Browser / WASM |
|---|---|---|---|
redact |
Replace with a label such as [EMAIL] |
None | Supported |
mask |
Replace characters, optionally revealing the first or last characters | None | Supported |
remove |
Delete the matched span | None | Supported |
pseudonymize |
Create a stable keyed HMAC-SHA-256 pseudonym | Key provider | Unsupported |
tokenize |
Issue an opaque token that can be restored under the same scope | Token provider | Unsupported |
Use transform with existing findings, or scan_and_transform / scanAndTransform to scan and transform together. Transformation records include source/output ranges and replacement metadata, without the original matched text.
Keep scan settings under scan and transformation policy under transform. A default strategy is required; entity selection, per-type overrides, and allowlists are optional. Configuration guide → · Strategy details →
Local models (beta)
0.4.5-beta.3 adds local sessions for the DataFog PII model and GLiNER2 in Rust, Python, and Node.js on all five native platforms.
Install the beta for your runtime:
python -m pip install 'datafog-core==0.4.5b3'
npm install @datafog/node@beta
cargo add datafog-core@0.4.5-beta.3 --features models
For GLiNER2, install its optional dependencies in the Python environment used by the runner:
python -m pip install 'datafog-core[gliner2]==0.4.5b3'
The GLiNER2 runner ships in the Python package and also serves Node.js and Rust callers. Download and verify model files separately, then use ModelSession.open, text scan, and close. Reuse sessions across calls. Both backends return consistent results and errors, with cancellation and cleanup support.
DataFog setup and session API → · GLiNER2 setup →
Documentation and development
- Installation and runtime requirements
- Python · Node.js · Rust · Browser / WASM API references
- Structured JSON scans and name-field discovery
- Configuration and allowlists
- Errors and 0.4.x compatibility
- Build, test, and contribute
- Release notes
For existing datafog Python applications, follow the migration guide for changes to imports, results, and transformations.
For Rust development, run:
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
See the development guide for the repository layout and Python, Node.js, and WASM package checks.
License
Metadata
Release files for datafog-core 0.4.5b3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| datafog_core-0.4.5b3.tar.gz | 143.7 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| datafog_core-0.4.5b3-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| datafog_core-0.4.5b3-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| datafog_core-0.4.5b3-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 9.6 MB
Release files / datafog_core-0.4.5b3.tar.gz
| Download URL | datafog_core-0.4.5b3.tar.gz |
|---|---|
| Size | 143.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5834c6aec0ac06ef352de479af7af364e90ba3334fee60e147c5bd359294ccad
|
|
BLAKE2b-256 checksum How to use checksums |
786f5a1018a8e1acfba00dd9acd4f2033d927f8c8068e1a413e0733d88171a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / datafog_core-0.4.5b3-cp310-abi3-win_amd64.whl
| Download URL | datafog_core-0.4.5b3-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d66cdfab9b5593dd43a7e3984a3d570e4570c5f05a6f131f84ad5e1f5148e89e
|
|
BLAKE2b-256 checksum How to use checksums |
d58e68a32acfe37ecc6496d7c72080d1a87cd863d817fd19f99767adde35707e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2c93d0da92985a1e219e8022f50fb684cb6dce2c1ae7993db4509f96cab3ff01
|
|
BLAKE2b-256 checksum How to use checksums |
9b2a109a6dbf1e16c6eb5f6775f23da4b837a1d9860bb231a134b421b12f0df5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | datafog_core-0.4.5b3-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5ef8e2796e513e2760ba0f5b00feaa9958a1fa97b9a7b63d13a6b387c9e93ba7
|
|
BLAKE2b-256 checksum How to use checksums |
b9a3e4784d4c9f2cddf4afa8ab11508146b0a467dc22cec8d58fad13d6034739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / datafog_core-0.4.5b3-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | datafog_core-0.4.5b3-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c9fc6dd7c3f9afd14b3f5cdca051dc7e6d9f54bdf77d2baf39afad8e8ec7ca20
|
|
BLAKE2b-256 checksum How to use checksums |
b50531f516a9bf9cf73339f7f36e57d6536d779bb0c780d5ac253b442846e61a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / datafog_core-0.4.5b3-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | datafog_core-0.4.5b3-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
63ef541a3547fc11867555e2231e24f9b1bde4b73f0b63d77555b36c271e33ab
|
|
BLAKE2b-256 checksum How to use checksums |
d23b093ae6503226d9fa29e07ded09d833e7ac70a5ad2ec9f90c27d18745969e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for datafog-core 0.4.5b3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for datafog_core-0.4.5b3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.