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

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.15.tar.gz (4.0 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.15-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pamoja_audit-0.1.15.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for pamoja_audit-0.1.15.tar.gz
Algorithm Hash digest
SHA256 7cfdcb791d09c3112879e662e8e9733649985a71bf72b04ef6a0cbc3199a6015
MD5 e713363ec8030017c6fd865bb21cf692
BLAKE2b-256 1cdc0288fed902ec0734b27ee6288a2b5209daaaec46a831c75f7d7d4396e39e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pamoja_audit-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 e8d3079d7d0f89f89737bd5227044f7ca20fbeec96882233fcf1232320b583dc
MD5 a59289619207a9f627764464447f57ed
BLAKE2b-256 7374215497262ff71a7cc2549c610428bf63084c1078f5649fe071194f6f8d6d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.17

2 files

0.1.16

2 files

This release

0.1.15 This release

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