Metadata-Version: 2.4
Name: winnex-tracer-core
Version: 1.0.2
Summary: The shared base for the Winnex tracer family — WORM storage, Ed25519/ICP signing, tamper-evident audit log, retention policies and the AuditCommitment (non-repudiation). Reused by tracer-gov, tracer-med, tracer-jus and tracer-gap.
Home-page: https://github.com/winnex-ai/winnex-tracer-core
Author: Klenio Araujo Padilha
Author-email: Winnex Brasil Soluções Empresariais LTDA-ME <pay@winnex.ai>
License: Business Source License 1.1
        
        License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
        "Business Source License" is a trademark of MariaDB Corporation Ab.
        
        Parameters
        
        Licensor:             Winnex AI
        Licensed Work:        Tracer-GOV
        Additional Use Grant: Free for Brazilian government agencies.
                              Any use by a public sector entity in Brazil is permitted.
        
        Change Date:          2036-01-01
        Change License:       GNU General Public License v2.0 or later
        
        For inquiries: pay@winnex.ai
        
Project-URL: Homepage, https://winnex.ai
Project-URL: Source, https://github.com/winnex-ai/winnex-tracer-core
Keywords: audit,worm,ed25519,compliance,vector-search,proof,cauchy-schwarz,tracer,lgpd,gdpr,hipaa,signature,non-repudiation,immutable,hash-chain,regulated,government
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Other Audience
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Legal Industry
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Provides-Extra: signature
Requires-Dist: pynacl>=1.5; extra == "signature"
Provides-Extra: pg
Requires-Dist: psycopg2-binary>=2.9; extra == "pg"
Provides-Extra: blockchain
Requires-Dist: web3>=6.0; extra == "blockchain"
Provides-Extra: all
Requires-Dist: pynacl>=1.5; extra == "all"
Requires-Dist: psycopg2-binary>=2.9; extra == "all"
Requires-Dist: web3>=6.0; extra == "all"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# winnex-tracer-core

**The shared base for the Winnex tracer family — a pip package.**

Generic infrastructure reused by `tracer-gov`, `tracer-med`, `tracer-jus` and
`tracer-gap` (each a separate pip package that depends on this one):

| Module | What it provides |
|---|---|
| `winnex_tracer_core.persistence` | `WormStorage` (WORM JSONL + SHA3-256 hash chain), `PgStore`, `BlockchainStore`, `FileStore` |
| `winnex_tracer_core.core.Signer` | Ed25519 / ICP-Brasil digital signatures |
| `winnex_tracer_core.core.AuditLogTracker` | Tamper-evident self-audit log (HMAC chain) |
| `winnex_tracer_core.core.RetentionPolicy` | Configurable retention (5-20 years) |
| `winnex_tracer_core.core.commitment` | **AuditCommitment** — the lightweight (~500 B) signed audit record for the WORM |

## AuditCommitment (the production audit-trail path)

The C++ motor (`winnex-madhava >= 1.9.2`) returns a compact commitment
(`total_excluded_count` + `global_threshold` + a deterministic boundary
sample) instead of the full O(N) certificate (~2 MB at scale). This layer
signs it with **Ed25519** for non-repudiation, then stores the ~500-byte
record in the WORM.

```python
from winnex_tracer_core.core import make_worm_record, verify_record, public_key_hex
from winnex_tracer_core.persistence import WormStorage

# engine = winnex_madhava engine with search_with_commitment
record = make_worm_record(engine, query, k=10, max_sample=50)  # ~500 B
worm = WormStorage(base_path="/var/lib/tracer/worm")
worm.append(record)

# Auditor: verify non-repudiation
v = verify_record(record, public_key_hex())
assert v["status"] == "VALID"
```

The signing key comes from `WORM_SIGNING_PRIVATE_KEY_HEX` (or `_FILE`) — held
outside the C++ binary, so a compromised engine cannot forge past records.

## The layer architecture

```
winnex-madhava        (motor C++20, pip)   — the search engine + bound
winnex-tracer-core    (base, pip)          — WORM, Signer, AuditLog, commitment  ← THIS PACKAGE
  ├─ tracer-gov       (domínio governo)    — depends on winnex-tracer-core
  ├─ tracer-med       (domínio saúde)      — depends on winnex-tracer-core
  ├─ tracer-jus       (domínio legal)      — depends on winnex-tracer-core
  └─ tracer-gap       (domínio financeiro) — depends on winnex-tracer-core
        │
        ▼  (REST API de cada domínio)
Consumo final: Liferay (tracer-gov-liferay, tracer-med-liferay) e qualquer
outra plataforma (Pinecone, Weaviate, aplicações próprias) que chame o REST
dos domínios. O Liferay é UM dos consumidores finais, não a base.
```

## Install

```bash
pip install -e .               # core (numpy)
pip install -e ".[signature]"  # + PyNaCl (Ed25519)
pip install -e ".[all]"        # + pg + blockchain
```

## License

Business Source License 1.1 (BSL 1.1) | pay@winnex.ai |
Winnex Brasil Soluções Empresariais LTDA (CNPJ 58.364.637/0001-47)
