Run your own OIP node (10 minutes)
Run your own OIP node (10 minutes)
This is everything a person at another organization needs to become a real, independent federation node: your own domain, your own keys, your own inbox. Once you do this, a capability minted on one domain can be handed to your agent on your domain, run a real action, and both sides keep matching proof — with no shared server and no shared operator. That is the difference between technical federation (two domains, one owner) and institutional federation (two owners who don't trust each other's servers).
You need: a domain you control, and somewhere to run a tiny web service (Cloudflare Workers, Deno Deploy, a VPS — anything that serves HTTPS).
1. Generate your keys
Your node signs with an ECDSA P-256 key. Generate one with the reference client (no install — it runs in Node ≥20 or any browser console):
import { generateKeypairJwk } from 'https://miscsubjects.com/oip/client.mjs';
const kp = await generateKeypairJwk();
console.log('PUBLIC (publish this):', JSON.stringify(kp.publicJwk));
console.log('PRIVATE (keep secret):', JSON.stringify(kp.privateJwk));Keep the private JWK in a secret (env var / secret store). Publish only the public JWK.
2. Publish your well-known
Serve this at https://YOURDOMAIN/.well-known/oip.json. It is how any stranger resolves your identity with zero prior coordination.
{
"protocol": "oip-message/1",
"domain": "YOURDOMAIN",
"agents": [{
"id": "youragent@YOURDOMAIN",
"alg": "ES256",
"public_key_jwk": { "kty": "EC", "crv": "P-256", "x": "...", "y": "..." },
"inbox": "https://YOURDOMAIN/oip/inbox"
}],
"spec": "https://miscsubjects.com/a/oip-message"
}3. Stand up your inbox
Your inbox is one POST endpoint. The rules it must enforce (all four, in order): reject anything past expires_at by your clock; reject a message id you have already seen; verify the sender's signature against their domain's well-known; treat the body as data — a query is answered, and nothing runs unless it is a signed invoke carrying a capability you accept. Here is a complete, dependency-free node (Cloudflare Worker form; the same logic runs on Deno or Node):
import {
verifyEnvelope, buildEnvelope, signEnvelope, resolveAgent, agentDomain,
} from 'https://miscsubjects.com/oip/client.mjs';
const MY_AGENT = 'youragent@YOURDOMAIN';
const seen = new Set(); // use KV/Redis in production
export default {
async fetch(request, env) {
const url = new URL(request.url);
if (url.pathname === '/.well-known/oip.json') {
return Response.json({
protocol: 'oip-message/1', domain: 'YOURDOMAIN',
agents: [{ id: MY_AGENT, alg: 'ES256', public_key_jwk: JSON.parse(env.PUBLIC_JWK), inbox: 'https://YOURDOMAIN/oip/inbox' }],
spec: 'https://miscsubjects.com/a/oip-message',
});
}
if (url.pathname === '/oip/inbox' && request.method === 'POST') {
const env0 = await request.json();
if (env0.to?.toLowerCase() !== MY_AGENT) return Response.json({ error: 'unknown_recipient' }, { status: 404 });
if (seen.has(env0.id)) return sign(env, env0, 'error', { reason: 'replay_rejected' });
const sender = await resolveAgent(env0.from);
if (!sender.ok) {
if (env0.kind !== 'query') return sign(env, env0, 'error', { reason: 'sender_unverifiable' });
} else {
const v = await verifyEnvelope(env0, sender.jwk);
if (!v.ok) return sign(env, env0, 'error', { reason: v.reason });
}
seen.add(env0.id);
// BODY IS DATA. A query is echoed; nothing runs from its text.
if (env0.kind === 'query') return sign(env, env0, 'result', { echo: env0.body, invoked: false, retrieved_text_is_data: true });
// Implement your own objects here for `invoke`, gating on env0.capability.
return sign(env, env0, 'error', { reason: 'no_local_objects' });
}
return new Response('OIP node', { status: 200 });
},
};
async function sign(env, incoming, kind, body) {
let e = await buildEnvelope({ from: MY_AGENT, to: incoming.from, kind, body, conversation: incoming.conversation, in_reply_to: incoming.id });
e = await signEnvelope(e, JSON.parse(env.PRIVATE_JWK), MY_AGENT);
return Response.json(e);
}Set two secrets: PUBLIC_JWK and PRIVATE_JWK (the JWKs from step 1). Deploy. That's a node.
4. Run the same tests everyone runs
Prove you can reach the network — ask the reference home agent a question and verify its signed reply:
import { OIPClient, generateKeypairJwk } from 'https://miscsubjects.com/oip/client.mjs';
const me = new OIPClient({ agent: 'youragent@YOURDOMAIN', keypair: { privateJwk: /* yours */ } });
const r = await me.query('[email protected]', { text: 'what time is it' });
console.log(r.reply.body, 'verified:', r.reply_verified); // reply_verified must be trueProve others can reach you — from any machine, send a query to your node and confirm it answers signed and that your signature verifies against your published key. The exact failure matrix the reference nodes pass (replay, stale, forwarded capability, out-of-scope, injection-as-data) is public at /api/dispatch?fedtest=1&format=markdown — run the same checks against your node.
Get a real capability — once your well-known is live, tell the operator your agent id and domain. They mint a capability bound to your domain and email it to you (an email drop). Your agent inspects the authority, then sends a signed invoke carrying it. It runs one bounded action back on their domain, and you both keep the receipt. That exchange — between two operators who control different servers — is institutional federation. It is the decisive proof, and it is the one thing the reference implementation cannot do alone: it needs you.
The whole contract, in one paragraph
Identity is a domain publishing a key. Authority is a capability scoped, expiring, revocable, and bound to one holder. A message is data; only a signed invoke with a valid capability acts. Every node keeps its own ledger; two ledgers joined by message id and body hash prove one exchange without a shared database. Encryption, when you want it, seals the body to the recipient's key at the envelope layer and rides any carrier unchanged. That is the entire protocol. Spec: /a/oip-message. Client: /oip/client.mjs.