Other implementations:  Python Node.js Go Rust

The TypeScript implementation provides a typed API for AIOSchema v0.5.5. 70 unit tests plus 12 cross-checks, 14/14 cross-verification vectors passing.

View source → API reference →


Requirements

  • Node.js 18+ (for ts-node execution)
  • TypeScript 4.5+

Install

git clone https://github.com/aioschema/aioschema.git
cd aioschema/implementations/typescript
npm install

Quick Start

import { generateManifest, verifyManifest } from "./index";

// Level 1 -- hash only
const data = new Uint8Array(/* file bytes */);
const manifest = generateManifest(data);

// Level 2 -- with signing
import { generateKeypair } from "./algorithms";

const { privateKey, publicKey } = generateKeypair();
const signed = generateManifest(data, { privateKey });

// Verify
const result = await verifyManifest(data, signed, { publicKey });
console.log(result.success);    // true
console.log(result.matchType);  // "exact"

Multi-hash manifest

const manifest = generateManifest(data, {
  algorithms: ["sha256", "sha384"],
});
// manifest.core.hash_original is an array

Run Tests

# Unit tests (70 tests + 12 cross-checks)
npx ts-node --skip-project test_aioschema_v055.ts

# Cross-verification vectors (14/14)
npx ts-node --skip-project cross_verify_ts.ts

API Summary

Function Description
generateManifest(data, opts?) Generate a manifest from asset bytes
verifyManifest(data, manifest, opts?) Verify asset bytes against a manifest
generateKeypair() Generate an Ed25519 keypair
computeHash(data, alg) Compute a prefixed hash string
canonicalJson(obj) Deterministic sorted-key JSON as Buffer
uuidV7() Generate a UUID v7 string

Full contracts: API.md

Note: TypeScript uses matchType: "exact" where other implementations use match_type: "hard" – these represent the same outcome.


View conformance vectors → View all implementations →