feat: implement SEP-10 web authentication alongside existing SIWS - #114
feat: implement SEP-10 web authentication alongside existing SIWS#114collinsezedike wants to merge 2 commits into
Conversation
✅ Deploy Preview for stellar-signet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@collinsezedike is attempting to deploy a commit to the blockchainmaxis-8449's projects Team on Vercel. A member of the Team first needs to authorize it. |
1e9a9f8 to
ea7f075
Compare
|
@collinsezedike Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
This is careful work and the security reasoning is sound — delegating the challenge/verify mechanics to the SDK's I'm holding the merge on one deployment prerequisite rather than on anything in the diff. Blocking:
|
|
Thank you for the review, @blockchain-maxis. Addressed both non-blocking points in
Leaving |
Summary
GET/POST /api/auth/sep10— a single URL for both steps, matching whatstellar.toml'sWEB_AUTH_ENDPOINTadvertises and what generic SEP-10 clients expect (splitting challenge/verify across two paths would break anything using a standard SEP-10 library)home_domain/web_auth_domainManage Data operations, signature checks) are delegated to@stellar/stellar-sdk'sWebAuthmodule (the reference implementation), inlib/sep10.ts, rather than hand-rolled — this is exactly where subtle spec violations creep in (transposed domain fields, infinite timebounds, accepting a caller-suppliedhome_domainblindly, etc.){ token }) and this app's existing session cookie, sotRPC'saccount.*procedures work unchanged regardless of which auth flow a caller usedAccess-Control-Allow-Origin: *+OPTIONS), since the entire point of SEP-10 is interoperability with wallets/tooling that aren't this app's own frontend — unlike the existing same-origin-protected endpoints/.well-known/stellar.tomlso external SEP-10 clients can actually discoverWEB_AUTH_ENDPOINT,SIGNING_KEY, andNETWORK_PASSPHRASElib/auth.ts,/api/auth/{challenge,verify}) is untouched and still fully functional — verified with a manual smoke test end to endlib/wallet.ts'ssignIn()) now goes through SEP-10 (signTransactioninstead ofsignMessage) to complete the migration for our own UITest plan
lib/sep10.test.ts: challenge/signature round-trip, rejects unsigned challenge, rejects wrong signer, rejects a caller-suppliedhome_domainthat doesn't match this service, rejects expired timebounds, rejects a challenge built against a different server key, JWT round-trip + tamper/garbage rejectionpnpm --filter @signet/web test(39/39),typecheck,lintall passnext build && next start): challenge → sign → verify → JWT + session cookie issued; unsigned challenge rejected (401);stellar.tomlserved with correctWEB_AUTH_ENDPOINT/SIGNING_KEY; legacy/api/auth/{challenge,verify}flow still works unchangedCloses #65