Add SIWE (Sign-In with Ethereum) auth for Claim flow#263
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Motivation
Description
GET /api/auth/nonceatapi/auth/nonce.jswhich issues a cryptographically-random hex nonce (16 bytes entropy), returns{ ok: true, nonce }, and is stateless withCache-Control: no-store.POST /api/auth/verifyatapi/auth/verify.jswhich validates presence ofmessageandsignature, enforces domain/URI/chainId and statement intent checks (configurable via env), and callssiweverification when the dependency is available, returning standardizedAUTHENTICATED/AUTH_FAILEDresponses.public/claim.htmlto add a Sign-In with Ethereum panel, explanatory copy clarifying Ethereum auth vs Ed25519 receipts, UI elements (Sign-In with Ethereumbutton,Status,Connected wallet), client-side flow (/api/auth/nonce→ construct SIWE-style message →personal_sign→POST /api/auth/verify) and a gate that requires SIWE auth for CommandLayer namespace mode before continuing.tests/api-auth.test.jsto assert nonce randomness and to ensureverifyrejects missing or malformed inputs.siwecannot be installed (server returns a 503-styleAUTH_FAILEDwith explanatory error) rather than silently accepting requests.Testing
npm testand all repository tests passed (29 tests passed, 0 failed), including the newGET /api/auth/nonceandPOST /api/auth/verifynegative tests.cd examples/webhook-auto-verify && npm install && npm run checkand the example checks succeeded.npm install siwe ethers, but registry access returned 403 in this environment, sosiwecould not be installed and the verify handler reports dependency-unavailable errors as intended.npm run buildand observed expected failure because the repository has nobuildscript.Codex Task