Repository navigation
docs(universal-usernames): add integration guide, endpoint reference and adapter template - #20
Draft
HAPPYS1NGH wants to merge 6 commits into
Draft
HAPPYS1NGH wants to merge 6 commits into
HAPPYS1NGH wants to merge 6 commits into
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
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 contract137trap), the ENSIP-19 default EVM rules including coin type60, contenthash protocols — checked againstaddress-encoder2.0.1 andcontent-hash3.1.0-rc.1ValidationIssueCodes 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)examples/universal-usernames-adapter— Hono + TypeScript,lookupUserstub, optional constant-timeENDPOINT_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 todaysrc/app.tsandsrc/bearer-token.tsverbatim, kept in sync by the drift check@thenamespace/universal-usernames0.1.0 and the Offchain Manager 1.2.0 connection methods, plus changelog entries marked Unreleasedopenapi/offchain-openapi.jsonwith all 12 public routes from the contract (11 universal-usernames routes +GET /api/v1/auth/nonce), 22 schemas, anduun-session/uun-operation-signatureschemes — no/internal/*routes — existing paths untouched (one line changed, the top-leveltags)examples/universal-usernames-owner-api.ts(type-checked bycheck:examples) — tokens are base64 of UTF-8 so Unicode parent names workUPSTREAM_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 #61snippets/universal-usernames/profile-v1.schema.json, shown through an MDX snippet;check-docsnow skipssnippets/, which aren't pagesscripts/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 Troubleshootingcheck:adaptertonpm run check; CI caches both lockfiles —ajvbecomes a direct dev dependency (already installed through mint); root.gitignorenow excludes.env*universal-usernamesskillNotes
docs/universal-usernames-v1-overview). Merge that first.@thenamespace/universal-usernames0.1.0 and@thenamespace/offchain-manager1.2.0, which aren't on npm yet. The adapter template doesn't depend on either.getUsernameConnectionreturnsnullon 404 and that the SDK signs for the API host. Theprovideroption name (same as the Avatar SDK) and the error-class mapping still need checking against the 1.2.0 code before merge.feat/universal-usernames-skill) merged.npm cithennpm 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 withmint dev.check:uun-schemaalso compare againstUSERNAME_PROFILE_SCHEMA_V1from the package, and bump the docs'@thenamespace/offchain-managerpin 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, andexpectedRevisionafter a disconnect; all are reflected here.🤖 Generated with Claude Code
https://claude.ai/code/session_019oGqmTa3TRAEt8JZnPPL6p