Skip to content

docs(universal-usernames): add integration guide, endpoint reference and adapter template - #20

Draft
HAPPYS1NGH wants to merge 6 commits into
docs/universal-usernames-v1-overviewfrom
docs/universal-usernames-guides
Draft

HAPPYS1NGH wants to merge 6 commits into
docs/universal-usernames-v1-overviewfrom
docs/universal-usernames-guides

Conversation

@HAPPYS1NGH

@HAPPYS1NGH HAPPYS1NGH commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

  • Add developer-guide/guide/connect-universal-usernames — the owner's path from choosing the parent to managing the connection, including the resolver switch that copies the parent's records first — owners can connect without reading the contract
  • Add the endpoint reference — request, schema v1, status codes, what every failure returns, limits, the 60 s cache and proof expiry, public records — one page a brand's backend team can build against
  • Add Records — text keys, coin types (with the Rootstock-vs-Polygon 137 trap), the ENSIP-19 default EVM rules including coin type 60, contenthash protocols — checked against address-encoder 2.0.1 and content-hash 3.1.0-rc.1
  • Add Troubleshooting — every one of the 30 ValidationIssueCodes with cause and fix, the 12 owner API errors, and the accepted behaviours (onchain child shadows the endpoint, no fallback resolver, nested names, proof and wallet caching)
  • Add examples/universal-usernames-adapter — Hono + TypeScript, lookupUser stub, optional constant-time ENDPOINT_TOKEN, 404 vs 200 vs 500, JSON content type, 13 Vitest tests that validate the body against schema v1 — self-contained, so CI runs it today
  • Add the adapter template page — shows src/app.ts and src/bearer-token.ts verbatim, kept in sync by the drift check
  • Add SDK pages for @thenamespace/universal-usernames 0.1.0 and the Offchain Manager 1.2.0 connection methods, plus changelog entries marked Unreleased
  • Extend openapi/offchain-openapi.json with all 12 public routes from the contract (11 universal-usernames routes + GET /api/v1/auth/nonce), 22 schemas, and uun-session / uun-operation-signature schemes — no /internal/* routes — existing paths untouched (one line changed, the top-level tags)
  • Add 12 thin API pages and an owner-auth section on the API overview, backed by examples/universal-usernames-owner-api.ts (type-checked by check:examples) — tokens are base64 of UTF-8 so Unicode parent names work
  • Document UPSTREAM_UNAVAILABLE (503, retryable) on every owner route and in Troubleshooting, and that credential rotation promotes itself while an endpoint replacement is save then activate — matches offchain-manager #61
  • Keep the schema in one place: snippets/universal-usernames/profile-v1.schema.json, shown through an MDX snippet; check-docs now skips snippets/, which aren't pages
  • Add scripts/check-uun-schema.mjs (check:uun-schema) — fails on schema drift in the snippet, template or any titled JSON block, on invalid example profiles, on template-page source drift, and on issue codes missing from Troubleshooting
  • Add check:adapter to npm run check; CI caches both lockfiles — ajv becomes a direct dev dependency (already installed through mint); root .gitignore now excludes .env*
  • Link the overview, SDK overview and Skills page to the new pages and the universal-usernames skill

Notes

  • Stacked on docs(universal-usernames): match the overview to v1 scope #19 (docs/universal-usernames-v1-overview). Merge that first.
  • Blocked on publish: the SDK pages, the validator CLI command, and the changelog entries describe @thenamespace/universal-usernames 0.1.0 and @thenamespace/offchain-manager 1.2.0, which aren't on npm yet. The adapter template doesn't depend on either.
  • The Offchain Manager page follows the plan's P4 method names and the contract's request bodies; contract §6 confirms getUsernameConnection returns null on 404 and that the SDK signs for the API host. The provider option name (same as the Avatar SDK) and the error-class mapping still need checking against the 1.2.0 code before merge.
  • The skill install line needs the skills PR (feat/universal-usernames-skill) merged.
  • Verification: npm ci then npm run check — build validation, broken links, a11y, content checks (106 pages, 105 routes), check:examples, check:uun-schema (schema copies match, 3 example profiles valid, 30 issue codes documented), check:adapter (13 tests) all pass. The template lockfile also installs and tests with npm 10, which CI's Node 22 uses. Mutation-tested the drift check (schema, template schema, template source, issue code, invalid example each fail). Rendered the new pages with mint dev.
  • Follow-ups: once 0.1.0 is published, make check:uun-schema also compare against USERNAME_PROFILE_SCHEMA_V1 from the package, and bump the docs' @thenamespace/offchain-manager pin from 1.0.13 when 1.2.0 ships. Contract §6 settles the SIWE domain (API host or App domains), UTF-8 token encoding, UPSTREAM_UNAVAILABLE, one-step credential rotation, and expectedRevision after a disconnect; all are reflected here.
  • No pre-existing failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p

HAPPYS1NGH and others added 3 commits October 30, 2026 18:28
A Hono and TypeScript endpoint brands can copy to serve schema v1
profiles: lookupUser over an in-memory map, an optional ENDPOINT_TOKEN
bearer check compared in constant time, 404 for unknown usernames and
paths, 500 when the user store fails, and a JSON content type.

It has no dependency on the unpublished @thenamespace/universal-usernames
package, so it runs in CI today. Vitest checks the 200 body against the
schema with ajv, plus 404, 401, 500 and unknown paths. check:adapter
installs and tests it as part of npm run check and the docs CI job.

vitest is pinned to 3.2.7: 5.0.5 depends on magic-string ^1.4.3, which
isn't published, and 4.x hits an npm peer resolution crash through
vite 8's optional devtools peer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p
…nce and owner API

- Guide for parent owners: choose and inspect the parent, build the
  endpoint, connect and validate, switch to HybridResolverV2 while
  copying the parent's records, activate, and manage the connection.
- Endpoint reference: request, schema v1, status codes, what each
  failure returns, limits, the 60 s cache and proof expiry, and the
  fact that resolvable records are public.
- Records (text keys, coin types with the ENSIP-19 default EVM rules,
  contenthash protocols), adapter template, and troubleshooting for
  every validation issue code and owner API error.
- SDK pages for @thenamespace/universal-usernames 0.1.0 and the
  Offchain Manager 1.2.0 connection methods, plus changelog entries.
- OpenAPI: every public universal usernames route, the connection,
  inspection, event and validation report schemas, and the session and
  operation-signature schemes, with thin API pages and a type-checked
  owner API example.
- The schema and example profile live in snippets that pages import.
  check-docs skips snippets, which aren't pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p
check:uun-schema compares every copy of profile schema v1 (the docs
snippet, the adapter template, any titled JSON block) with
snippets/universal-usernames/profile-v1.schema.json, validates every
example profile against it with ajv, compares the source shown on the
adapter template page with the template files, and checks that the
troubleshooting page documents exactly the ValidationIssueCode enum.
ajv was already installed through mint; it is now a direct dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p
HAPPYS1NGH and others added 3 commits October 30, 2026 18:35
address-encoder 2.0.1 decodes any EVM coin type, so chains missing from
the table still work as 2147483648 + chainId.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p
…ential rotation

Matches contract section 6, items 9 and 10:

- UPSTREAM_UNAVAILABLE (503): an RPC or the gateway didn't answer during
  an owner, inspection or validation check; retryable. Added to the
  OpenAPI error enum and to the responses of every universal usernames
  route, the troubleshooting table, and the SDK errors section.
- Rotating the credential on an active connection validates and
  promotes it in one call; activating afterwards returns 409
  INVALID_STATE. Replacing the endpoint is save, then activate. The
  guide's signature table said replacing the endpoint took one
  signature; it takes two. The SDK page gains a sample of both flows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p
…ion after disconnect

Matches contract section 6, items 1, 2 and 4:

- The x-auth-token parts are base64 of UTF-8 text. The owner API
  example and the API overview used btoa, which throws on Unicode
  parent names; they now encode with Buffer as UTF-8.
- The SIWE domain is the API host or a Namespace App domain; the SDK
  uses the API host of the selected network.
- expectedRevision is 0 only when the parent never had a connection.
  After a disconnect the row is reused, so the next save sends its
  current revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant