Skip to content

feat(auth): add manageData operation and time bounds validation to SEP-10 verification#64

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
oomokaro1:feat/sep10-signature-verification
Jul 18, 2026
Merged

feat(auth): add manageData operation and time bounds validation to SEP-10 verification#64
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
oomokaro1:feat/sep10-signature-verification

Conversation

@oomokaro1

Copy link
Copy Markdown
Contributor

Closes #4

Summary

Strengthen SEP-10 challenge verification by enforcing time bounds and validating the expected manageData operation is present in the signed transaction.

Changes

  • Require time bounds: Reject transactions with no time bounds or infinite time bounds (TimeoutInfinite) — prevents replay attacks
  • Validate manageData operation: Ensure the signed transaction contains the expected chainlearn.io manageData operation before accepting it
  • Test coverage: Added 2 new unit tests covering both rejection paths (missing time bounds, wrong manageData operation)

Testing

  • npm run typecheck — passes
  • npm run lint — passes (no new warnings)
  • npx vitest run tests/unit/services/sep10-auth.test.ts — 10/10 tests pass
    • Existing tests: challenge creation, expired challenges, source mismatch, invalid signature, valid auth (new + existing user)
    • New tests: missing time bounds rejection, missing manageData operation rejection

Tradeoffs

  • Kept the existing StellarSdk.verify() approach for signature verification (ed25519) rather than iterating signatures manually
  • Used HOME_DOMAIN constant (chainlearn.io) as the expected manageData operation name, matching createChallenge

Out of scope

  • No changes to JWT generation or token handling
  • No changes to the challenge creation flow (already correct)
  • No changes to auth types or routes

Closes #4

…P-10 verification

- Require time bounds on challenge transactions (reject TimeoutInfinite)
- Validate that the transaction contains the expected manageData operation
- Add test coverage for both validation paths

@DeFiVC DeFiVC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: Approve

Solid implementation of SEP-10 time bounds and manageData validation.

What looks good:

  • Time bounds enforcement (missing + TimeoutInfinite rejection) prevents replay attacks
  • manageData operation validation matches HOME_DOMAIN used in createChallenge
  • Two new test cases cover both rejection paths cleanly
  • PR description is thorough with clear testing evidence and tradeoff notes
  • Clean scope — only the auth service and tests touched

CI green, tests pass, code is correct. Approving.

@DeFiVC
DeFiVC merged commit c9b43f3 into ChainLearnOfficial:main Jul 18, 2026
2 checks passed
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.

Replace simplified auth verification with real SEP-10 signature verification

2 participants