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

API reference read the guide documentation

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pamoja_audit-0.1.17.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pamoja_audit-0.1.17-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pamoja_audit-0.1.17.tar.gz.

File metadata

  • Download URL: pamoja_audit-0.1.17.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for pamoja_audit-0.1.17.tar.gz
Algorithm Hash digest
SHA256 583943c46b0d39c41230d997b2d226a260fd2f5576121843df6fb637f58d30b4
MD5 05b9f03add84584740f3e61453210cf8
BLAKE2b-256 30b4751f190837353cd6b1aaedf8c4fe64c73bc8768c2eb1746b1f07deb6a43e

See more details on using hashes here.

File details

Details for the file pamoja_audit-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: pamoja_audit-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for pamoja_audit-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 f403738184f91bc9a753402dde3f1b5610e527c39600f1088dd09637a5bb4c76
MD5 5f38c8c136bc4ee7f79d73592d6ca370
BLAKE2b-256 3299ec18724f838a53bd63e8217cdc816b8732cec0cf32bd21bacdbb490b1468

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.17 This release

2 files

0.1.16

2 files

0.1.15

2 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