Metadata-Version: 2.4
Name: snapchore-core
Version: 0.1.0
Summary: Cryptographic integrity for stateful events — hash, chain, verify.
Author-email: TowerAI <dev@towerai.dev>
License: Apache-2.0
Project-URL: Homepage, https://snapchore.dev
Project-URL: Documentation, https://docs.snapchore.dev
Project-URL: Repository, https://github.com/ToweraiDev/snapchore-core
Keywords: snapchore,smartblock,integrity,hashing,chain-of-custody
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: image
Requires-Dist: Pillow>=9.0; extra == "image"
Provides-Extra: device
Requires-Dist: python-dateutil>=2.8; extra == "device"

# snapchore-core

Cryptographic integrity for stateful events — hash, chain, verify.

SnapChore Core is the local hashing library for the SmartBlocks protocol. It provides deterministic, content-addressed block creation with zero network dependencies.

## Install

```bash
pip install snapchore-core
```

Optional extras:

```bash
pip install snapchore-core[image]   # Pillow for image metadata extraction
pip install snapchore-core[device]  # Device capture utilities
```

## Quick start

```python
from snapchore import SmartBlock, SnapChoreChain

# Seal a single event
block = SmartBlock(domain="ai.inference", payload={"tokens": 1500})
block.seal()
assert block.verify()

# Chain multiple events into a tamper-evident ledger
chain = SnapChoreChain()
chain.append(block)

block2 = SmartBlock(domain="ai.inference", payload={"tokens": 2300})
block2.seal()
chain.append(block2)
assert chain.verify()
```

### Lower-level API

```python
from snapchore import snapchore_capture, snapchore_verify

data = {"model": "gpt-4", "tokens": 1500}
h = snapchore_capture(data)
assert snapchore_verify(data, h)
```

## What it does

- **Canonical serialization** — deterministic JSON surface with float quantization and stable timestamps
- **SmartBlock** — content-addressed container with domain tagging and metadata
- **SnapChoreChain** — linked hash ledger for tamper-evident event sequences
- **Capture / Verify** — convenience functions for one-shot hashing and verification

## Relationship to sbn-sdk

`snapchore-core` handles local computation (hashing, chaining, verification) with no network calls. To submit blocks to the SmartBlocks Network, use the [sbn-sdk](https://pypi.org/project/sbn-sdk/) which includes a `SnapChoreClient` for server-side sealing, discovery, and chain management.

## License

Apache-2.0
