Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spellguard.ai/llms.txt

Use this file to discover all available pages before exploring further.

Quick Start

import { fetchAndVerifyVerifier, buildEvidence, signEvidence } from '@spellguard/ctls';
import { encryptForVerifier } from '@spellguard/amp';

// 1. Verify Verifier before connecting
const verifier = await fetchAndVerifyVerifier(verifierUrl, expectedImageHash);
if (!verifier.verified) throw new Error('Verifier verification failed');

// 2. Register with the Verifier
const evidence = buildEvidence({
  agentId: 'my-agent',
  codeHash: 'sha256:abc123...',
  endpoint: 'https://my-agent.com/_spellguard/receive',
  agentCardUrl: 'https://my-agent.com/.well-known/agent.json',
});
const signed = await signEvidence(evidence, privateKey);

// 3. Send encrypted messages
const encrypted = encryptForVerifier(
  JSON.stringify(payload),
  verifier.sessionX25519PublicKey
);

Installation

npm install @spellguard/ctls @spellguard/amp