This Anti-Counterfeit Pharmaceutical Verification System is a high-security, full-stack application developed using React Native, Node.js/Express, and MongoDB. The platform combats drug duplication and counterfeiting by leveraging dynamically generated cryptographic QR codes printed at the manufacturing stage and validated on-demand via mobile scans.
๐ฏ The Problem
Global distribution systems suffer from counterfeit pharmaceutical leakage, where cloned or fake packaging containing dangerous substances enters the supply chain. Standard barcodes and regular QR codes are easily photocopied or duplicated, meaning physical authentication methods alone cannot verify authenticity.
๐ก The Security Concept
I engineered a one-time validation protocol combining physical packaging markers and database check states:
- 1.Manufacturer Generation: The admin dashboard generates a unique cryptographic payload containing salted hashes for each medicine batch and package, encoding them into secure QR codes ready for printing.
- 2.First-Scan Authentication: The first time a consumer scans the package via their mobile app, the system verifies the hash signature, registers the user, increments the verification count, and marks the medicine as Authentic.
- 3.Double-Scan Detection: If the QR code is photocopied and scanned again, the database detects the incremented verification state ($count > 0$). Instead of confirming authenticity, it displays a warning that the product may be compromised and presents a masked, GDPR-compliant partial email (e.g.,
t***@e***.com) of the account that completed the original scan. - 4.Invalid Hash Rejection: If the scanned payload's cryptographic signature is modified or invalid, the system instantly flags it as Fabricated/Counterfeit.
๐ ๏ธ Technical Implementation
- โธCryptographic Engine: Implemented backend-level hashing (SHA-256 with dynamic salt strings) to wrap item serials and manufacturer metadata into un-spoofable signature strings.
- โธAdmin Printing Pipeline: Built a high-performance admin portal rendering dynamic SVG-based QR codes, ready for high-resolution thermal printing systems.
- โธVerification Mobile Scanner (React Native): Developed a fast scanner interface using device camera controllers, making verification requests asynchronously to the Express API.
- โธData Masking Middleware: Engineered standard string regex masks (e.g., masking the domain and local parts of user emails) in Express responses to protect user privacy while presenting indisputable proof of previous scans.
๐ Key Results & Metrics
- โธ๐ Zero-Trust Replication Protection: Photocopied packaging copies are instantly caught on the second scan attempt.
- โธโก Sub-100ms Verifications: Optimized database index checks on the cryptographic serial strings.
- โธ๐ฑ Frictionless Consumer Scanning: Consumers scan QR codes instantly without needing complex technical configurations.