Developer Portal

API explorer, SDK references, and protocol documentation for the Attestik Protocol.

Interactive API Explorer

Try every endpoint live. Click to expand, fill parameters, and send requests.

Wire Format Explorer

Paste raw Attestik frame bytes to parse and inspect the binary structure.

SDK Reference

Integration code for WASM, Rust, and CLI. Same operations, three runtimes.

Use the WASM verifier for in-browser verification. The module is ~180KB gzipped and requires no server round-trip. Install via npm:

bash
npm install @attestik/verify
javascript
import init, {
  verify_cose_sign1,
  parse_cose_sign1,
  extract_from_emsg,
  extract_from_id3,
  compute_l2_hashes,
} from '@attestik/verify';

// Initialize WASM module
await init();

// Verify a COSE_Sign1 attestation against its media segment
const result = verify_cose_sign1(frameBytes, segmentBytes);
console.log(result.overall_state); // 'Verified'
console.log(result.signature_valid); // true
console.log(result.binding_ok);      // true

// Parse COSE_Sign1 structure without verification
const info = parse_cose_sign1(frameBytes);
console.log(info.publisher_id);  // hex entity ID
console.log(info.stream_id);     // hex stream ID
console.log(info.seq);           // segment sequence number
console.log(info.frame_type);    // 'Full' | 'Delta' | 'Heartbeat'

// Extract attestation from fMP4 emsg boxes
const emsgFrames = extract_from_emsg(fmp4Segment);

// Extract attestation from HLS ID3 timed metadata
const id3Frames = extract_from_id3(tsSegment);

// Compute codec-level (L2) hashes for content binding
const l2 = compute_l2_hashes(segmentBytes);
console.log(l2.slice_hash); // SHA-256 over H.264 slice NAL bodies

Test Vectors

Golden test data for validating your implementation. Use these fixed inputs to verify deterministic outputs.

Fixed Inputs

secret_key:
9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60
media_bytes:
48656c6c6f2c20776f726c6421
timestamp:
1700000000
seq:
0
publisher_name:
test-vector-publisher

Expected Outputs

entity_id:
b560c300cc7bf8d91e874423c1dc5da161ce3aa4
public_key:
d75a980182b10ab7d54bfed3c964073a0ee172f3daa3f4a18446b7b8b7a08627
media_sha256:
315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
frame_magic:
0x4154
frame_version:
0x02
Copy full test vector as JSON

Protocol Reference

Wire format specification, verification states, content binding levels, and frame types.

Wire Format

Every Attestik frame follows a fixed binary layout: 8-byte header, variable-length CBOR payload, and 64-byte Ed25519 signature.

+------------------------------------------+
| COSE_Sign1_Tagged (Tag 18, RFC 9052)     |
+------------------------------------------+
| PROTECTED HEADER (CBOR map)              |
|  alg: EdDSA (-8)                         |
|  content_type: "vnd.attestik.frame"      |
+------------------------------------------+
| UNPROTECTED HEADER                       |
|  kid: entity_id bytes(32)                |
+------------------------------------------+
| CBOR PAYLOAD (variable length)           |
|  0: version     : uint (2)               |
|  1: frame_type  : uint                   |
|  2: entity_id   : bytes(32)              |
|  3: seq         : uint                   |
|  4: timestamp   : uint                   |
|  5: content_bind: {                      |
|    1: l1_hash   : bytes(32) // bitstream |
|    2: l2_hash   : bytes(32) // codec     |
|    3: l3_hash   : bytes(32) // pHash     |
|    9: l4_grid   : {rows,cols,hashes}     |
|   10: l5_audio  : bytes(32) // chroma    |
|  }                                       |
|  7: prev_hash   : bytes(32)              |
+------------------------------------------+
| ED25519 SIGNATURE (64 bytes)             |
| Sign(Sig_structure per RFC 9052)         |
+------------------------------------------+

Verification States

Each segment resolves to one of nine states based on signature validity, content binding level, chain integrity, and registry status.

Verified

L1 + L2 + L5 match, signature valid, chain intact. Bit-exact original with full audio binding.

Verified (Partial)

Some segments modified post-stamp. Signature valid on remaining segments, chain broken at modification point.

Verified (Moderate)

L3 perceptual hash + L4 spatial blocks match. Content transcoded but structurally intact. Tier 2 classification.

Verified (Weak)

L1 bitstream hash fails but L2 codec-level hash passes. Content semantically unchanged (e.g., re-muxed).

Identity Only

Ed25519 signature valid, but no content binding data present in frame. Publisher authenticated, content not bound.

Anomaly

L3 perceptual match but L4 spatial blocks or L5 audio fingerprint mismatch. Possible localized edit — requires investigation. Tier 3.

Unverified

Signature invalid or missing. No cryptographic proof of origin or integrity. Tier 4.

Revoked

Publisher entity has been revoked in the registry. Content may have been valid but publisher key is no longer trusted.

Error

Verification could not complete due to a system error — malformed frame, missing data, or internal failure.

Content Binding Levels

Five binding layers provide graduated resilience. Each layer survives progressively more transformations while detecting different tampering vectors.

L1 - Bitstream Hash

SHA-256 of exact segment bytes. Detects any byte-level modification including re-encoding, re-muxing, and metadata changes. The gold standard for pristine verification.

SHA-256(segment_bytes) -- fails on any byte change
L2 - Codec-Level Hash

SHA-256 over H.264 slice NAL bodies only. Survives re-muxing, parameter set changes, SEI injection/removal, and container format changes.

SHA-256(slice_nal_bodies[]) -- survives remux, SEI changes
L3 - Perceptual Hash (pHash)

DCT-based perceptual hash of decoded video frames. 256-bit 4-quadrant spatial hash resilient to transcoding, bitrate changes, and social platform re-encoding. Global content similarity check.

pHash_256(decoded_frames) -- survives transcode, social upload
L4 - Spatial Block Grid

16×16 spatial block grid with per-block DCT hashes. Detects localized edits like face blur, object removal, text overlay, or muzzle flash deletion while surviving global transcode.

DCT_block[16x16] -- detects localized spatial edits
L5 - Audio Fingerprint

Chromagram-based audio fingerprint via STFT (4096 Hann, 2048 hop). Binary-thresholded 12-bin chroma matrix digested to SHA-256. Detects spliced speech, removed gunshots, and AI-generated audio replacement.

SHA-256(chromagram_matrix) -- detects audio tampering

Frame Types

Three frame types balance completeness against size. A typical stream starts with Full, continues with Delta, and uses Heartbeat for keepalive.

Full (0x01)300-800 bytes

Complete attestation frame. Contains publisher key, stream ID, all content binding levels, attestation metadata, and full signature. Sent at stream start and periodically for resynchronization.

Delta (0x02)120-250 bytes

Incremental frame with content binding + prev_frame_hash. Maintains hash chain continuity without repeating publisher identity. Requires a preceding Full frame for context.

Heartbeat (0x03)80-110 bytes

Minimal keepalive frame for continuous stream verification. Contains only timestamp, sequence number, and prev_frame_hash. Proves stream is still live and controlled by the signer.