scopeblind-agent
v1.2.0
Published
Agent identity SDK for ScopeBlind. DPoP proof-of-possession for AI agents, CLIs, and MCP servers. Generates holder-binding commitments for signed decision receipts.
Maintainers
Readme
scopeblind-agent
Agent identity SDK for ScopeBlind. Generates holder-binding commitments for signed decision receipts.
Uses DPoP (RFC 9449) to create proof-of-possession for each request. The agent generates an ES256 key pair on first use and stores it locally. Each request includes a self-signed JWT proof — producing a stable, pseudonymous identity that appears in the signed receipt without revealing PII.
Install
npm install scopeblind-agentQuick Start
import { createAgent } from 'scopeblind-agent';
const agent = await createAgent();
console.log('Agent device ID:', agent.deviceId);
// Fetch wrapper — DPoP proof attached automatically
const res = await agent.fetch('https://api.example.com/endpoint', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt: 'Hello' }),
});How It Works
- On first call,
createAgent()generates a persistent ES256 key pair and stores it in.scopeblind/agent-key.json - Every request gets a self-signed DPoP JWT proof containing the HTTP method, URL, timestamp, and nonce
- The server running ScopeBlind middleware verifies the proof and identifies the agent by the SHA-256 hash of its public key
- Abusive agents are caught by key hash — IP rotation doesn't help
API
createAgent(options?): Promise<ScopeBlindAgent>
Creates a ScopeBlind agent instance.
Options:
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| keyPath | string | .scopeblind/agent-key.json | Path to store the key pair |
| jwk | object | — | Existing JWK key pair (for serverless/in-memory) |
Returns a ScopeBlindAgent with:
| Property/Method | Type | Description |
|----------------|------|-------------|
| deviceId | string | SHA-256 hash of public key (16 hex chars) |
| publicKey | JWK | The agent's public key |
| createProof(method, url) | string | Create a DPoP proof JWT |
| headers(method, url, extra?) | Record<string, string> | Get headers with DPoP proof |
| fetch(url, init?) | Promise<Response> | Fetch wrapper with automatic proof |
Usage Patterns
With your own HTTP client
const agent = await createAgent();
// Get headers to attach to any HTTP client
const headers = agent.headers('POST', 'https://api.example.com/data');
await axios.post('https://api.example.com/data', payload, { headers });In-memory keys (serverless)
const agent = await createAgent({
jwk: {
publicKey: { kty: 'EC', crv: 'P-256', x: '...', y: '...' },
privateKey: { kty: 'EC', crv: 'P-256', x: '...', y: '...', d: '...' },
},
});MCP Tool Server
import { createAgent } from 'scopeblind-agent';
const agent = await createAgent({ keyPath: '.scopeblind/mcp-key.json' });
// Every tool call includes DPoP proof
async function callProtectedAPI(url: string, body: object) {
return agent.fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
}CLI
# Initialize agent identity
npx scopeblind-agent init
# Show agent status and device ID
npx scopeblind-agent status
# JSON output for scripts
npx scopeblind-agent status --jsonServer-Side Verification
The ScopeBlind middleware automatically verifies DPoP proofs:
import { scopeblind, scopeblindDPoP } from 'scopeblind';
scopeblindDPoP(app, { slug: 'YOUR_SLUG' });
app.post('/api/data', scopeblind(), (req, res) => {
// req.scopeblind.dpopVerified → true if valid proof
// req.scopeblind.dpopDeviceId → stable key hash
});Zero Dependencies
The agent SDK has zero runtime dependencies. It uses only Node.js built-in crypto and fs modules.
Requirements
- Node.js >= 18.0.0
Standards
- RFC 9449 — DPoP (Demonstrating Proof-of-Possession)
- ES256 (ECDSA on P-256) for key generation and signing
- SHA-256 for device ID derivation
Architecture
scopeblind-agent is part of a three-layer stack for private, auditable machine access control:
| Layer | Role | License | |-------|------|---------| | @veritasacta/verify | Open-source VOPRF verification primitive | MIT | | ScopeBlind (including this SDK) | Commercial managed issuance, agent identity, enforcement | MIT | | Veritas Acta | Open protocol for contestable public records and receipts | MIT |
ScopeBlind is built on the open-source @veritasacta/verify primitive. The cryptographic identity layer is open and independently usable. ScopeBlind adds managed issuance, the DPoP agent SDK, dashboards, and enterprise support.
License
MIT
Links
- ScopeBlind — Private, auditable control for machine access
- Documentation
- @veritasacta/verify — Open-source VOPRF primitive
- Veritas Acta — Open contestable record protocol
- GitHub
