Docs/Conformance Tests
Reference

Conformance Test Vectors

Test vectors for validating your AGA implementation. Use these to verify canonicalization, signature generation, chain validation, and tamper detection.

Warning: Test keys and vectors are for conformance testing only. Never use test keys in production. Generate fresh keypairs for real deployments.

tv-jcs-001

TV-JCS-001: Canonicalization

Verify JCS (RFC 8785) canonicalization produces deterministic output.

Input
{
  "artifact_id": "art_01HXYZTEST0000000000000001",
  "measurement_id": "m_0001",
  "measurement_time": 1735600000,
  "run_id": "run_01HXYZTEST0000000000000001",
  "sequence_number": 1,
  "stream_id": "pressure_psi",
  "value": 42
}
Expected Output
uM22uzzEnt39f1ZO14U_gZ7C7mGvCW87JPKCvgRGe-Q

Keys must be sorted lexicographically. No whitespace. Numbers without quotes.

tv-sig-001

TV-SIG-001: Ed25519 Signature

Verify Ed25519 signature generation and verification.

Input
Test Keys (FOR TESTING ONLY - NEVER USE IN PRODUCTION):
────────────────────────────────────────────────────
Public Key:  lKRKF0qyRCAgAy20lqWwTunJjnb8Id7ijIHcoXaWmrg
Private Key: S38UdZHLAVZYYoGvjvmF1gp-L2Yo6KDXAPukOiLMMx0
Key ID:      36ee3280c62ed537

Message (canonical bytes of TV-JCS-001 input):
{"artifact_id":"art_01HXYZTEST0000000000000001","measurement_id":"m_0001","measurement_time":1735600000,"run_id":"run_01HXYZTEST0000000000000001","sequence_number":1,"stream_id":"pressure_psi","value":42}
Expected Output
uqon4tfDmyfYaM9txEyQAHlHPRQVc3Qrw22_0PnFpuEAlrDA8kwnOh4eNa76SdA0d9099mbRh8WRKB0uJurjCg

Signature is over canonical JSON bytes, not the hash. Use base64url encoding.

tv-chain-001

TV-CHAIN-001: Receipt Chaining

Verify receipt hash chain continuity.

Input
Receipt #1 (Genesis):
{
  "sequence_number": 1,
  "chain": {
    "prev_receipt_hash": "0000000000000000000000000000000000000000000000000000000000000000",
    "this_receipt_hash": "sha256:a1b2c3d4..."
  }
}

Receipt #2:
{
  "sequence_number": 2,
  "chain": {
    "prev_receipt_hash": "sha256:a1b2c3d4...",  // Must match receipt #1 this_receipt_hash
    "this_receipt_hash": "sha256:e5f6g7h8..."
  }
}
Expected Output
Chain is valid when each prev_receipt_hash equals the previous receipt's this_receipt_hash

Genesis receipt has prev_receipt_hash of 64 zeros. Counter must be monotonically increasing.

tv-keyid-001

TV-KEYID-001: Key ID Derivation

Verify key_id is derived correctly from public key.

Input
Public Key (base64url): lKRKF0qyRCAgAy20lqWwTunJjnb8Id7ijIHcoXaWmrg

Derivation:
1. Decode public key from base64url to bytes
2. SHA-256 hash the raw bytes
3. Take first 8 bytes (16 hex characters)
Expected Output
36ee3280c62ed537

Key ID is lowercase hex. Used for key lookup without exposing full public key.

tv-tamper-001

TV-TAMPER-001: Tamper Detection

Verify single-byte modification is detected.

Input
Original receipt JSON:
{"sequence_number":1,"value":42}

Modified receipt JSON (change 42 to 43):
{"sequence_number":1,"value":43}
Expected Output
RECEIPT_SIGNATURE_INVALID or RECEIPT_HASH_MISMATCH

Any modification must cause verification failure. Verifier must identify which receipt failed.

Running Conformance Suite

# Download conformance test runner
curl -LO https://attestedintelligence.com/downloads/conformance-tests.zip
unzip conformance-tests.zip

# Run all tests
node run-conformance.js

# Expected output:
# ✓ TV-JCS-001: Canonicalization      PASS
# ✓ TV-SIG-001: Ed25519 Signature     PASS
# ✓ TV-CHAIN-001: Receipt Chaining    PASS
# ✓ TV-KEYID-001: Key ID Derivation   PASS
# ✓ TV-TAMPER-001: Tamper Detection   PASS
# ═══════════════════════════════════════
# All 5 tests passed