feat(admin): GET /admin/users/:id/credentials with on-chain verification (#410) - #460
Open
ZacLou wants to merge 1 commit into
Open
feat(admin): GET /admin/users/:id/credentials with on-chain verification (#410)#460ZacLou wants to merge 1 commit into
ZacLou wants to merge 1 commit into
Conversation
ZacLou
force-pushed
the
feat/admin-user-credentials-410
branch
from
September 4, 2026 06:20
c6b0ea1 to
9d07678
Compare
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.
What
Adds
GET /api/v1/admin/users/:id/credentials(#410): all credentials for a user, each with its mint transaction verified live against Stellar Horizon, so admins see real on-chain state instead of trusting a stored hash.Implementation
CredentialService.getAdminUserCredentials(userId)— joins credentials → courses for titles (same shape as the user-facinglist()), then resolves per-row verification:mintTxHash == null→{kind: "none", status: "unknown"}pending_indexer_confirmationplaceholder (bad-seq recovery path) →pendingwithout a Horizon lookup, same convention asreward.getTransactionsstellarClient.getHorizonTransaction(hash)→confirmed/pending/failedwith ledger + confirmation countGET /:id/credentialsonadmin-users.routes(authGuard + adminGuard), Fastify swagger schema matching the module's existing routes.credentials:admin-list:<userId>key — deliberately not shared with the user-facingcredentials:list:key (different consumer, different TTL).Notes
verification.ledger/verification.confirmationscome straight from the Horizon verifier already used by rewards transactions, so no new Stellar client code.credentialshas a unique(userId, courseId)index andmint()is the only writer.Closes #410
Testing
tests/unit/admin/admin-user-credentials.test.ts(4 cases): on-chain resolution paths, the pending-placeholder mapping, cache hit short-circuit, and the 30s TTL. All 4 pass (vitest run).tsc --noEmitis unchanged by this PR (main currently carries its own pre-existing errors; this branch adds no new ones — verified by diffing against a clean worktree of 4765abb).