Skip to content

feat: adopt wata device-code transport for cli auth - #750

Open
jxom wants to merge 9 commits into
mainfrom
jxom/wata-device-code
Open

feat: adopt wata device-code transport for cli auth#750
jxom wants to merge 9 commits into
mainfrom
jxom/wata-device-code

Conversation

@jxom

@jxom jxom commented Aug 1, 2026

Copy link
Copy Markdown
Member

Rewrites accounts/cli onto the Wata device-code transport (RFC 8628 with PKCE), adds an accounts/deviceCode adapter with a tempoWallet preset, and removes CliAuth and Handler.codeAuth from accounts/server, aligning CLI auth with the wallet's other uRPC transports.

Wallet counterpart: https://github.com/tempoxyz/wallet/pull/651

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
accounts-site Ready Ready Preview Aug 2, 2026 5:02am

Request Review

@jxom
jxom marked this pull request as ready for review August 1, 2026 06:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c872eacf4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ref-impls/cli-auth/package.json
Comment thread src/core/adapters/deviceCode/deviceCode.ts Outdated
jxom added 2 commits August 1, 2026 17:29
# Conflicts:
#	pnpm-lock.yaml
#	ref-impls/cli-auth/cli.ts
#	ref-impls/cli-auth/package.json
#	ref-impls/cli-auth/src/App.tsx
#	ref-impls/cli-auth/worker/approve.ts
#	ref-impls/cli-auth/worker/deps.ts
#	ref-impls/cli-auth/worker/index.ts
#	src/cli/Provider.localnet.test.ts
#	src/cli/adapter.ts
#	src/server/CliAuth.test-d.ts
#	src/server/CliAuth.test.ts
#	src/server/CliAuth.ts
#	src/server/internal/handlers/codeAuth.ts
@jxom

jxom commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

Merged main. The CLI limit-update feature from #748 is ported onto the new transport: cli() now runs wallet_updateAccessKey as its own device-code exchange (the request carries the current pending authorization; the wallet returns a verified replacement, or nothing after an on-chain update), applied via store.accessKeys.updateAuthorization.

@pkg-pr-new

pkg-pr-new Bot commented Aug 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/tempoxyz/accounts@750

commit: cc9af34

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
Worker Preview
Wagmi https://c457635e-accounts-wagmi.porto.workers.dev

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
Worker Preview
Playground https://ca3443e4-accounts-playground.porto.workers.dev

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 420553c843

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/adapter.ts
Comment thread src/core/adapters/internal/fromRequest.ts
Comment thread src/cli/adapter.ts
Comment thread package.json

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc76f4f464

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/adapter.ts Outdated
Comment on lines +117 to +118
if (!prompt.verificationUriFull)
process.stdout.write(`Enter code ${prompt.userCode} at ${prompt.verificationUri}\n`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Format the raw code in the fallback prompt

When the CLI uses the new Handler.deviceCode host, whose registration response intentionally exposes the raw eight-character protocol value, and verificationUriFull is absent, this renders ABCDEFGH instead of the required human-facing ABCD-EFGH. Apply hyphen formatting only to the text written to stdout while preserving the raw value in the protocol request.

AGENTS.md reference: AGENTS.md:L55-L58

Useful? React with 👍 / 👎.

Comment on lines +109 to +115
const validation = await validate?.({
record,
request: pending,
result: submittedResult,
userCode,
})
if (validation) return validation

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require validation before approving submitted results

When a host uses the documented Handler.deviceCode configuration without the optional validate callback, POST /verify accepts a browser-supplied RPC result and marks the device code approved without authenticating the submitter or verifying that the result is valid for the pending request. Since Handler.from also enables wildcard CORS by default, anyone who obtains the displayed user code can submit a fabricated connect or signing result; make validation mandatory or provide a safe authentication and method-validation default before calling actions.approve.

Useful? React with 👍 / 👎.

Comment on lines +10 to +12
results: z.optional(
z.array(z.object({ id: z.union([z.string(), z.number()]), result: z.unknown() })),
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Relay RPC errors from the approval page

When executing an approved wallet request fails for a reason other than explicit denial, the approval page has no valid response shape it can submit: every entry is required to contain result, and an RPC error entry fails this schema. The verify request therefore returns 400 while the device record remains pending, so the client eventually reports a timeout instead of the actual wallet error; accept result-or-error envelopes and call event.reject for submitted errors.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc9af34ab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +124 to +126
if ('result' in response) {
const validation = await validate({
record,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run approval policy for error and denial responses

When the host relies on the required validate callback to protect POST /auth/device/verify, an approval containing an RPC error bypasses it because validation runs only for entries with result; the earlier action === 'deny' branch bypasses it as well. With the default wildcard CORS behavior, anyone who obtains a pending user code can therefore settle the request as rejected without satisfying the host's authentication or method policy. Although validate is now required, this new conditional is fresh evidence that non-success settlements remain unvalidated; invoke a policy/authentication hook before both actions.approve and actions.deny, expanding its input to support error envelopes.

Useful? React with 👍 / 👎.

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