SDK overview
DNSid has open-source Go, TypeScript, and Python SDKs (Apache-2.0), the core of the Developer Kit. Each covers the same core surface - verify DNSid domains, sign HTTP requests, and mint DNSid JWTs. The Go module (github.com/dnsid-ai/dnsid-go) is the reference implementation for protocol behavior.
Full API references: Go · TypeScript · Python.
Install
Section titled “Install”go get github.com/dnsid-ai/dnsid-goFor Google Cloud KMS-backed keys, also run go get github.com/dnsid-ai/dnsid-go/key/gcp.
npm install @dnsid-ai/sdk @dnsid-ai/transportFor Google Cloud KMS-backed keys, also run npm install @dnsid-ai/key-gcp.
pip install dnsidInstall the official dnsid package from PyPI. For AWS KMS-backed keys, add the aws extra: pip install "dnsid[aws]". For Google Cloud KMS, use the gcp extra: pip install "dnsid[gcp]".
- Go 1.26.6+ - core module with
oidc,httpsig,webbotauth,jose,log, andlog/c2sptlogpackages, plus the separately taggedkey/awsandkey/gcpsubmodules for AWS and Google Cloud KMS. - TypeScript - Node.js 22+, dual ESM/CJS builds.
@dnsid-ai/transportis the Node DNS/HTTPS transport; the root SDK is runtime-neutral. Capability-specific packages (registry, OIDC, transparency log, AWS and Google Cloud KMS keys) install separately - each guide page names the package its snippets need. - Python 3.11+ - a single
dnsidpackage; the[aws]and[gcp]extras add AWS and Google Cloud KMS support.
Create an identity manager
Section titled “Create an identity manager”Use an identity manager to verify peers and act as your own identity. Load an identity provisioned with dnsid from the CLI’s files, or supply configuration and keys yourself.
From the CLI’s files
Section titled “From the CLI’s files”The dnsid CLI stores the identity’s publication settings and key files in its config directory. The SDK reads ~/.dnsid/config.json, follows its current-domain pointer to the per-domain config when present, and loads the matching key. Pass a directory to use a different location.
// Import github.com/dnsid-ai/dnsid-go/config.idm, err := config.IdentityManagerFromDnsid(ctx, "", dnsid.Config{}, config.Dependencies{})if err != nil { log.Fatal(err)}import { createNodeIdentityManagerFromDnsid } from '@dnsid-ai/sdk/node';
const idm = await createNodeIdentityManagerFromDnsid();from dnsid import identity_manager_from_dnsid
manager = identity_manager_from_dnsid()In Go and TypeScript, these constructors verify the published identity before returning a signing manager. The selected key must match the published operational key’s ID, algorithm, and public material. Configure lifecycle-log trust before construction; an unpublished identity or unavailable verification causes construction to fail. An explicitly injected key provider bypasses this constructor check, so its caller must establish the binding.
For DNSid Local, run your code under dnsid local run or load dnsid local env into your shell and use the environment constructor. It reads the identity, key location, DNS, CA, and log policy from the CLI’s DNSID_* exports. See the local quickstart for runnable examples. For an identity loaded from CLI files, configure trust for its lifecycle log before verifying domains.
From explicit configuration
Section titled “From explicit configuration”All three SDKs accept a config shape - Config in Go, DnsidConfig in TypeScript and Python - with these sections:
identity- your own publication settings: domain, governance identifier, log reference, and status URL. Omit it for a verification-only manager.verification- status re-check interval, DNSSEC mode, and the counterparty allowlist. The zero value is spec-strict.transport- custom DNS server and CA bundle for the SDK-managed resolver and fetcher.
Pair the config with a key provider (local file-backed keys, AWS KMS, Google Cloud KMS, or your own implementation) to act as the identity. Publishing requires a status URL and the identity’s lifecycle-log reference. Use the reference assigned by your log; the sample stream ID below is illustrative. Generate a fresh, opaque stream ID for each C2SP identity instance:
kp, err := dnsid.LoadOrCreateLocalKeyProvider("keys.json", dnsid.JoseAlgEdDSA)if err != nil { log.Fatal(err)}
idm, err := dnsid.NewIdentityManager(dnsid.Config{ Identity: &dnsid.IdentityConfig{ Domain: "agent.example", GovernanceID: "example.com", LogRef: "c2sp-tlog:public:https://log.example.com#EREREREREREREREREREREQ", StatusURL: "https://agent.example/.well-known/dnsid/status.json", },}, kp)if err != nil { log.Fatal(err)}import { createNodeIdentityManager, LocalKeyProvider } from '@dnsid-ai/sdk/node';
const idm = await createNodeIdentityManager( { identity: { domain: 'agent.example', governanceId: 'example.com', logRef: 'c2sp-tlog:public:https://log.example.com#EREREREREREREREREREREQ', statusUrl: 'https://agent.example/.well-known/dnsid/status.json', }, }, { keyProvider: await LocalKeyProvider.load('keys.json', true) },);from dnsid import DnsidConfig, IdentityConfig, IdentityManager, LocalKeyProvider
manager = IdentityManager( DnsidConfig( identity=IdentityConfig( domain="agent.example", governance_id="example.com", log_ref="c2sp-tlog:public:https://log.example.com#EREREREREREREREREREREQ", status_url="https://agent.example/.well-known/dnsid/status.json", ), ), LocalKeyProvider.load("keys.json", create_if_missing=True),)These examples set up an identity and its key. Verification also needs a trusted reader for the lifecycle log named by the record’s lr= reference. Publish self-managed records covers the entity key and ek/ku URLs needed to publish draft 01 records. A verify-only manager doesn’t need a key of its own (Verify a domain).
Combine configuration sources
Section titled “Combine configuration sources”All three SDKs accept deployment JSON files:
- Go:
config.LoadDeploymentFile("dnsid.json"), thenconfig.Construct(ctx, loaded, deps); check the error from each call. - TypeScript:
createNodeIdentityManagerFromFile('dnsid.json'). - Python:
identity_manager_from_file("dnsid.json").
The file can contain dnsid, logTrust, registry, and keySource sections. Use keySource to select an existing file or cloud key provider, or inject a provider in code. Injected providers take precedence. Deployment files do not contain registry credentials or private keys. Unknown, duplicate, and mistyped members are rejected. Go duration fields use duration strings such as "5m".
TypeScript also accepts a registration section with organizationId, governanceId, and entityKeyUrl. These are setup expectations, not registry-root selectors or counterparty acceptance rules. Go and Python do not accept this section.
To combine sources, load each separately, merge the results, and construct the manager. Later supplied fields win, lists replace, and log trust is replaced as a whole. Operational key-source fields also replace as a group, so selecting a new provider does not retain an earlier provider’s settings or key locator. entityKeyPath merges independently. Go zero-valued scalars and Python fields equal to their dataclass defaults cannot clear earlier values through an overlay; edit the merged result to clear them. The constructor applies defaults and validates the result.
Go’s config.Construct and the TypeScript constructors check configuration-selected operational keys against fresh, verified publication, including keys loaded from environment and CLI sources. Missing or invalid publication causes construction to fail. An explicitly injected operational provider bypasses this check; its caller must establish the identity binding. Changing configuration alone does not authorize rotation.
Registry clients and organization onboarding
Section titled “Registry clients and organization onboarding”The registry clients expose GetOrganizationOnboarding in Go, getOrganizationOnboarding in TypeScript, and get_organization_onboarding in Python. These read the authenticated organization’s ID and governance-proof/delegation readiness. Pending proofs are not verified bindings. The response supplies neither an entity-JWKS URL nor counterparty trust; failed authenticated reads do not fall back to anonymous access.
TypeScript’s createRegistryClientFromEnvironment(env, options) accepts explicit registry-client options, including credentials and a custom fetch implementation. Explicit options override environment-derived values.
Python’s registry_client_from_environment() applies the loaded DNS, CA, and private-host settings to registry requests. For explicit construction, pass transport_config to RegistryClient. Except for the local loopback registry, private-address hosts require explicit permission. Requests do not follow redirects or use proxy environment variables. The client pools connections; use a with RegistryClient(...) as client: block or call close() after the last request.
These APIs do not provide automatic managed registration or named recovery. Those workflows require separate SDK support and verified permanent server replay/name claims; an expiring idempotency store is insufficient.
What the SDKs handle
Section titled “What the SDKs handle”- Key management via the KeyProvider interface (local file-backed keys, AWS KMS, Google Cloud KMS)
- DNSid TXT record creation, parsing, and signature verification (publishing self-managed records)
- JWKS fetching and caching
- Status checks against the signed status URL
- Domain verification through IdentityManager.VerifyDomain
- Counterparty acceptance - an optional allowlist of accountable entities (governance ID plus optional entity-key pins) enforced on every verification
- Lifecycle-log verification via the C2SP transparency-log binding
- RFC 9421 HTTP Message Signatures and the Web Bot Auth profile
- OIDC token minting and verification through the SDK OIDC profile
How the packages are organized
Section titled “How the packages are organized”The three SDKs cover the same capabilities but package them differently: Go has a core module with subpackages and optional KMS submodules, TypeScript has one npm package per capability (install what you use), and Python has one package with optional KMS extras.
| Capability | Go | TypeScript | Python |
|---|---|---|---|
| Verification, records, keys | core module | @dnsid-ai/sdk + @dnsid-ai/transport | dnsid |
| OIDC tokens | oidc | @dnsid-ai/oidc | included |
| HTTP Message Signatures (RFC 9421) | httpsig | @dnsid-ai/http-signatures | included |
| Web Bot Auth | webbotauth | @dnsid-ai/web-bot-auth | included |
| JOSE (DNSid JWTs) | jose | @dnsid-ai/jose | included |
| Registry client | core module | @dnsid-ai/registry | included |
| C2SP transparency log | log/c2sptlog | @dnsid-ai/log-c2sp-tlog | dnsid.c2sp_tlog |
| AWS KMS keys | key/aws submodule | @dnsid-ai/key-aws | dnsid[aws] extra |
| GCP KMS keys | key/gcp submodule | @dnsid-ai/key-gcp | dnsid[gcp] extra |
Each guide page names the package its snippets need; the full per-language surface is in the API references.