Hash-chained append-only audit log. Python companion to @ujex/audit-chain (TypeScript). Stdlib-only.
Project description
ujex-audit-chain (Python)
Python companion to @ujex/audit-chain (TypeScript).
Hash-chained append-only log. Stdlib only — no external dependencies.
Wire format is identical to the TypeScript package. A chain serialized in one language verifies in the other.
Install
pip install ujex-audit-chain
Requires Python 3.10+.
Usage
from ujex_audit_chain import Chain, VerifyResult
chain = Chain()
entry = chain.append(
{"actor": "agent-hello", "action": "postbox.send", "meta": {"to": "alice"}}
)
# entry.seq, entry.timestamp, entry.payloadHash, entry.prevHash, entry.entryHash
result = chain.verify() # VerifyResult(ok=True, broken_at=None, reason=None)
blob = chain.serialize() # list[dict] — JSON-safe
restored = Chain.from_entries(blob)
Wire format
payloadHash = sha256_hex(canonical_json(payload))
entryHash = sha256_hex(prevHash || payloadHash || str(timestamp_ms) || str(seq))
Canonical JSON = json.dumps(..., sort_keys=True, separators=(',', ':'), ensure_ascii=False). Hex digests are lowercase, 64 chars.
For full details see the TypeScript package README.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ujex_audit_chain-0.2.0.tar.gz.
File metadata
- Download URL: ujex_audit_chain-0.2.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
127b26585b1b7ab0d2b561f01516b5d4e54846e514e5d0ed1b4d440154b56a4f
|
|
| MD5 |
a1bbc28f4b22d3a0c7938704d88e628b
|
|
| BLAKE2b-256 |
5c2241d6c325adec07f67e817edff21ae10f886aee95ca529705bbe30dd5dc6a
|
File details
Details for the file ujex_audit_chain-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ujex_audit_chain-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9795e3c7b08603d856bbd83d50a48617f1fc4f3e2c141953bb6715f9df53868
|
|
| MD5 |
a5be7ac99d8ec259d6b7f3b2c98dcd51
|
|
| BLAKE2b-256 |
921ae776011f07ceb7bd0be89ec77491b7cbb69d4867b3156d46033cc3d49d31
|