Skip to content

test(wallet): cover wallet auth flows and add Stellar ecosystem puzzles - #1066

Open
peaceshallom37-rgb wants to merge 2 commits into
UnityChainxx:mainfrom
peaceshallom37-rgb:feat/wallet-auth-tests-and-ecosystem-puzzles
Open

peaceshallom37-rgb wants to merge 2 commits into
UnityChainxx:mainfrom
peaceshallom37-rgb:feat/wallet-auth-tests-and-ecosystem-puzzles

Conversation

@peaceshallom37-rgb

Copy link
Copy Markdown

Summary

Resolves both issues assigned to this contributor, with all changes confined to stellar-extensions/ as required by the isolation statements.

Closes #976
Closes #1014

Wallet authentication tests (#976)

Adds stellar-extensions/tests/wallet/wallet-auth.integration.test.ts, which wires the real WalletService and WalletAuthService to in-memory repositories and real ed25519 keypairs. It covers:

  • challenge generation and validation, including TTL clamping, invalid/muxed/contract addresses, and domain binding
  • signature verification with valid, wrong-key, tampered and malformed signatures
  • replay prevention, including the compare-and-set race on nonce consumption
  • wallet-session token creation, JWT payload shape, expiry (both token and server-side record) and lastSeenAt refresh
  • wallet disconnection through single-session logout, wallet-wide revocation and expired-session pruning

wallet-auth.service.ts reaches 100% statement, line and function coverage. A Jest moduleNameMapper points the backend-only ESM @nestjs/typeorm package at the decorator stub in tests/stubs/nestjs-typeorm.js, because the tests construct the services directly.

Stellar ecosystem puzzles (#1014)

Adds stellar-extensions/frontend/puzzles/stellar-ecosystem/ with ten medium-difficulty puzzles:

  • anchors and the SEP-24 hosted transfer flow
  • path payments: strict send vs strict receive, plus multi-hop conversion counting
  • SEP-10 challenge signing and the resulting JWT
  • SEP-38 quote scope and firm-quote expiry
  • Soroban RPC and the Stellar Asset Contract

Every puzzle follows the extended puzzle schema, includes a documentation-linked hint, a points reward, and 3–5 test cases. Each puzzle set keeps its own schema extension so schemas/puzzle-template.schema.json is untouched.

Verification

  • npx jest --config stellar-extensions/tests/jest.config.js — 55 tests pass (wallet and existing referral suites)
  • node stellar-extensions/scripts/validate-puzzle-content.js --dir stellar-extensions/frontend/puzzles/stellar-ecosystem --schema stellar-extensions/frontend/puzzles/stellar-ecosystem/puzzle-template.schema.json — all 10 puzzles pass
  • npx tsc -p stellar-extensions/tests/tsconfig.json --noEmit — no errors in the new wallet suite (pre-existing referral spec errors remain untouched)
  • vitest --config stellar-extensions/vitest.config.mjs — 25 existing store tests pass

Add a Jest integration suite that wires the backend wallet services to
in-memory repositories and real ed25519 keypairs. It verifies challenge
generation, signature acceptance and rejection, single-use replay
protection, wallet-session creation and expiry, activity refresh, and
logout/revocation handling without a database or live network.
Add ten medium puzzles covering anchors and SEP-24, path payments and
multi-hop conversion, SEP-10 challenge authentication, SEP-38 quotes,
and Soroban integration through RPC and the Stellar Asset Contract. Each
puzzle includes documentation-linked hints, a points reward, and 3-5
test cases validated by the extension content validator.
@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@peaceshallom37-rgb 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! 🚀

Learn more about application limits

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.

Stellar Ecosystem Puzzle Set Unit Tests for Wallet Authentication Service

1 participant