{"_id":"@agentcommunity/aid","_rev":"6-5ccbb7d4e58bf3780bdc627d9620f5f5","name":"@agentcommunity/aid","dist-tags":{"latest":"2.1.1"},"versions":{"1.0.0":{"name":"@agentcommunity/aid","version":"1.0.0","keywords":["agent","discovery","dns","mcp","a2a","ai"],"author":{"name":"Agent Community"},"license":"MIT","_id":"@agentcommunity/aid@1.0.0","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-interface-discovery/issues"},"dist":{"shasum":"e7a8d17b0c20d0fa9c955dd8484f2e059f64fefc","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-1.0.0.tgz","fileCount":16,"integrity":"sha512-gzbdUIWNwRG5rQY0+VkKdv8oolILUXNl/fG/BEUGPK83Gafn4o09MZIFU9w+/RAl/wOxXFpJ2vEBMyzT80OzGA==","signatures":[{"sig":"MEUCIQCKHqoX4udWsQuaBln2/x+/iD7AFJ79ccXCFAClNwiMmAIgaiMkEwP4VxFL2uSOkCT2yOdJLSKn9Ym1TUd306B/Czc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":189613},"main":"./dist/index.cjs","type":"module","_from":"file:agentcommunity-aid-1.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsup","clean":"rimraf dist","test:coverage":"vitest --coverage"},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"_resolved":"/private/var/folders/p8/bwxg4yln4vg39m51mllmpkrm0000gn/T/d551549b572d80832a96648055b9287c/agentcommunity-aid-1.0.0.tgz","_integrity":"sha512-gzbdUIWNwRG5rQY0+VkKdv8oolILUXNl/fG/BEUGPK83Gafn4o09MZIFU9w+/RAl/wOxXFpJ2vEBMyzT80OzGA==","repository":{"url":"git+https://github.com/agentcommunity/agent-interface-discovery.git","type":"git","directory":"packages/aid"},"_npmVersion":"10.9.2","description":"Agent Interface Discovery (AID) - DNS-based discovery protocol for AI agents","directories":{},"_nodeVersion":"18.20.7","dependencies":{"dns-query":"^0.11.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.30.1","vitest":"^2.0.0","typescript":"^5.8.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/aid_1.0.0_1752305834851_0.17148187213193578","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@agentcommunity/aid","version":"1.1.0","keywords":["agent","discovery","dns","mcp","a2a","ai"],"author":{"name":"Agent Community"},"license":"MIT","_id":"@agentcommunity/aid@1.1.0","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-interface-discovery/issues"},"dist":{"shasum":"815de05104c0e6024051a820bf99a6feb4d61f9e","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-1.1.0.tgz","fileCount":17,"integrity":"sha512-b94b8ghjElfLElK9m0IfCL9ewVyxmA0ETPHhC85dUfKHzE71Y2H6ApM1Ir6iqtjC7teHROubFgTAo22tyQfRPQ==","signatures":[{"sig":"MEYCIQC9jABhydIQtX3Dm78v8+pgf++v24IiQXG3aVZhhi7nBQIhAMLB59URdvRA2K4KXRGuscZ+n8MAroB3H8zMRyv5TxwJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":440238},"main":"./dist/index.cjs","type":"module","_from":"file:agentcommunity-aid-1.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsup","clean":"rimraf dist","test:coverage":"vitest --coverage"},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"_resolved":"/tmp/721b641e4a736b3df3f6f8cd3d32ccf0/agentcommunity-aid-1.1.0.tgz","_integrity":"sha512-b94b8ghjElfLElK9m0IfCL9ewVyxmA0ETPHhC85dUfKHzE71Y2H6ApM1Ir6iqtjC7teHROubFgTAo22tyQfRPQ==","repository":{"url":"git+https://github.com/agentcommunity/agent-interface-discovery.git","type":"git","directory":"packages/aid"},"_npmVersion":"10.8.2","description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","directories":{},"_nodeVersion":"20.19.4","dependencies":{"dns-query":"^0.11.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.30.1","vitest":"^2.0.0","typescript":"^5.8.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/aid_1.1.0_1756918423116_0.5309873720963667","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@agentcommunity/aid","version":"1.2.0","keywords":["agent","discovery","dns","mcp","a2a","ai"],"author":{"name":"Agent Community"},"license":"MIT","_id":"@agentcommunity/aid@1.2.0","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-interface-discovery/issues"},"dist":{"shasum":"4009926ee47b38c15d8b80399bf8642827f80838","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-1.2.0.tgz","fileCount":17,"integrity":"sha512-PFuEJmGrmECR2lG15bRP/iJzfZ+kBhmbxVrGoaq/M4+xUUhjzplahOaA60rRxMq5Bny99eek4elogcxbGTs0FA==","signatures":[{"sig":"MEQCIEsJyB7yrodoHsedNYCYRjz7MqyUxwwVO7j7AhbgStPrAiAYr8TR8E3x4p8JAxZwm+10iP6evvR77RMm82ACi/Ceaw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":441092},"main":"./dist/index.cjs","type":"module","_from":"file:agentcommunity-aid-1.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsup","clean":"rimraf dist","test:coverage":"vitest --coverage"},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"_resolved":"/tmp/ab02c8c1908bfc16dc3c7ce01b7d9fc0/agentcommunity-aid-1.2.0.tgz","_integrity":"sha512-PFuEJmGrmECR2lG15bRP/iJzfZ+kBhmbxVrGoaq/M4+xUUhjzplahOaA60rRxMq5Bny99eek4elogcxbGTs0FA==","repository":{"url":"git+https://github.com/agentcommunity/agent-interface-discovery.git","type":"git","directory":"packages/aid"},"_npmVersion":"10.8.2","description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","directories":{},"_nodeVersion":"20.20.0","dependencies":{"dns-query":"^0.11.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.30.1","vitest":"^2.0.0","typescript":"^5.8.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/aid_1.2.0_1770411103012_0.5312657510461611","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@agentcommunity/aid","version":"2.0.0","keywords":["agent","discovery","dns","mcp","a2a","ai"],"author":{"name":"Agent Community"},"license":"MIT","_id":"@agentcommunity/aid@2.0.0","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-identity-discovery/issues"},"dist":{"shasum":"4ccb82f4b4f9f0994cb7755601af8dae0887007f","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-2.0.0.tgz","fileCount":17,"integrity":"sha512-JAccEMDFfazxI99EdoE8f3Tbwy5tgkG2/TPgjBI9y1vPt1E2m9DTEHpUxvuFVSkfGE85u/DkNpcDm6Gx+Uyk4Q==","signatures":[{"sig":"MEQCICh3lRB0xzhcYJXZ7Jgii1HY/p9vk4XxfiygV+9QCSj2AiBkYgGAeVNQ/pZVVcNQ98bdsT5EBv7/YDK8jH1fviAtKA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":824223},"main":"./dist/index.cjs","type":"module","_from":"file:agentcommunity-aid-2.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsup","clean":"rimraf dist","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"_resolved":"/private/var/folders/99/1fc6d8f950ggwjlb0zvkktdh0000gn/T/18332736c86916a70c69f3937e0945b0/agentcommunity-aid-2.0.0.tgz","_integrity":"sha512-JAccEMDFfazxI99EdoE8f3Tbwy5tgkG2/TPgjBI9y1vPt1E2m9DTEHpUxvuFVSkfGE85u/DkNpcDm6Gx+Uyk4Q==","repository":{"url":"git+https://github.com/agentcommunity/agent-identity-discovery.git","type":"git","directory":"packages/aid"},"_npmVersion":"11.16.0","description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","directories":{},"_nodeVersion":"25.9.0","dependencies":{"dns-query":"^0.11.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.30.1","vitest":"^2.0.0","typescript":"^5.8.0","@types/node":"^22.0.0","@vitest/coverage-v8":"2.1.9"},"_npmOperationalInternal":{"tmp":"tmp/aid_2.0.0_1780886596603_0.8589766469768336","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@agentcommunity/aid","version":"2.1.0","keywords":["agent","discovery","dns","mcp","a2a","ai"],"author":{"name":"Agent Community"},"license":"MIT","_id":"@agentcommunity/aid@2.1.0","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-identity-discovery/issues"},"dist":{"shasum":"8b853690ab78841a2b1e3fc3fa5263d4bdf39ace","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-2.1.0.tgz","fileCount":17,"integrity":"sha512-aoxSwHhIQoscVoRKIJ5cxqoDPgW8gf3kQt6SySoc7vznJNqSOZ8lItVog+am9AgNiUjjRmPYy8csW80s5qv8ig==","signatures":[{"sig":"MEQCIBp/CAfay+OTeCkowELPAH9qSWO+kN7jRqDBZjUMhAJnAiAgy1931NimNqUxpqC0xXUbmcJ2Sag1/GUDgUc8J6woNw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":878637},"main":"./dist/index.cjs","type":"module","_from":"file:agentcommunity-aid-2.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsup","clean":"rimraf dist","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"_resolved":"/private/var/folders/99/1fc6d8f950ggwjlb0zvkktdh0000gn/T/7c003e7d140fe66362d7f0d9dd03e93a/agentcommunity-aid-2.1.0.tgz","_integrity":"sha512-aoxSwHhIQoscVoRKIJ5cxqoDPgW8gf3kQt6SySoc7vznJNqSOZ8lItVog+am9AgNiUjjRmPYy8csW80s5qv8ig==","repository":{"url":"git+https://github.com/agentcommunity/agent-identity-discovery.git","type":"git","directory":"packages/aid"},"_npmVersion":"11.16.0","description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","directories":{},"_nodeVersion":"25.9.0","dependencies":{"dns-query":"^0.11.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.30.1","vitest":"^2.0.0","typescript":"^5.8.0","@types/node":"^22.0.0","@vitest/coverage-v8":"2.1.9"},"_npmOperationalInternal":{"tmp":"tmp/aid_2.1.0_1782835968779_0.9362308758046483","host":"s3://npm-registry-packages-npm-production"}},"2.1.1":{"name":"@agentcommunity/aid","version":"2.1.1","description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","keywords":["agent","discovery","dns","mcp","a2a","ai","aid","txt-record"],"author":{"name":"Agent Community"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/agentcommunity/agent-identity-discovery.git","directory":"packages/aid"},"homepage":"https://aid.agentcommunity.org","bugs":{"url":"https://github.com/agentcommunity/agent-identity-discovery/issues"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18.17"},"devDependencies":{"@types/node":"^22.0.0","@vitest/coverage-v8":"2.1.9","eslint":"^9.30.1","tsup":"^8.0.0","typescript":"^5.8.0","vitest":"^2.0.0"},"publishConfig":{"access":"public"},"dependencies":{"dns-query":"^0.11.2"},"scripts":{"build":"tsup","dev":"tsup --watch","lint":"eslint src/**/*.ts","test":"vitest run","test:coverage":"vitest run --coverage","clean":"rimraf dist"},"_id":"@agentcommunity/aid@2.1.1","_integrity":"sha512-HHfZGWUnaWei7SPpigEGdv9NYJeU0kJmyz0q5nk46Y74bTJW4SVS6UeMhBpEpVqmHbCyJswGOGX541mmris0kw==","_resolved":"/private/var/folders/99/1fc6d8f950ggwjlb0zvkktdh0000gn/T/526e9707275cfb9b369cbc07f825a8b3/agentcommunity-aid-2.1.1.tgz","_from":"file:agentcommunity-aid-2.1.1.tgz","_nodeVersion":"25.9.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-HHfZGWUnaWei7SPpigEGdv9NYJeU0kJmyz0q5nk46Y74bTJW4SVS6UeMhBpEpVqmHbCyJswGOGX541mmris0kw==","shasum":"065a02d388fa92668e8e194a2d49b19bbefe21a1","tarball":"https://registry.npmjs.org/@agentcommunity/aid/-/aid-2.1.1.tgz","fileCount":17,"unpackedSize":878656,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC33jiB9aV+CwfSfenZ6P+XYIvPO5ovq09ybnvqS2sewQIgXrHpivrdLU8KQLJ1ldEpofNQ+je+ds6uLWvxia83gwE="}]},"_npmUser":{"name":"nembal","email":"nembal+npm@gmail.com"},"directories":{},"maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aid_2.1.1_1784968242145_0.1762907245014751"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-12T07:37:14.782Z","modified":"2026-07-25T08:30:42.493Z","1.0.0":"2025-07-12T07:37:15.084Z","1.1.0":"2025-09-03T16:53:43.339Z","1.2.0":"2026-02-06T20:51:43.188Z","2.0.0":"2026-06-08T02:43:16.789Z","2.1.0":"2026-06-30T16:12:48.999Z","2.1.1":"2026-07-25T08:30:42.329Z"},"bugs":{"url":"https://github.com/agentcommunity/agent-identity-discovery/issues"},"author":{"name":"Agent Community"},"license":"MIT","homepage":"https://aid.agentcommunity.org","keywords":["agent","discovery","dns","mcp","a2a","ai","aid","txt-record"],"repository":{"type":"git","url":"git+https://github.com/agentcommunity/agent-identity-discovery.git","directory":"packages/aid"},"description":"Agent Identity & Discovery (AID) - DNS-based discovery protocol for AI agents","maintainers":[{"name":"nembal","email":"nembal+npm@gmail.com"}],"readme":"# @agentcommunity/aid\n\n# Agent Identity & Discovery\n\n> DNS for Agents\n\nAID as the public address book for the agentic web.\n\nIt's a simple, open standard that uses the internet's own directory—DNS—to answer one question: **\"Given a domain, where is its AI agent, and how do I know it's the real one?\"**\n\nNo more hunting through API docs. No more manual configuration. It's the zero-friction layer for a world of interconnected agents.\n\nBuilt by the team at [agentcommunity.org](https://agentcommunity.org).\n\n- **Website**: [aid.agentcommunity.org](https://aid.agentcommunity.org)\n- **Docs**: [aid.agentcommunity.org](https://aid.agentcommunity.org)\n- **GitHub**: [github.com/agentcommunity/agent-identity-discovery](https://github.com/agentcommunity/agent-identity-discovery)\n\n## Install\n\n```bash\npnpm add @agentcommunity/aid\n# or\nnpm install @agentcommunity/aid\n# or\nyarn add @agentcommunity/aid\n```\n\n## Quick Start (Node.js)\n\n```ts\nimport { discover, AidError } from '@agentcommunity/aid';\n\ntry {\n  const { record, ttl, queryName } = await discover('example.com');\n  console.log('Found', record.proto, 'at', record.uri, 'TTL:', ttl, 'query:', queryName);\n} catch (e) {\n  if (e instanceof AidError) {\n    console.error(`AID Error (${e.code})`, e.errorCode, e.message);\n  } else {\n    console.error('Unexpected error', e);\n  }\n}\n```\n\n## Quick Start (Browser)\n\n```ts\nimport { discover } from '@agentcommunity/aid/browser';\n\nconst { record } = await discover('example.com');\nconsole.log('Agent:', record.proto, record.uri);\n```\n\n## API\n\n- `discover(domain: string, options?)` → `{ record, ttl, queryName }`\n  - Node uses DNS; Browser uses DNS-over-HTTPS.\n  - Canonical query is `_agent.<exact-host>`. Clients do not implicitly walk to parent hosts. Protocol-specific `_agent._<proto>.<exact-host>` probing is legacy, diagnostic, or base-failure-only behavior where explicitly supported and configured.\n  - Enterprise controls: `securityMode: 'balanced' | 'strict'` plus low-level policy knobs for DNSSEC, PKA, downgrade handling, and `.well-known`.\n- `parse(txt: string)` → validated AID record\n- `AidError` – error class exposing `code` (numeric) and `errorCode` (symbol)\n- Constants and types exported from `@agentcommunity/aid`\n\n### Example: enterprise policy preset\n\n```ts\nimport { discover } from '@agentcommunity/aid';\n\nconst result = await discover('example.com', {\n  securityMode: 'balanced',\n  previousSecurity: {\n    version: 'aid2',\n    keyThumbprints: ['WWpn_pfHui9YKR4CZtQsDGMu7_Gch2zYChfSvnxgtPk'],\n    trustSource: 'dns',\n  },\n});\n\nconsole.log(result.security.mode);\nconsole.log(result.security.warnings);\n```\n\n## v2.1 Notes\n\n- New records default to `aid2`.\n- `pka` (`k`) is the unpadded base64url Ed25519 JWK `x` value.\n- DNS `kid` (`i`) is invalid for `aid2`; clients derive the RFC 7638 JWK thumbprint and use it as the HTTP signature `keyid`.\n- The client sends `Accept-Signature` with an RFC 9421 nonce. The server returns `Signature-Input` and `Signature`.\n- `created` and `expires` are mandatory. The response must include `Cache-Control: no-store`.\n- Domain binding: the client sends the queried host in the `AID-Domain` header by default and reports a `domainBound` indicator (`true` only for a verified domain-bound proof — one whose `aid-pka-v2` covered set includes `\"aid-domain\";req` — and `false` for an unbound proof). Requesting binding does not by itself mitigate unauthorized association — only `domain-binding=require` rejects unbound proofs. See specification Appendix B.7.\n- v2 PKA does not sign HTTP `Date` and does not use `AID-Challenge`.\n\n### v2 PKA handshake expectations (summary)\n\n- Covered fields set: `\"@method\";req`, `\"@target-uri\";req`, `\"@authority\";req`, and `\"@status\"` (`tag=\"aid-pka-v2\"`). A domain-bound proof keeps the same `aid-pka-v2` tag and additionally covers `\"aid-domain\";req` after `\"@authority\";req`.\n- `alg=\"ed25519\"`, compared case-insensitively while preserving the received signature parameters.\n- `keyid` equals the RFC 7638 thumbprint derived from `k`.\n- `nonce` exactly matches the value sent in `Accept-Signature`.\n- `expires` is after `created` and the validity window is short.\n- `pka` is unpadded base64url for a 32-byte Ed25519 public key.\n\n## Legacy aid1 Notes (PKA + .well-known)\n\n- Legacy `aid1` fields: `pka` (`k`) and `kid` (`i`). When an `aid1` record includes `pka`, the client performs a Public Key for Agent (PKA) handshake using HTTP Message Signatures (Ed25519).\n- Legacy `aid1` `pka` is a multibase string using base58btc (`z...`) of the raw 32-byte Ed25519 public key.\n- Legacy `aid1` handshake coverage: required fields are `\"AID-Challenge\" \"@method\" \"@target-uri\" \"host\" \"date\"`.\n- Legacy `aid1` time window: both `created` and HTTP `Date` must be within ±300 seconds of now.\n- Fallback: when DNS has `ERR_NO_RECORD` or `ERR_DNS_LOOKUP_FAILED`, discovery may fetch `https://<domain>/.well-known/agent` (TLS‑anchored) and validate the same data model; if the JSON contains `pka`, the handshake runs.\n\n### Legacy v1 PKA handshake expectations (summary)\n\n- Covered fields set (exact): `\"AID-Challenge\" \"@method\" \"@target-uri\" \"host\" \"date\"`\n- `alg=\"ed25519\"`\n- `keyid` equals record `kid` (normalize quotes for compare, preserve raw in base)\n- `created` ± 300 seconds of current time\n- HTTP `Date` ± 300 seconds of current time\n- `pka` is multibase base58btc (`z...`) of a 32‑byte Ed25519 public key\n\n### Dev‑only loopback relax (well‑known)\n\nFor local testing against a mock HTTP server, the CLI and Node variant support a narrow, opt‑in relaxation:\n\n- Set `AID_ALLOW_INSECURE_WELL_KNOWN=1`\n- Host must be loopback (`localhost`, `127.0.0.1`, or `::1`)\n- Only affects `.well-known` fallback; TXT path remains strict\n- Validation is performed with a temporary `https://` substitute, and the discovered `http://` URI is restored afterward\n\nThis is intended for local development only. Production remote agents MUST use `https://`.\n\n### Example: guarded `.well-known` fallback\n\n```ts\nimport { discover } from '@agentcommunity/aid';\n\nconst { record, queryName } = await discover('example.com', {\n  wellKnownFallback: true,\n  wellKnownTimeoutMs: 2000,\n});\n\nconsole.log('Query:', queryName); // either DNS name or https://<domain>/.well-known/agent\n```\n\nPKA handshake runs automatically when `record.pka` is present.\n\n## Error Codes\n\n- `1000` `ERR_NO_RECORD` – no `_agent` TXT found\n- `1001` `ERR_INVALID_TXT` – malformed record\n- `1002` `ERR_UNSUPPORTED_PROTO` – protocol not supported\n- `1003` `ERR_SECURITY` – security policy violation\n- `1004` `ERR_DNS_LOOKUP_FAILED` – DNS lookup failed\n- `1005` `ERR_FALLBACK_FAILED` – `.well‑known` fallback failed or invalid\n\n## Security Notes\n\n- Remote agent URIs MUST use `https://`.\n- Handshake verifies endpoint control when `pka` is present (Ed25519 HTTP Message Signatures).\n- `.well-known` is optional and TLS‑anchored; use DNS first.\n\n### Redirect Security\n\nClients do not automatically follow cross‑origin redirects from the discovered URI. If an initial request returns a 301/302/307/308 to a different origin (hostname or port), the client treats it as a potential security risk. Implementations either surface `ERR_SECURITY` or require explicit confirmation. See the spec for details.\n\n### More on PKA\n\nSee the Identity & PKA reference for the exact v2 header coverage, algorithm, timestamps, key format, and legacy v1 compatibility behavior.\n\n## License\n\nMIT © [Agent Community](https://agentcommunity.org)\n","readmeFilename":"README.md"}