Passkey DNA Kit Activation Implementation
Overview
This implementation adds passkey-based authentication (Face ID, Touch ID, Windows Hello) to the DNA kit activation flow using Privy and existing GenoBank infrastructure.
Files Created
Frontend
passkey-activation.html
- Main activation page with 4-step flow
passkey-activate.js
- JavaScript handling Privy integration and API calls
Backend
/production_api/plugins/activation/api_activate_kit.py
- API endpoint that leverages existing biosample infrastructure
How It Works
Magic URL Support
The implementation seamlessly supports DNA kits shipped with magic URLs:
- Format:
https://genobank.io/activate/?biosampleId={serial}&laboratoryId={lab}&physicalId={kit}#{secret}
- The secret is an HMAC-SHA256 of the biosample serial
- When detected, uses the existing
/claim/{token_id}
endpoint
- Falls back to new activation endpoint for manual registrations
1. Authentication (Step 1)
- Uses Privy SDK for passkey authentication
- Falls back to email/social login if passkeys not available
- Creates embedded wallet and signs message for GenoBank auth
- Verifies signature using existing
/recover
endpoint
2. Barcode Scanning (Step 2)
- Manual barcode entry or camera scanning
- Uses ZXing library for browser-based barcode scanning
- Validates barcode format (12-16 digits)
- Detects manufacturer from barcode prefix
3. Confirmation (Step 3)
- Shows kit details for user confirmation
- Displays detected manufacturer and kit type
- Shows wallet address that will own the BioNFT
4. Activation (Step 4)
- Calls
/api_activation/
endpoint
- Creates biosample record in MongoDB
- Mints BioNFT on Story Protocol
- Returns IP asset ID and transaction hash
Existing Infrastructure Used
- Authentication
/recover
endpoint for signature verification
- Standard Web3 signature pattern
- Biosample Management
BiosampleDAO
for database operations
BiosampleService
for business logic
- Existing biosample MongoDB schema
- Story Protocol Integration
StoryIpManagerDAO
for NFT minting
- Existing collection addresses
- IPFS metadata upload
- Kit Manufacturer Detection
- Logic from newborn plugin for prefix detection
- Support for DNA Genotek, Spectrum DNA, etc.
Setup Required
- Privy Configuration
- ✅ Privy App ID configured:
cmc5jn5sh01wel10ng0x5atlt
- App configured for passkey, email, Google, and Apple login methods
- Ready for production use
- API Integration
- Add the activation plugin to your CherryPy app
- Ensure Story Protocol is configured
- Verify biosample collection address
- Frontend Deployment
- Deploy files to
/activate/
directory
- Update navigation to include activation link
- Test passkey support on target devices
Security Considerations
- All operations are scoped by wallet address
- Signatures verified on every API call
- Duplicate activation prevented
- IPFS metadata includes activation details
Next Steps
- Add email notifications on successful activation
- Implement QR code scanning option
- Add support for bulk kit activation
- Create admin interface for managing activations
- Add analytics tracking for activation success rates