@agentpassport/core
v0.3.4
Published
TypeScript SDK for agentpassport — the AI passport layer
Readme
@agentpassport/core — TypeScript SDK
Wire-compatible TypeScript SDK for agentpassport. Same four primitives as the Python SDK — cross-language trust chains work out of the box.
Install
npm install @agentpassport/coreQuickstart
import { Agent, InMemoryRevocationRegistry, ScopeError } from "@agentpassport/core"
const revocationRegistry = new InMemoryRevocationRegistry()
const agent = new Agent("ts-agent", { privateKey, revocationRegistry })
// Trust a Python orchestrator
agent.trustKeys({ [orchestratorDid]: orchestratorPublicKey })
// Declare required scope
agent.capability("queryCustomers", { requires: ["read:db:customers"] }, async (task) => {
return { customers: [...] }
})
// Handle incoming task (verifies auth chain automatically)
const result = await agent.handle(task)Primitives
- Identity — Ed25519 keypair →
did:key:z<base58btc>DID (same format as Python) - Auth chain — sign/verify EdDSA JWTs,
verifyAuthChain()mirrors Python exactly - TrustMiddleware — scope declaration + enforcement,
ScopeErroron violation - RevocationRegistry —
InMemoryRevocationRegistryinterface
Wire Compatibility
JWT format is identical to the Python SDK:
- Header:
{"alg":"EdDSA","crv":"Ed25519"} - Claims sorted alphabetically (matches Python's
sort_keys=True) did:key:z<base58btc>with0xed01multicodec prefix
A Python orchestrator can sign a delegation JWT. A TypeScript agent can verify it independently.
Development
npm install
npm test