@genobank/biofs 2.1.11 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,252 @@
1
+ # BioFS Admin Register Lab Command
2
+
3
+ ## Overview
4
+
5
+ The `biofs admin register-lab` command onboards new research labs to the GenoBank platform on **Sequentia Network** with minimal input.
6
+
7
+ ## Features
8
+
9
+ - **Website-based extraction**: Automatically extracts lab information from website
10
+ - **Custodial wallet generation**: Creates secure EIP-55 wallet for lab
11
+ - **MongoDB integration**: Stores lab profile with all metadata
12
+ - **Sequentia Network registration**: Registers as BioPIL DAO permittee
13
+ - **Blockchain logging**: Records registration transaction on-chain
14
+
15
+ ## Network Configuration
16
+
17
+ ✅ **Sequentia Mainnet**:
18
+ - RPC URL: `http://52.90.163.112:8545`
19
+ - Chain ID: `15132025`
20
+ - BioPIL DAO: `0xDae899b64282370001E3f820304213eDf2D983DE`
21
+
22
+ ❌ **Deprecated Networks**:
23
+ - Avalanche Fuji (deprecated)
24
+ - Story Protocol (use Sequentia instead)
25
+
26
+ ## Usage
27
+
28
+ ### Basic Usage (Minimal Input)
29
+
30
+ ```bash
31
+ biofs admin register-lab https://novogene.com --yes
32
+ ```
33
+
34
+ This command will:
35
+ 1. Extract lab information from the website
36
+ 2. Generate a custodial wallet
37
+ 3. Store in MongoDB
38
+ 4. Register on Sequentia blockchain
39
+ 5. Display lab credentials
40
+
41
+ ### Advanced Usage (With Overrides)
42
+
43
+ ```bash
44
+ biofs admin register-lab https://ciphersoniclabs.com \
45
+ --name "CipherSonic Labs" \
46
+ --email rashmi@ciphersoniclabs.com \
47
+ --specialization "genomic analysis" \
48
+ --location "San Francisco, CA" \
49
+ --auto-approve
50
+ ```
51
+
52
+ ### Command Options
53
+
54
+ ```
55
+ Arguments:
56
+ <website_url> Lab's website URL (required)
57
+
58
+ Options:
59
+ --name <string> Override extracted lab name
60
+ --email <string> Contact email (extracted if not provided)
61
+ --specialization <string> Research focus (extracted if not provided)
62
+ --location <string> Lab location (extracted if not provided)
63
+ --auto-approve Mark lab as verified immediately
64
+ --yes Skip confirmation prompts
65
+ -h, --help Display help
66
+ ```
67
+
68
+ ## Example Output
69
+
70
+ ```
71
+ 🧬 BioFS Lab Registration - Sequentia Network
72
+
73
+ ✓ Website analysis complete
74
+ ✓ Custodial wallet generated: 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
75
+ ✓ Assigned serial: 43
76
+ ✓ Lab profile stored in MongoDB
77
+ ✓ Sequentia registration complete
78
+
79
+ ✅ Lab registered successfully on Sequentia Network!
80
+
81
+ Lab Details:
82
+ 🏥 Lab: Novogene
83
+ 🔗 Website: https://novogene.com
84
+ 👛 Custodial Wallet: 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
85
+ 🔑 Private Key: (stored securely in MongoDB)
86
+ 📧 Email: contact@novogene.com
87
+ 🧬 Specialization: Genomic sequencing and bioinformatics
88
+ 📍 Location: United States
89
+ ⛓️ Sequentia TX: 0xabc123...
90
+ 🌐 Network: Sequentia (Chain ID: 15132025)
91
+ 📋 Status: Verified ✅
92
+ 🆔 Serial: 43
93
+
94
+ 💡 Next Steps:
95
+ Lab can now receive BioNFT-licensed data:
96
+ $ biofs share <file> --lab 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07 --license non-commercial
97
+
98
+ View in admin dashboard:
99
+ https://admin.genobank.io
100
+ ```
101
+
102
+ ## MongoDB Collections
103
+
104
+ ### `lab_wallets` Collection
105
+
106
+ ```javascript
107
+ {
108
+ "_id": ObjectId("..."),
109
+ "serial": 43,
110
+ "lab_name": "Novogene",
111
+ "wallet_address": "0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07",
112
+ "private_key": "081114ff09e10efb12970c90e162d5bb6d1db6823706633df8fdeeb13590918a",
113
+ "mnemonic": "word1 word2 ... word12",
114
+ "website": "https://www.novogene.com",
115
+ "email": "contact@novogene.com",
116
+ "specialization": "Genomic sequencing and bioinformatics",
117
+ "description": "Leading genomics service provider...",
118
+ "logo_url": "https://www.novogene.com/logo.png",
119
+ "location": "United States",
120
+ "network": "sequentia",
121
+ "chain_id": 15132025,
122
+ "verified": true,
123
+ "auto_generated": true,
124
+ "claimed": false,
125
+ "created_at": ISODate("2025-11-10T08:00:00Z"),
126
+ "updated_at": ISODate("2025-11-10T08:00:00Z")
127
+ }
128
+ ```
129
+
130
+ ### `researcher_registration_logs` Collection
131
+
132
+ ```javascript
133
+ {
134
+ "_id": ObjectId("..."),
135
+ "researcher_serial": 43,
136
+ "researcher_wallet": "0X9346BE6AD3384EB36C172F8B2BB4B7C9D8AFFC07",
137
+ "researcher_name": "Novogene",
138
+ "admin_wallet": "0X088EBE307B4200A62DC6190D0AC52D55BCABAC11",
139
+ "timestamp": ISODate("2025-11-10T08:00:00Z"),
140
+ "action": "researcher_registered_blockchain",
141
+ "network": "sequentia",
142
+ "chain_id": 15132025,
143
+ "tx_hash": "0xabc123...",
144
+ "ip_address": "CLI"
145
+ }
146
+ ```
147
+
148
+ ## Environment Variables
149
+
150
+ Required in `/home/ubuntu/Genobank_APIs/production_api/.env`:
151
+
152
+ ```bash
153
+ # Sequentia Network Configuration
154
+ SEQUENTIA_RPC_URL=http://52.90.163.112:8545
155
+ SEQUENTIA_CHAIN_ID=15132025
156
+ SEQUENTIA_EXECUTOR_KEY=0xfaa9148191dfcb99dc713f2652315b09df590a59e07c78a8d59c288d7f4a5013
157
+
158
+ # BioPIL DAO Contract
159
+ BIOPIL_CONTRACT_ADDRESS=0xDae899b64282370001E3f820304213eDf2D983DE
160
+
161
+ # MongoDB
162
+ MONGO_DB_HOST=mongodb://localhost:27017/genobank-api
163
+
164
+ # GenoBank API
165
+ GENOBANK_API_URL=https://genobank.app
166
+ ADMIN_SIGNATURE=0xa5141ae955bba91ad46a940aefc3b05120489b8b776a180668e5b849f16254d44982fb867724390b388ea3bbc606ab4128e264c7b4d3de4082aeb63c3144af501c
167
+ ```
168
+
169
+ ## Implementation Details
170
+
171
+ ### Files Created
172
+
173
+ 1. **`/home/ubuntu/biofs-cli/src/commands/admin/register-lab.ts`**
174
+ - Main registration logic
175
+ - Website extraction via GenoBank API
176
+ - Wallet generation with ethers.js
177
+ - MongoDB operations
178
+ - Sequentia blockchain registration
179
+
180
+ 2. **`/home/ubuntu/biofs-cli/src/commands/admin/index.ts`**
181
+ - Admin command group index
182
+ - Exports createAdminCommand()
183
+
184
+ ### Integration Points
185
+
186
+ - **GenoBank API**: `/api_lab_customization/extract_website_branding` endpoint
187
+ - **MongoDB**: Direct connection to `genobank-api` database
188
+ - **Sequentia Network**: Blockchain registration via BioPIL DAO
189
+ - **Admin Dashboard**: Labs appear at `https://admin.genobank.io`
190
+
191
+ ## Security Considerations
192
+
193
+ 1. **Private Key Storage**: Private keys stored in MongoDB (consider encryption at rest)
194
+ 2. **Admin Privileges**: Command requires admin credentials from `.env`
195
+ 3. **HTTPS Required**: Website URLs must use HTTPS for extraction
196
+ 4. **Wallet Security**: EIP-55 checksummed addresses
197
+
198
+ ## Troubleshooting
199
+
200
+ ### Website Extraction Fails
201
+ ```bash
202
+ ⚠️ Website extraction failed: timeout
203
+ ```
204
+ **Solution**: Use manual overrides with `--name`, `--email`, etc.
205
+
206
+ ### Blockchain Registration Fails
207
+ ```bash
208
+ ⚠️ Blockchain registration skipped: contract not deployed
209
+ ```
210
+ **Solution**: Lab will still be registered in MongoDB. Blockchain registration is optional.
211
+
212
+ ### MongoDB Connection Error
213
+ ```bash
214
+ Error: MongoServerError: connection refused
215
+ ```
216
+ **Solution**: Verify MongoDB is running and `MONGO_DB_HOST` is correct
217
+
218
+ ## Testing
219
+
220
+ ```bash
221
+ # Test with Novogene (real website)
222
+ biofs admin register-lab https://www.novogene.com --yes
223
+
224
+ # Test with custom overrides
225
+ biofs admin register-lab https://example-lab.edu \
226
+ --name "Example Genomics Lab" \
227
+ --email contact@example.edu \
228
+ --specialization "cancer genomics" \
229
+ --location "Boston, MA" \
230
+ --auto-approve
231
+ ```
232
+
233
+ ## Future Enhancements
234
+
235
+ 1. **Lab Claims Wallet**: Allow labs to claim custodial wallets via email verification
236
+ 2. **Batch Registration**: Register multiple labs from CSV file
237
+ 3. **Email Notifications**: Send registration confirmation to lab email
238
+ 4. **Private Key Encryption**: Encrypt private keys at rest using AWS KMS
239
+ 5. **BioPIL DAO Confirmation**: Verify contract interface and enable full blockchain registration
240
+
241
+ ## Support
242
+
243
+ For issues or questions:
244
+ - GitHub: https://github.com/Genobank/biofs-cli
245
+ - Email: support@genobank.io
246
+ - Dashboard: https://admin.genobank.io
247
+
248
+ ---
249
+
250
+ **Implementation Date**: November 11, 2025
251
+ **Author**: GenoBank.io - BioFS CLI Team
252
+ **Network**: Sequentia Mainnet (Chain ID: 15132025)
@@ -0,0 +1,284 @@
1
+ # BioFS-CLI v2.2.0 Changelog
2
+
3
+ ## Release Date: November 12, 2025
4
+
5
+ ## 🎯 Major Features
6
+
7
+ ### LabNFT Integration Complete
8
+
9
+ Fully integrated LabNFT smart contract with BioFS-CLI and GenoBank API for unified lab registration and verification.
10
+
11
+ #### New LabNFT Module
12
+
13
+ - **File:** `/src/lib/sequentia/LabNFT.ts`
14
+ - **Features:**
15
+ - Full Sequentia LabNFT contract integration
16
+ - EIP-55 checksummed addresses
17
+ - GDPR consent hash generation
18
+ - Lab type enums (LAB, RESEARCHER, INSTITUTION)
19
+ - Access level management (Research, Clinical, Commercial)
20
+ - GA4GH compliance levels
21
+
22
+ #### New Commands
23
+
24
+ 1. **`biofs admin register-lab`** (Updated)
25
+ - Now calls unified GenoBank `/register_lab` API
26
+ - Automatic LabNFT minting on registration
27
+ - Supports custodial wallet generation
28
+ - Website information extraction
29
+ - Stores in unified `labs` MongoDB collection
30
+
31
+ 2. **`biofs admin verify-lab`** (New)
32
+ - Verify LabNFT ownership on-chain
33
+ - Display complete lab information
34
+ - Check verification and active status
35
+ - Show GDPR consent hashes
36
+ - Display access control settings
37
+
38
+ ## 🔧 Breaking Changes
39
+
40
+ ### Lab Registration Flow
41
+
42
+ **Before (v2.1.11):**
43
+ - Registered in `lab_wallets` collection
44
+ - No LabNFT minting
45
+ - Placeholder BioPIL DAO integration
46
+ - Manual serial number assignment
47
+
48
+ **After (v2.2.0):**
49
+ - Registers via unified `/register_lab` API
50
+ - Automatic LabNFT minting
51
+ - Stores in `labs` collection
52
+ - Blockchain-verified serial numbers
53
+
54
+ ### MongoDB Schema Changes
55
+
56
+ **Old Collections (Deprecated):**
57
+ - `lab_wallets` - Replaced by `labs`
58
+ - Manual permittee tracking
59
+
60
+ **New Collection:**
61
+ - `labs` - Unified lab registry with LabNFT integration
62
+
63
+ **Migration:** All existing labs have been migrated to the new system with LabNFTs minted.
64
+
65
+ ## 🚀 API Integration
66
+
67
+ ### New API Endpoint
68
+
69
+ **`POST /register_lab`**
70
+ - URL: `https://genobank.app/register_lab`
71
+ - Generates custodial wallets or accepts user wallets
72
+ - Mints LabNFTs automatically
73
+ - Returns complete registration details including private keys (custodial only)
74
+
75
+ ### Updated Commands
76
+
77
+ ```bash
78
+ # Register with custodial wallet
79
+ biofs admin register-lab https://novogene.com --yes
80
+
81
+ # Register with custom details
82
+ biofs admin register-lab https://example.edu \
83
+ --name "Example Genomics Lab" \
84
+ --email contact@example.edu \
85
+ --specialization "cancer genomics" \
86
+ --location "Boston, MA" \
87
+ --lab-type RESEARCHER
88
+
89
+ # Verify lab registration
90
+ biofs admin verify-lab 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
91
+ ```
92
+
93
+ ## 📋 Smart Contract Details
94
+
95
+ **LabNFT Contract:**
96
+ - Address: `0x24f42752F491540e305384A5C947911649C910CF`
97
+ - Network: Sequentia L1
98
+ - Chain ID: `15132025`
99
+ - RPC: `http://52.90.163.112:8545`
100
+
101
+ **Features:**
102
+ - ERC-721 compliant
103
+ - GDPR consent management (Article 17)
104
+ - Four access levels
105
+ - GA4GH compliance tracking
106
+ - Lab verification status
107
+ - Active/inactive toggle
108
+
109
+ ## 🔐 Security Enhancements
110
+
111
+ ### GDPR Compliance
112
+
113
+ - **Biodata consent hash:** Stored on-chain as bytes32
114
+ - **Commercial consent hash:** Separate tracking
115
+ - **Right to erasure:** Supported via ConsentManager
116
+
117
+ ### Access Control
118
+
119
+ **Access Levels:**
120
+ - Level 0: Research Only
121
+ - Level 1: Clinical Non-Critical
122
+ - Level 2: Clinical Critical
123
+ - Level 3: Commercial
124
+
125
+ **GA4GH Compliance:**
126
+ - Level 0: None
127
+ - Level 1: Basic
128
+ - Level 2: Lite
129
+ - Level 3: Full
130
+
131
+ ### Wallet Security
132
+
133
+ - **Custodial wallets:** Private keys encrypted in MongoDB
134
+ - **Claiming workflow:** Labs can claim via email verification
135
+ - **EIP-55 checksumming:** All addresses validated
136
+
137
+ ## 📊 Migration Statistics
138
+
139
+ **Completed Migration:**
140
+ - Total labs: 63
141
+ - Labs with LabNFTs: 63 (100%)
142
+ - Custodial wallets: 28
143
+ - User-provided wallets: 35
144
+ - LabNFT serials: #1 - #61
145
+
146
+ ## 🐛 Bug Fixes
147
+
148
+ ### Fixed Issues
149
+
150
+ 1. **Duplicate Collections**
151
+ - Consolidated `lab_wallets`, `permittees`, and `researchers` into single `labs` collection
152
+ - Fixed inconsistent wallet tracking
153
+
154
+ 2. **Missing LabNFT Verification**
155
+ - All labs now have LabNFTs minted
156
+ - Blockchain verification enabled
157
+
158
+ 3. **Inconsistent Lab Types**
159
+ - Standardized to LAB, RESEARCHER, INSTITUTION enum
160
+
161
+ ## 📖 Documentation
162
+
163
+ ### New Documentation Files
164
+
165
+ 1. **`LABNFT_BIOFS_INTEGRATION.md`**
166
+ - Complete integration guide
167
+ - API usage examples
168
+ - Testing procedures
169
+ - Migration summary
170
+
171
+ 2. **`ADMIN_REGISTER_LAB.md`** (Updated)
172
+ - Updated to reflect v2.0 unified API approach
173
+ - New CLI command examples
174
+ - MongoDB schema documentation
175
+
176
+ ## 🔄 Dependencies
177
+
178
+ ### Updated Packages
179
+
180
+ - `ethers`: ^6.9.0 (LabNFT integration)
181
+ - `axios`: ^1.6.0 (API calls)
182
+ - `@types/node`: ^20.0.0
183
+
184
+ ### New Environment Variables Required
185
+
186
+ ```bash
187
+ # LabNFT Contract (Sequentia)
188
+ SEQUENTIA_RPC_URL=http://52.90.163.112:8545
189
+ SEQUENTIA_CHAIN_ID=15132025
190
+ SEQUENTIA_EXECUTOR_KEY=0xfaa...
191
+
192
+ # GenoBank API
193
+ GENOBANK_API_URL=https://genobank.app
194
+ ADMIN_SIGNATURE=0xa51...
195
+ ```
196
+
197
+ ## 🚧 Known Issues
198
+
199
+ ### Limitations
200
+
201
+ 1. **File Sharing Verification**
202
+ - LabNFT verification not yet enforced in `share_file()` endpoint
203
+ - Planned for v2.3.0
204
+
205
+ 2. **Lab Claiming Workflow**
206
+ - Email verification for custodial wallets not implemented
207
+ - Planned for v2.3.0
208
+
209
+ 3. **Admin Dashboard Integration**
210
+ - LabNFT viewing in admin dashboard pending
211
+ - Planned for v2.3.0
212
+
213
+ ## 🎯 Roadmap
214
+
215
+ ### v2.3.0 (Planned)
216
+
217
+ 1. **File Sharing Integration**
218
+ - Enforce LabNFT verification in file sharing
219
+ - Add access level checks
220
+ - Implement GA4GH compliance validation
221
+
222
+ 2. **Lab Claiming Workflow**
223
+ - Email verification system
224
+ - Wallet claiming via dashboard
225
+ - Private key secure transfer
226
+
227
+ 3. **Enhanced CLI Commands**
228
+ - `biofs lab list` - List all registered labs
229
+ - `biofs lab update` - Update lab information
230
+ - `biofs lab deactivate` - Deactivate lab
231
+
232
+ 4. **Admin Dashboard**
233
+ - View all LabNFTs
234
+ - Approve/verify labs
235
+ - Monitor activity
236
+
237
+ ## 🧪 Testing
238
+
239
+ ### Test Commands
240
+
241
+ ```bash
242
+ # Build CLI
243
+ cd /home/ubuntu/biofs-cli
244
+ npm run build
245
+
246
+ # Test lab registration
247
+ biofs admin register-lab https://novogene.com --yes
248
+
249
+ # Test verification
250
+ biofs admin verify-lab <wallet_address>
251
+
252
+ # Test API endpoint
253
+ curl -X POST https://genobank.app/register_lab \
254
+ -H "Content-Type: application/json" \
255
+ -d '{"name": "Test Lab", "lab_type": "LAB", "mint_nft": true}'
256
+ ```
257
+
258
+ ### MongoDB Verification
259
+
260
+ ```bash
261
+ # Check labs collection
262
+ mongosh "mongodb+srv://..." --eval "db.labs.countDocuments()"
263
+
264
+ # Check LabNFT registrations
265
+ mongosh "mongodb+srv://..." --eval "db.labs.countDocuments({'sequentia.registered': true})"
266
+
267
+ # Find lab by wallet
268
+ mongosh "mongodb+srv://..." --eval "db.labs.findOne({owner_wallet: '<wallet>'})"
269
+ ```
270
+
271
+ ## 👥 Contributors
272
+
273
+ - GenoBank.io Development Team
274
+ - Claude AI (Development Assistant)
275
+
276
+ ## 📝 License
277
+
278
+ GenoBank.io - Proprietary
279
+
280
+ ---
281
+
282
+ **For complete integration details, see `LABNFT_BIOFS_INTEGRATION.md`**
283
+
284
+ **Support:** support@genobank.io | https://github.com/Genobank/biofs-cli