Repository navigation
Description
S11 — WebAuthn hardening, tests and hybrid auth documentation
| Field | Value |
|---|---|
| ID | S11 |
| ETA | 3 — WebAuthn, Stellar and payment pipeline |
| Priority | P0/P1 |
| Complexity | Medium |
| Depends on | S10 |
| Atomic tasks | SRV-046, SRV-047, SRV-048 |
| Milestone | WebAuthn production-ready |
Executive summary
This deliverable consolidates 3 atomic server tasks into one sprint-sized ticket for WebAuthn hardening, tests and hybrid auth documentation.
Success means: WebAuthn production-ready.
Product context
Ding Payments is a self-custodial Stellar P2P app: the server validates NFC payment requests, enforces hybrid Supabase + WebAuthn authorization, relays signed XDR to Horizon, and indexes history.
User stories
- As a developer, I want S11 complete so I can run the next ETA without manual archaeology.
- As a receiver, I want my NFC payment request validated consistently with the canonical contract.
- As a sender, I want clear API errors when a payment request is malformed or expired.
- As an operator, I want migrations, health checks, and logs sufficient to debug testnet payments.
Prerequisites
- Deliverable S10 merged and deployed to dev
- Node 20+, npm, Supabase project credentials, Postgres reachable via
DATABASE_URL - Read Sections 3–6 of server-build-plan.md before coding
Atomic sub-task checklist
| SRV-ID | Title | Key deliverable |
|---|---|---|
| SRV-046 | Per-device credentials policy | Per-device credentials policy |
| SRV-047 | WebAuthn tests with mocks | WebAuthn tests with mocks |
| SRV-048 | Document hybrid auth flow in ARCHITECTURE | Document hybrid auth flow in ARCHITECTURE |
Scope — In
- All atomic tasks SRV-046, SRV-047, SRV-048 as specified in server-build-plan.md
- NestJS 11 patterns: modules, providers, DTOs with class-validator, Swagger decorators where applicable
- Unit and/or E2E tests for new behavior; keep CI green (
ci-server.yml) - Production-quality code under
ding-server/src/for S11
Scope — Out
- Client UI or Expo changes (ding-payments repo)
- Mainnet launch configuration (testnet MVP only unless explicitly toggled)
- Push notifications on payment confirmation (post-MVP P3)
- Custodial wallets or server-side key storage
- Features not listed in atomic SRV IDs for this deliverable
Architecture & conventions
Target architecture from server-build-plan.md Section 3: flat src/modules/* layout, ConfigModule validation, global exception filter, URI versioning /v1.
ding-server/
├── src/
│ ├── main.ts
│ ├── app.module.ts
│ ├── config/
│ ├── common/filters/
│ ├── database/
│ ├── auth/
│ ├── supabase/
│ ├── stellar/
│ ├── webauthn/
│ ├── contracts/
│ └── modules/
│ ├── users/
│ ├── payment-requests/
│ ├── payments/
│ └── transactions/
├── prisma/schema.prisma
├── docs/
└── test/
Files to create/modify
ding-server/src/See server-build-plan.md atomic files for SRV-046See server-build-plan.md atomic files for SRV-047See server-build-plan.md atomic files for SRV-048
Implementation guide
- Implement SRV-046 — Per-device credentials policy; cross-check Section 8 in server-build-plan.md for files and snippets.
- Implement SRV-047 — WebAuthn tests with mocks; cross-check Section 8 in server-build-plan.md for files and snippets.
- Implement SRV-048 — Document hybrid auth flow in ARCHITECTURE; cross-check Section 8 in server-build-plan.md for files and snippets.
- Run
npm run lintand fix any new violations. - Run targeted unit tests for the module(s) touched.
- Run
npm run test:e2ewhen HTTP surface changed. - Update Swagger decorators if routes or DTOs changed.
- Verify error responses use
{ statusCode, message, code?, errors? }shape from Section 5. - Document any new env vars in
.env.exampleand README. - Manual smoke test with
npm run start:devand curl/httpie against/v1routes.
Acceptance criteria
- SRV-046 — Per-device credentials policy: acceptance criteria in server-build-plan.md satisfied
- SRV-047 — WebAuthn tests with mocks: acceptance criteria in server-build-plan.md satisfied
- SRV-048 — Document hybrid auth flow in ARCHITECTURE: acceptance criteria in server-build-plan.md satisfied
- CI workflow passes lint, build, and test jobs
- No secrets committed;
.envgitignored - OpenAPI/Swagger reflects new or changed endpoints
- Prisma client regenerated if schema changed (
npm run prisma:generate) - Database migration applied locally without drift
- Error codes align with Appendix A where applicable
- Logs do not print JWTs, XDR secrets, or service role keys
- Code review checklist: DTO validation, auth guard, idempotency where required
- README or docs updated when setup steps change
- Definition of done checklist below is complete
Test plan
- Unit: Services, validators, and state machine pure functions for S11
- Integration: Prisma against local Postgres or test container for repositories
- E2E: Supertest against Nest app with JWT mock and Stellar SDK mocks
- Contract: payment-request.v1 golden vectors (S08+) — invalid BTC/ETH assets rejected
- Manual: curl examples from Section 5 and Appendices
- Regression: Re-run auth suite when touching guards (S06/S07)
- Performance: Smoke load on validate when approaching S20
Client coordination
See Client ↔ server alignment table below.
Security notes
- Never log
SUPABASE_JWT_SECRET,SUPABASE_SERVICE_ROLE_KEY, or raw WebAuthn challenges - Validate all inbound DTOs; reject unknown fields where strict mode applies
- Use parameterized Prisma queries only — no raw SQL unless documented
- Follow hybrid auth model: Supabase session + WebAuthn for payment approval
Risks & pitfalls
- Scope creep — stay within listed SRV atomic tasks for this sprint
- Drift from client NFC contract — coordinate before changing validation rules
- Stellar testnet instability — use health checks and retries (S12/S13)
- Prisma migration conflicts — serialize DB changes with team
- WebAuthn environment mismatch between dev client and server origins
- Underestimating E2E flakiness — mock Horizon in tests where possible
Definition of done
- All atomic SRV tasks implemented
- Tests added/updated and passing locally
- Swagger updated for HTTP changes
- No regression in CI pipeline
- Peer review completed
- Linked client Issue updated if integration contract changed
- Merged to main with migration deploy notes if applicable
Source: build plan
Activity
egekoca commentedon Jul 15, 2026
Can you give me?
egwujiohaifesinachiperpetual-max commentedon Jul 15, 2026
Hello boss, Please assign this issue to me. i checked it out and im confident i will solve it
my eta is 4 hours
gloskull commentedon Jul 15, 2026
Hi, I’d love to work on this issue. I have 4 years of experience across backend, frontend, full-stack, and smart contract development. I understand the task clearly and can deliver a clean, efficient, well-tested solution on time, with strong focus on code quality and maintainability. My PR will be submitted in 12hours
Dmong04 commentedon Jul 16, 2026
Hi maintainer!
Can I handle this issue? I worked something similar with Ding Payments in server with the prisma entities for migration and I have the knowledge about this flow.
Also have experience with swagger documentation and unit tests using mocks.
grantfox-oss commentedon Jul 16, 2026
🦊 GrantFox — @Dmong04 has been assigned to this issue as part of the Official Campaign | FWC26 campaign!
Next steps:
Closes #33)Good luck! Track your progress on GrantFox.
Dmong04 commentedon Jul 21, 2026
Hi @JoelVR17!
It looks like the CI pipeline broke, is this a problem that predates S11 or could my PR have broken something?
JoelVR17 commentedon Jul 21, 2026
Hey!
Don't worry, the CI was broken before, go ahead
Dmong04 commentedon Jul 21, 2026
Got it, thanks!
Let me know if there are conflicts to solve before merge
grantfox-oss commentedon Jul 21, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign | FWC26 campaign!
@Dmong04's PR #38 was approved and merged by @JoelVR17.
🏆 @Dmong04: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (131 total points). Track your full progress on GrantFox.
👏 Great work, @Dmong04! Keep contributing to Ding-Payments.