Skip to content

feat(admin): add issuer management endpoints#223

Merged
dev-fatima-24 merged 2 commits into
dev-fatima-24:mainfrom
mathewsap45:feature/issue-34-admin-issuer-endpoints
May 5, 2026
Merged

feat(admin): add issuer management endpoints#223
dev-fatima-24 merged 2 commits into
dev-fatima-24:mainfrom
mathewsap45:feature/issue-34-admin-issuer-endpoints

Conversation

@mathewsap45
Copy link
Copy Markdown
Contributor

Summary

Closes #34

Implements the three admin endpoints for issuer management that invoke the existing add_issuer and revoke_issuer Soroban contract functions.

Changes

  • backend/src/routes/admin.js — Added three new endpoints:
    • POST /admin/issuers — authorizes a new issuer via add_issuer contract call (admin JWT required)
    • DELETE /admin/issuers/:address — revokes an issuer via revoke_issuer contract call (admin JWT required)
    • GET /admin/issuers — lists all authorized issuers by reading contract state
    • Fixed adminOnly middleware to check role === 'admin' instead of role === 'issuer'
  • backend/src/middleware/auth.js — Added 'admin' as a valid JWT role alongside 'patient' and 'issuer'
  • backend/src/routes/auth.js — Admin JWT is issued when ADMIN_PUBLIC_KEY matches the authenticated wallet
  • backend/tests/admin-issuers.test.js — Unit tests for all three endpoints

Acceptance Criteria

  • POST /admin/issuers — add an issuer (admin JWT required)
  • DELETE /admin/issuers/:address — revoke an issuer (admin JWT required)
  • GET /admin/issuers — list all authorized issuers
  • Admin JWT role separate from issuer JWT role

Testing

cd backend && npm test -- --testPathPattern=admin-issuers

mathewsap45 and others added 2 commits April 29, 2026 09:43
- POST /admin/issuers — add issuer via add_issuer contract call
- DELETE /admin/issuers/:address — revoke issuer via revoke_issuer
- GET /admin/issuers — list authorized issuers via list_issuers simulation
- Introduce 'admin' JWT role (separate from 'issuer' and 'patient')
- Admin public key now receives 'admin' role on SEP-10 login
- All three endpoints require admin JWT; 403 for any other role
- Audit log entries on add/revoke actions
- 13 tests covering auth, validation, and happy paths

Closes dev-fatima-24#34
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 5, 2026

@mathewsap45 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

@dev-fatima-24 dev-fatima-24 merged commit f810ad7 into dev-fatima-24:main May 5, 2026
3 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.

Implement admin endpoints for issuer management

2 participants