Other implementations:  TypeScript Node.js Go Rust

The Python implementation is the primary reference for AIOSchema v0.5.5. 108 unit tests, 14/14 cross-verification vectors passing.

View source → API reference →


Requirements

  • Python 3.9+
  • cryptography – Ed25519 signing and verification
  • Pillow + numpy – soft binding (pHash) support

Install

pip install cryptography pillow numpy

Clone the implementation directly:

git clone https://github.com/aioschema/aioschema.git
cd aioschema/implementations/python

Quick Start

from aioschema_v055 import generate_manifest, verify_manifest

# Level 1 -- hash only, no signing
manifest = generate_manifest("photo.jpg")

# Level 2 -- with Ed25519 signing
from aioschema_v055 import generate_keypair, creator_id_from_public_key

private_key, public_key = generate_keypair()
creator_id = creator_id_from_public_key(public_key)

manifest = generate_manifest(
    "photo.jpg",
    private_key=private_key,
    creator_id=creator_id,
)

# Verify
result = verify_manifest("photo.jpg", manifest)
print(result.success)      # True
print(result.match_type)   # "hard"

Save and load a sidecar

# Save manifest alongside the file
manifest = generate_manifest("photo.jpg", save_sidecar=True)
# Writes photo.jpg.aios.json

# Load and verify later
import json
from pathlib import Path
from aioschema_v055 import Manifest, verify_manifest

manifest_dict = json.loads(Path("photo.jpg.aios.json").read_text())
manifest = Manifest.from_dict(manifest_dict)
result = verify_manifest("photo.jpg", manifest)

Run Tests

# Unit tests (108 tests)
python -m pytest test_aioschema_v055.py -v

# Cross-verification vectors (14/14)
python cross_verify_python.py

API Summary

Function Description
generate_manifest(file_path, **opts) Generate a manifest for a file
verify_manifest(file_path, manifest, **opts) Verify a file against its manifest
generate_keypair() Generate an Ed25519 keypair
creator_id_from_public_key(pub_key) Derive creator_id from public key
compute_hash(data, algorithm) Compute a prefixed hash string
canonical_json(obj) Deterministic sorted-key JSON

Full contracts: API.md


View conformance vectors → View all implementations →