pamoja-audit
A tamper-evident, hash-chained log; altering, reordering, or dropping a record breaks verification. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
pip install pamoja-audit
from pamoja import audit
This pulls in pamoja-native, the compiled engine, and pamoja-security. pip install pamoja is the whole framework in one package.
Example
The script the test suite runs, spliced here as it ran.
From bindings/python/guides/audit.py:
from pamoja.audit import AuditEntry, AuditLog, verify_chain
from pamoja.core import PamojaError
from pamoja.security import DeviceIdentity
# The controller signs its own log with a provisioned seed and an auditor holds only the
# public half, so a log can be checked anywhere without the device present.
keeper = DeviceIdentity.from_seed(bytes([7]) * 32)
auditor = keeper.public_key
log = AuditLog(keeper)
lit = log.append(b"burner=on")
stopped = log.append(b"burner=off")
print(f"recorded {lit.index} then {stopped.index}")
# Each record hashes its own index, the digest of the record before it, and what it
# carries, so the chain fixes the order as well as the contents.
print(f"chained {stopped.previous == lit.digest}")
verify_chain(auditor, [lit, stopped])
print("verified the whole log is authentic and in order")
# Editing a stored record changes the digest its signature covers.
edited = bytearray(stopped.to_bytes())
edited[-1] ^= 0xFF
tampered = AuditEntry.from_bytes(bytes(edited))
try:
verify_chain(auditor, [lit, tampered])
print("an edited record verified, which should never happen")
except PamojaError as error:
print(f"edited caught: {error}")
# Dropping the first record leaves the survivor chained to a link that is no longer there,
# so a shortened log is caught as readily as an edited one.
try:
verify_chain(auditor, [stopped])
print("a shortened log verified, which should never happen")
except PamojaError as error:
print(f"shortened caught: {error}")
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-audit |
reference, docs.rs |
| TypeScript | @pamoja/audit |
reference |
| Python | pamoja-audit |
reference |
| C# | Pamoja.Audit |
reference |
Documentation
pamoja.auditreference, every class and function in this module.- The Audit log guide, with the same example in Rust, TypeScript, and C#.
- Every capability, and the install page.
License
MIT
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 pamoja_audit-0.1.16.tar.gz.
File metadata
- Download URL: pamoja_audit-0.1.16.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db5cb9f401d65d3e071bc95a9709c28d1dbbaac0e79106c0726bfbae9e7b9d1
|
|
| MD5 |
a3fd2d715f43e84f29059fb21f262d37
|
|
| BLAKE2b-256 |
bfb1b733077a49b753fb52077dc423aa7246f3f7f85646c43ecbbaa2f404bb4b
|
File details
Details for the file pamoja_audit-0.1.16-py3-none-any.whl.
File metadata
- Download URL: pamoja_audit-0.1.16-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1c3ed6204f0fcd207bd96dd3636cca9a7c479928a55ed7e56eb824762d1cff2
|
|
| MD5 |
20b0f72a3f177808bd6855be58bf876a
|
|
| BLAKE2b-256 |
2ee0436370b6d7bda4e65464f616655435de7d2f19d5e9dbcc3d718dc74faaab
|