Skip to main content

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#.

read the guide documentation API reference

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, install
TypeScript @pamoja/audit reference, install
Python pamoja-audit reference, install
C# Pamoja.Audit reference, install

Documentation

License

MIT

Release files for pamoja-audit 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pamoja-audit 0.1.18
File Size Uploaded
pamoja_audit-0.1.18.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pamoja-audit 0.1.18
File Interpreter ABI Platform
pamoja_audit-0.1.18-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / pamoja_audit-0.1.18.tar.gz

Download URL pamoja_audit-0.1.18.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5e67b0b1601776c150e54c1d8b15a3130ca13352108e36aded4c4ca732ecfed1
BLAKE2b-256 checksum
How to use checksums
a317a1bb71c192bd11fa00b61a9907b42a67cfa339d4225babb2983193a4762d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pamoja_audit-0.1.18-py3-none-any.whl

Download URL pamoja_audit-0.1.18-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b40171a2e73e260f0e50bbc383ef8f0a8ed282fee9e8b82044a58a6b67d72fc
BLAKE2b-256 checksum
How to use checksums
72a75135cf1845fc11a8e345e289ac31ebe6385246c4dfbff4ca02ba2eccfa87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.18 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page