feat(sep10-ed25519): implement SEP-10 Ed25519 JWT verification middle… - #53
Merged
milah-247 merged 2 commits intoJul 23, 2026
Merged
Conversation
…ware - Implement api/middleware/sep10.ts with two variants: requireSep10 (HS256 shared-secret for SEP-12/31 gate, existing) requireSep10Ed25519 (Ed25519 via Node.js crypto.verify for escrow release/dispute) - Ed25519 verification uses Node crypto.verify (jsonwebtoken v9 lacks EdDSA support) - Anchor public key fetched from stellar.toml at ANCHOR_DOMAIN, cached 1 hour - setTomlKeyCache() / tomlKeyCache exported for test injection without HTTP - Create api/routes/escrow.ts gating POST /:id/release and POST /:id/dispute behind requireSep10Ed25519; GET /:id and POST / are unprotected - Mount escrow router at /api/v1/escrow in api/app.ts - Integration tests in api/__tests__/sep10.test.ts (11 tests, all pass): missing header -> 401, valid token -> 200, expired -> 401, tampered signature -> 401, TOML cached -> endpoint called exactly once - jest.setup.ts sets env vars before any module imports (fixes config.ts init) - Document middleware in api/middleware/README.md No secrets hardcoded - all config from SEP10_SIGNING_SEED, JWT_SECRET, ANCHOR_DOMAIN Closes Afro-Pay#7
5 tasks
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.
Here is the fully arranged, comprehensive Pull Request description formatted in Markdown. It structures your notes neatly into the template you provided, expanding on the technical details while keeping everything clear and scannable.
Verified Scenarios:
401 Unauthorizedblock.200 OK.401 Unauthorized.stellar.tomlendpoint is called exactly once during sequential calls.Checklist
pub/ exported items have doc comments (/** ... */or///)unwrap()or unhandled promise rejections in non-test codeREADME.md, inline comments, relevantdocs/files)contracts/MIGRATION.mdupdated if storage keys or value types changedThreat Model Impact
Impact Analysis
This PR opens up new HTTP route entries (
POST /:id/releaseandPOST /:id/dispute) that carry structural authority over fund execution cycles.Mitigations:
HS256) cannot access high-stakes escrow operations. Escrow mutations explicitly demand cryptographic verification viarequireSep10Ed25519.crypto.verifycore API instead of unmaintained or incomplete third-party modules.SEP10_SIGNING_SEED,JWT_SECRET,ANCHOR_DOMAIN).ADR Reference
N/A
Screenshots / Logs
Jest Integration Suite Results