Documentation
Enroll Alice once, bind one agent key, and resolve the same agent independently at Website A and Website B.
On this page
Alice starts in the enrolling workspace, which is Website A's workspace in this example. Open Dashboard → Agent Attribution → Enrollment, add the principal's public Ed25519 JWK under Advanced · Principal signing key, and continue to the approved OpenID Connect provider. Keep the principal private key with Alice. Save the authenticated enrollment ID and the enrolling workspace ID. Alice opts into retaining her provider-verified email for this example.
Generate a separate Ed25519 key for the agent. Alice authorizes the association with her principal key and the agent proves possession with its own key. The enrolling workspace submits a network_agent binding using its attribution:write key. Keep the returned ID as agentId. The binding can last up to 90 days from account authentication.
The TypeScript SDK provides signAttributionNetworkBinding, signAttributionNetworkGrant, and signAttributionNetworkProof. Each accepts an Ed25519 signing callback that receives bytes and returns a 64-byte signature. The SDK handles serialization and encoding. The example uses the TypeScript signing helpers; the Python example below constructs the signed wire shape directly. The receiving website can resolve with the published Node.js or Python SDK.
import { signAttributionNetworkBinding } from "@chitmark/sdk";
const binding = await signAttributionNetworkBinding(
{
sponsorOrganizationId,
environment: "test",
enrollmentId,
agentKey,
expiresAt: Math.floor(Date.now() / 1000) + 3600,
},
signPrincipal,
signAgent,
);
const { id: agentId } = await enrollingWriter.attribution.createLink(binding);Set up two separate workspaces and HTTPS origins. Give each website a server-side key with attribution:read and a separate key with attribution:write to accept grants. Provide the agent with each recipient's public configuration, including the read key's record ID. Use matching Test keys for binding, grant acceptance, and resolution.
The agent signs a fresh proof for A and sends it in Chitmark-Agent-Proof. A resolves it with A's read key. The agent then signs fresh proof for B and B resolves it with B's read key. Alice uses the same enrollment and agent binding at both websites. Each website gets a different identity.subject_id scoped to its workspace, environment, and origin.
import {
signAttributionNetworkProof,
type AttributionAgentKey,
type AttributionSigner,
} from "@chitmark/sdk";
async function visit(
agentKey: AttributionAgentKey,
signAgent: AttributionSigner,
recipient: { organizationId: string; keyId: string; site: string },
piiMode: "hashed" | "raw" = "hashed",
) {
const proof = await signAttributionNetworkProof(
{ agentKey, recipient, environment: "test", piiMode },
signAgent,
);
return fetch(new URL("/agent-task", recipient.site), {
headers: { "Chitmark-Agent-Proof": JSON.stringify(proof) },
});
}Alice signs two separate network_grant payloads. A accepts its grant with A's write key and B later accepts its grant with B's write key. Each grant binds one recipient workspace, read key, HTTPS origin, purpose, and expiration. Use a single active grant per recipient and purpose. A grant cannot outlive the binding or expire more than 30 days ahead.
With network disclosure enabled, A can receive Alice's verification and email after its grant is accepted. B can already recognize the agent, but its principal status is withheld and email is null until its own grant is accepted. The demo uses eligible Test keys with attribution:email, explicit email consent for each grant, and proofs signed for raw mode.
Revoke A's grant using its returned grant ID in the dashboard or with attribution.revokeLink(grantId) and an authorized write key. On fresh proof, A still recognizes the agent but no longer receives principal claims. B's grant stays active. The enrolling workspace can revoke the agent binding with attribution.revokeLink(agentId), which ends recognition and disclosure on both websites.
import { signAttributionNetworkGrant } from "@chitmark/sdk";
const grant = await signAttributionNetworkGrant(
{
sponsorOrganizationId,
environment: "test",
agentId,
recipient: recipientB,
purpose: "identity_attribution",
emailConsent: true,
expiresAt: Math.floor(Date.now() / 1000) + 1800,
},
signPrincipal,
);
const { id: grantId } = await websiteBWriter.attribution.createLink(grant);Run the interactive demo to inspect the captured test responses.
From a Chitmark source checkout with Node.js 24+ and pnpm 9.15.4, run the commands below. The example starts two loopback HTTP servers, applies the database migrations to a temporary database, and runs the actual enrollment and resolution handlers. A fixture identity provider issues a signed test identity token for Alice. The example uses no external account or production credentials.
The example starts two loopback HTTP servers, applies the database migrations to a temporary database, and runs the actual enrollment and resolution handlers. A fixture identity provider issues a signed test identity token for Alice. It uses no external account or production credentials. Assert each outcome before printing the responses. It enables disclosure in its local Test configuration. Production (live) runs the same flow with ATTRIBUTION_NETWORK_MODE and ATTRIBUTION_NETWORK_DISCLOSURE_MODE set to live; a recipient receives email only with an eligible plan, an attribution:email key, a current grant with email consent, and proofs signed for raw mode, otherwise principal.email is null.
| Printed result | Expected outcome |
|---|---|
enrollments | 1 |
websiteA | Recognized with subject A and [email protected] |
websiteBWithoutGrant | Recognized with a different subject B, status withheld, email null |
websiteBAfterGrant | Same subject B, status previously_verified, email [email protected] |
wrongAudience, replay | Unknown identity, email null |
websiteAAfterRevocation | Same subject A, status withheld, email null |
websiteBAfterARevocation | Same subject B and authorized email |
afterAgentRevocationA, afterAgentRevocationB | Unknown identity, email null |