ENTITY Documentation Portal
Code tutorial 1 - tested

Create, verify and sign with an ENTITY identity

Identity, signing and rotation. Verified against ENTITY main commit 5be325437a63c2efaee0dc3caaae9ab0cd0773d9 using disposable tutorial state.

Download/view the exact source - Open the recorded transcript - Execution record

Watch the tutorial

This video is a transcript replay generated from the exact recorded execution for tutorial 1. The published source and transcript remain authoritative for reproduction.

Run it

$env:ENTITY_ROOT="C:\path\to\ENTITY"
python identity_signing.py

Exact source used

from pathlib import Path
import os
import importlib.util
import shutil

ROOT = Path(os.environ.get("ENTITY_ROOT", Path.cwd())).resolve()
STATE = ROOT / ".tutorial-test-state" / "identity-signing"
if STATE.exists():
    shutil.rmtree(STATE)

def load_source(relative_path: str, module_name: str):
    spec = importlib.util.spec_from_file_location(module_name, ROOT / relative_path)
    module = importlib.util.module_from_spec(spec)
    assert spec.loader is not None
    spec.loader.exec_module(module)
    return module

identity_mod = load_source(
    "src/01_Core_Runtime/identity/canonical_identity.py",
    "entity_identity",
)
vault = identity_mod.EntityIdentityVault(STATE)
manifest = vault.create(
    display_name="Tutorial Developer",
    entity_type="person",
    aliases=["tutorial-developer"],
    metadata={"purpose": "ENTITY code tutorial"},
)
entity_id = manifest["entity_id"]
assert identity_mod.EntityIdentityVault.verify_manifest(manifest)
payload = {
    "action": "TUTORIAL_ASSERTION",
    "subject": "example-object",
    "statement": "Signed by the tutorial ENTITY identity",
}
signature = vault.sign(entity_id, payload)
assert identity_mod.EntityIdentityVault.verify_signature(
    manifest,
    payload,
    signature,
)
rotated = vault.rotate_signing_key(entity_id)
assert identity_mod.EntityIdentityVault.verify_manifest(rotated)

print(f"ENTITY_ID={entity_id}")
print("MANIFEST_VERIFIED=PASS")
print("PAYLOAD_SIGNATURE=PASS")
print("KEY_ROTATION_CONTINUITY=PASS")
print("CLAIM_BOUNDARY=signature proves key control, not truth or ownership")

Recorded run

ENTITY source commit: 5be325437a63c2efaee0dc3caaae9ab0cd0773d9
Recorded on: 2026-09-30 (America/Vancouver)
Command:
  $env:ENTITY_ROOT='E:\ENTITY_ACTIVE\ENTITY_TUTORIAL_TEST'
  E:\ENTITY_ACTIVE\PYTHON311_EMBED\python.exe identity_signing.py

Output:
ENTITY_ID=ent2-lzyx7673zwyufqsmlqqcrgoapijln53bojr6f2ybt5s6p4u7jffq
MANIFEST_VERIFIED=PASS
PAYLOAD_SIGNATURE=PASS
KEY_ROTATION_CONTINUITY=PASS
CLAIM_BOUNDARY=signature proves key control, not truth or ownership

Note: generated identifiers and hashes may differ on each run while the documented invariants must remain the same.
Claim boundary: This example proves the documented code path and its explicit invariants in the recorded environment. It does not independently prove external facts, ownership, payment, market value or production certification.