feat(certificates):Implement Comprehensive NFT Certificate Verification and Metadata System - #210
Closed
Luluameh wants to merge 2 commits into
Closed
Conversation
…ion and metadata system with Soroban blockchain integration, public verification endpoints, batch verification, revocation/reissue workflows, QR code generation, analytics, and full test coverage
|
@Luluameh 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! 🚀 |
…tency - Fixed Certificate type definitions to use string status instead of enum - Updated all services to handle nullable fields correctly - Simplified controller with proper parameter handling - Fixed qrCodeGenerator import and duplicate methods - Updated CertificateService with consistent return types - Fixed validation schema optional field handling - Removed duplicate code in controller - Added proper null checks for all database fields - Fixed metadata generation with grade optional handling - Updated all imports to resolve module resolution issues Fixes build failures and prepares for deployment
Contributor
|
Pr under review, i will get back to you if i find any wrong implementations. |
Contributor
Author
|
Hello @ayomideadeniran, you have closed. Without merging, can you merge it because it is showing that I haven't made a PR on the drips website? |
Contributor
|
pr under review, if i find any wrong implementation i will notify you. |
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.
Summary
This PR implements a full-featured certificate verification backend for the Web3 Student Lab, fulfilling all requirements of the "Backend - Implement Comprehensive NFT Certificate Verification and Metadata System" issue. The system provides NFT-compliant metadata, public verification endpoints, certificate lifecycle management, and Soroban blockchain integration.
Problem Solved
The existing certificate system had basic NFT minting but lacked:
Solution Overview
Implemented a production-ready certificate management system with:
1. NFT Metadata System (
certificates/MetadataGenerator.ts,types/certificate.types.ts)2. Verification Service (
certificates/VerificationService.ts)GET /api/v1/certificates/verify/:tokenId- Single cert verification (public, no auth)POST /api/v1/certificates/verify/batch- Batch verification (up to 100 certs)GET /api/v1/certificates/:tokenId/metadata- NFT metadata endpoint3. Certificate Lifecycle Management (
certificates/CertificateService.ts,RevocationService.ts)4. Blockchain Integration (
blockchain/CertificateBlockchainService.ts)5. Utilities
utils/certificateImageGenerator.ts- Canvas/SVG certificate image generationutils/qrCodeGenerator.ts- QR codes linking to verification pages6. Analytics (
certificates/CertificateAnalytics.ts)Files Changed
Modified:
backend/package.json- Addedcanvasandqrcodedependenciesbackend/prisma/schema.prisma- Extended Certificate model with 10+ new fieldsbackend/src/config/rpcConfig.ts- Added 6 certificate-related config constantsbackend/src/routes/index.ts- Replaced old certificates router with new routes modulebackend/.env.example- Added 9 new environment variablesNew Files (21 files):
Acceptance Criteria ✅
GET /api/v1/certificates/:tokenId/metadatareturns full ERC-721 schemaGET /api/v1/certificates/verify/:tokenIdis public/verify/batchvalidates max 100 tokenIdsPUT /:id/revokesets status=REVOKED + reasonBLOCKCHAIN_SIMULATION_MODE=falsefor liveSecurity Considerations
✅ Public verification endpoints are read-only
✅ Revocation/reissue require issuer DID (service layer enforcement)
✅ No PII (email, phone) exposed in public responses
✅ Rate limiting applies to all certificate endpoints (15min window, 100 reqs)
✅ Input validation via Zod on all endpoints
Performance
Testing
Unit Tests: Service layer with mocked blockchain
certificates.test.ts- 25+ test cases covering mint, verify, revoke, reissue, analyticscertificates.validation.test.ts- All Zod schema validation edge casesIntegration Tests: Full HTTP API via supertest
certificates.api.test.ts- 15+ endpoint testsTest Database: Uses Prisma with isolated test data, auto-cleanup after each suite.
Run tests:
Environment Variables Added
How to Test Locally
cd backend && npx prisma migrate devcd backend && npx prisma db seednpm run dev(listens on port 8080)Notes for Reviewers
BLOCKCHAIN_SIMULATION_MODEnot set). To test live Soroban, set env var and provideCERTIFICATE_CONTRACT_ID+ Stellar keys.canvasnpm package fails to install (native dependencies).Certificatemodel in Prisma now includestokenIdas unique field for on-chain ID mapping.verification_logstable.Related Issue
Closes #198 - Backend - Implement Comprehensive NFT Certificate Verification and Metadata System