Other implementations:  Python TypeScript Go Rust

The Node.js implementation is a pure CommonJS library with zero external dependencies. 80 unit tests, 14/14 cross-verification vectors passing. Available as @aioschema/js on npm.

View source → API reference →


Requirements

  • Node.js 18+
  • Zero external dependencies (uses node:crypto only)

Install

# As a library
npm install @aioschema/js

# As a CLI
npm install -g @aioschema/cli

Or clone directly:

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

Quick Start

const { generateManifest, verifyManifest } = require('@aioschema/js');
const fs = require('fs');

// Generate a manifest
const manifest = generateManifest('photo.jpg');
// Writes photo.jpg.aios.json

// Verify
const result = await verifyManifest('photo.jpg', manifest);
console.log(result.success);      // true
console.log(result.match_type);   // "hard"

With signing

const { generateManifest, verifyManifest, generateKeypair,
        creatorIdFromPublicKey } = require('@aioschema/js');

const { privateKey, publicKey } = generateKeypair();
const creatorId = creatorIdFromPublicKey(publicKey);

const manifest = generateManifest('photo.jpg', {
  privateKey,
  creatorId,
});

const result = await verifyManifest('photo.jpg', manifest, { publicKey });
console.log(result.signature_verified); // true

CLI Usage

# Generate a manifest
aioschema generate report.pdf

# Generate with SHA-384
aioschema generate report.pdf --algorithm sha384

# Generate with creator ID and extensions
aioschema generate article.md \
  --creator-id ed25519-fp-7fcc5530c17565c99ea02d846ab0b5eb \
  --ext asset_type=document \
  --ext description="Q1 Report"

# Verify
aioschema verify report.pdf report.pdf.aios.json

Run Tests

# Unit tests (80 tests, includes TV-19 key rotation extension)
node test_aioschema_v055.js

# Unit tests only (without TV-19)
node unit_tests_node.js

# Cross-verification vectors (14/14)
node cross_verify_node.js

API Summary

Function Description
generateManifest(filePath, opts?) Generate and optionally save a manifest
verifyManifest(filePath, manifest, opts?) Verify a file against its manifest
generateKeypair() Generate an Ed25519 keypair
creatorIdFromPublicKey(pubKeyBytes) Derive creator_id from public key
computeHash(data, algorithm?) Compute a prefixed hash string
canonicalJson(obj) Deterministic sorted-key JSON string
uuidV7() Generate a UUID v7 string

Full contracts: API.md

Note: The Node.js test suite includes TV-19 (key rotation via previous_version_anchor) as an extension beyond the v0.5.5 conformance requirement. TV-19 will be canonicalized in v0.5.6.


View conformance vectors → View all implementations →