@agentcred-ai/sdk
v0.1.3
Published
Core SDK for AgentCred - sign, verify, and manage agent credentials
Maintainers
Readme
@agentcred-ai/sdk
Core SDK for AgentCred — sign, verify, and manage agent credentials with Ed25519 cryptography.
Installation
npm install @agentcred-ai/sdkOr with pnpm:
pnpm add @agentcred-ai/sdkQuick Start
import { createIdentity, loadIdentity, sign, verify } from '@agentcred-ai/sdk'
// 1. Create identity (linked to your GitHub account)
const identity = await createIdentity(githubToken)
// 2. Load identity (including private key) from storage
const loaded = await loadIdentity(identity.github.username)
// 3. Sign your agent's output
const envelope = await sign("Hello from my verified agent!", {
privateKey: loaded.privateKey,
github: identity.github.username
})
// 4. Anyone can verify
const result = await verify(envelope)
console.log(result.verified) // true
console.log(result.github.username) // "yourname"API Reference
Core Functions
| Function | Description |
|----------|-------------|
| createIdentity(token, options?) | Initialize identity with GitHub OAuth token |
| loadIdentity(username, options?) | Load existing identity from storage |
| sign(content, identity, options?) | Sign content and return AgentCred envelope |
| verify(envelope) | Verify envelope online (via API) |
| verifyOffline(envelope, publicKey) | Verify envelope offline with public key |
Storage
| Class | Description |
|-------|-------------|
| FileSystemKeyStorage | Stores keys in ~/.agentcred/keys/{username}.jwk |
| MemoryKeyStorage | In-memory storage for testing/browser environments |
| createDefaultStorage() | Auto-select appropriate storage for environment |
Types
AgentCredIdentity— Identity with GitHub info and keypairAgentCredEnvelope— Signed content with JWS and metadataVerifyResult— Verification result with identity and timestamp
Documentation
See main README for full documentation and examples.
For protocol details, see SPEC.md.
License
MIT
