@genobank/biofs 1.3.4 → 1.4.1

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.
Files changed (42) hide show
  1. package/BIONFS_DEPLOYMENT_GUIDE.md +408 -0
  2. package/BIONFS_MOUNT_INTEGRATION_PLAN.md +415 -0
  3. package/BIONFS_PROTOCOL_SPECIFICATION.md +688 -0
  4. package/BIONFS_SEQUENTIAS_INTEGRATION.md +457 -0
  5. package/BIONFT_NFS_PROTOCOL_ARCHITECTURE.md +583 -0
  6. package/GDPR_BIONFS_CONSENT_ARCHITECTURE.md +798 -0
  7. package/GDPR_BIONFS_IMPLEMENTATION_STATUS.md +462 -0
  8. package/SEQUENTIAS_PROTOCOL_ARCHITECTURE.md +880 -0
  9. package/ULTRATHINK_BIONFS_COMPLETE.md +458 -0
  10. package/WEB3FUSE_LICENSE_TOKEN_ANALYSIS.md +494 -0
  11. package/WHERE_PERMISSIONS_LIVE.md +165 -0
  12. package/dist/commands/access/revoke-consent.d.ts +13 -0
  13. package/dist/commands/access/revoke-consent.d.ts.map +1 -0
  14. package/dist/commands/access/revoke-consent.js +171 -0
  15. package/dist/commands/access/revoke-consent.js.map +1 -0
  16. package/dist/commands/download-with-consent.d.ts +12 -0
  17. package/dist/commands/download-with-consent.d.ts.map +1 -0
  18. package/dist/commands/download-with-consent.js +126 -0
  19. package/dist/commands/download-with-consent.js.map +1 -0
  20. package/dist/commands/mount.d.ts +11 -0
  21. package/dist/commands/mount.d.ts.map +1 -0
  22. package/dist/commands/mount.js +179 -0
  23. package/dist/commands/mount.js.map +1 -0
  24. package/dist/index.js +46 -10
  25. package/dist/index.js.map +1 -1
  26. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  27. package/dist/lib/biofiles/resolver.js +6 -1
  28. package/dist/lib/biofiles/resolver.js.map +1 -1
  29. package/dist/lib/consent/consent-manager.d.ts +34 -0
  30. package/dist/lib/consent/consent-manager.d.ts.map +1 -0
  31. package/dist/lib/consent/consent-manager.js +96 -0
  32. package/dist/lib/consent/consent-manager.js.map +1 -0
  33. package/dist/lib/consent/consent-prompt.d.ts +27 -0
  34. package/dist/lib/consent/consent-prompt.d.ts.map +1 -0
  35. package/dist/lib/consent/consent-prompt.js +118 -0
  36. package/dist/lib/consent/consent-prompt.js.map +1 -0
  37. package/dist/types/biofiles.d.ts +3 -0
  38. package/dist/types/biofiles.d.ts.map +1 -1
  39. package/lib/bionfs-client.js +125 -0
  40. package/lib/consent-manager.js +88 -0
  41. package/lib/consent-prompt.js +118 -0
  42. package/package.json +2 -2
@@ -0,0 +1,494 @@
1
+ # 🔬 Can Dra. Claudia Mount Granted Files? Deep Technical Analysis
2
+
3
+ ## 🎯 Executive Summary
4
+
5
+ **SHORT ANSWER**: ❌ Not with current web3fuse implementation
6
+ **REASON**: web3fuse supports NFT ownership, NOT Story Protocol License Tokens
7
+ **TIME TO FIX**: 1 week for full implementation
8
+
9
+ ---
10
+
11
+ ## 📊 Current Capabilities vs Requirements
12
+
13
+ ### What Dra. Claudia Has ✅
14
+
15
+ ```json
16
+ {
17
+ "license_token_id": 40205,
18
+ "ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
19
+ "receiver": "0xb3c3a584491b8ca4df45116a1e250098a0d6192d",
20
+ "s3_path": "users/0x5f5a.../bioip/.../55052008714000.deepvariant.vcf",
21
+ "status": "active",
22
+ "grant_type": "direct"
23
+ }
24
+ ```
25
+
26
+ **What this means:**
27
+ - ✅ Has **permission** to access file (License Token on blockchain)
28
+ - ✅ Backend API **knows** the S3 path (MongoDB)
29
+ - ✅ Can **prove** permission via blockchain verification
30
+ - ❌ But this is NOT the same as **owning** the NFT
31
+
32
+ ### What web3fuse Currently Supports ✅
33
+
34
+ From `/home/ubuntu/web3fuse/README.md`:
35
+
36
+ **SUPPORTED:**
37
+ ```c
38
+ // Direct NFT ownership (ERC721/ERC1155)
39
+ biocid://v1/avalanche/0x19A6.../41221040804049
40
+
41
+ Flow:
42
+ 1. Parse BioCID → extract collection + tokenId
43
+ 2. Query blockchain: ownerOf(tokenId) == user_wallet?
44
+ 3. If YES → read NFT metadata → extract S3 path
45
+ 4. Mount file via FUSE
46
+ ```
47
+
48
+ **NOT SUPPORTED:**
49
+ ```c
50
+ // License Token access (Story Protocol PIL)
51
+ // User owns license token, but NOT the file NFT
52
+ // Need different verification logic
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 🚨 CRITICAL ARCHITECTURAL MISMATCH
58
+
59
+ ### Problem #1: NFT Ownership ≠ License Token Ownership
60
+
61
+ **Traditional NFT (web3fuse supports):**
62
+ ```solidity
63
+ // User OWNS the NFT = User OWNS the file
64
+ ERC721.ownerOf(tokenId) == user_wallet
65
+ ```
66
+
67
+ **Story Protocol License Token (web3fuse does NOT support):**
68
+ ```solidity
69
+ // User OWNS license token, but file is OWNED by someone else
70
+ LicenseToken.ownerOf(40205) == claudia_wallet // ✅ True
71
+ IPAsset.owner(0xCCe1...) == ceo_wallet // ✅ True (NOT Claudia!)
72
+
73
+ // Claudia has PERMISSION, not OWNERSHIP
74
+ ```
75
+
76
+ ### Problem #2: S3 Paths NOT on Blockchain
77
+
78
+ **web3fuse assumes:**
79
+ ```json
80
+ // NFT metadata on IPFS contains S3 path
81
+ {
82
+ "name": "Genomic Data",
83
+ "image": "ipfs://...",
84
+ "properties": {
85
+ "storage": "s3://bucket/path/file.vcf" ← web3fuse expects this
86
+ }
87
+ }
88
+ ```
89
+
90
+ **BioIP reality:**
91
+ ```json
92
+ // IPFS metadata (QmNyGTuhS7TkJojvZ2N1RVgqt9rGG7hpWSMWc8SbiDhnow)
93
+ {
94
+ "name": "DeepVariant Analysis",
95
+ "image": "ipfs://Qmctc6PAZ...",
96
+ "attributes": [
97
+ {"trait_type": "File Type", "value": "vcf"},
98
+ {"trait_type": "File Hash", "value": "22aef1e2d5d16ee..."}
99
+ ]
100
+ // ❌ NO S3 PATH!
101
+ }
102
+
103
+ // S3 path stored in MongoDB (NOT on blockchain)
104
+ db.bioip_registry.findOne({ip_id: "0xCCe1..."})
105
+ // ✅ Returns: {s3_path: "users/0x5f5a.../55052008714000.deepvariant.vcf"}
106
+ ```
107
+
108
+ **Why this breaks web3fuse's "blockchain-only" design:**
109
+ - web3fuse philosophy: "Zero Hardcoded Credentials - All storage credentials resolved from blockchain metadata"
110
+ - BioIP reality: S3 paths stored in **MongoDB**, not blockchain metadata
111
+ - Result: web3fuse can't resolve file locations without MongoDB access
112
+
113
+ ---
114
+
115
+ ## 🔍 What's Missing? Component-by-Component Analysis
116
+
117
+ ### ❌ Component 1: License Token Verifier
118
+
119
+ **Need to add:**
120
+ ```c
121
+ // license_token_verifier.c
122
+ int verify_license_token_ownership(
123
+ const char *license_token_id,
124
+ const char *user_wallet,
125
+ char *ip_id_out // Output: which IP asset this grants access to
126
+ );
127
+ ```
128
+
129
+ **Current status:** Does NOT exist in web3fuse
130
+ **Estimated work:** 2 days
131
+
132
+ ### ❌ Component 2: BioIP API Client
133
+
134
+ **Need to add:**
135
+ ```c
136
+ // bioip_api_client.c
137
+ int bioip_get_s3_path(
138
+ const char *ip_id,
139
+ const char *user_signature,
140
+ char *s3_path_out,
141
+ char *presigned_url_out
142
+ );
143
+ ```
144
+
145
+ **Why needed:** S3 paths not in blockchain metadata
146
+ **Alternative:** Put S3 paths on-chain (expensive, slow)
147
+ **Current status:** Does NOT exist in web3fuse
148
+ **Estimated work:** 1 day
149
+
150
+ ### ❌ Component 3: BioCID Format for Granted Access
151
+
152
+ **Current BioCID spec:**
153
+ ```
154
+ biocid://v1/<chain>/<collection>/<tokenId>
155
+ ```
156
+
157
+ **Needed for License Tokens:**
158
+ ```
159
+ Option A: biocid://v1/story/license-token/40205
160
+ → Resolve license → Get IP asset → Get S3 path
161
+
162
+ Option B: biocid://v1/story/ip-asset/0xCCe1...?license=40205
163
+ → Verify license → Access IP asset
164
+
165
+ Option C: biocid://v1/story/granted/0xCCe1...
166
+ → Check if user has any active license for this IP
167
+ ```
168
+
169
+ **Current status:** Spec doesn't handle this
170
+ **Estimated work:** 1 day (design + implementation)
171
+
172
+ ### ✅ Component 4: FUSE Filesystem Integration
173
+
174
+ **Current status:** EXISTS in web3fuse
175
+ **Works for:** Direct NFT ownership
176
+ **Needs update:** Accept license token URIs
177
+
178
+ ---
179
+
180
+ ## 📋 Implementation Roadmap
181
+
182
+ ### Phase 1: Quick Fix (1 hour) - Download Only
183
+ **Add to BioFS CLI:**
184
+ ```bash
185
+ biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
186
+ # Downloads file using API presigned URL
187
+ # No mounting, just direct download
188
+ ```
189
+
190
+ **Changes needed:**
191
+ 1. Update `download.ts` to handle IP Asset IDs
192
+ 2. Call `/api_bioip/get_bioip_download_url` endpoint
193
+ 3. Download file from presigned URL
194
+
195
+ **User experience:**
196
+ ```bash
197
+ $ biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
198
+ ⠋ Verifying access permissions...
199
+ ✅ Access granted via License Token #40205
200
+ ⠙ Downloading 55052008714000.deepvariant.vcf (145 MB)...
201
+ ✅ Downloaded to ./55052008714000.deepvariant.vcf
202
+ ```
203
+
204
+ ---
205
+
206
+ ### Phase 2: Local Mount (1 day) - CLI-Based FUSE
207
+ **Add to BioFS CLI:**
208
+ ```bash
209
+ biofs mount ~/granted-files
210
+ # Mounts all granted files to local directory
211
+ ```
212
+
213
+ **Implementation:**
214
+ ```typescript
215
+ // New command: src/commands/mount.ts
216
+ import { fusejs } from 'fusejs'; // FUSE bindings for Node.js
217
+
218
+ async function mountCommand(mountPoint: string) {
219
+ // 1. Discover all granted files
220
+ const grantedFiles = await api.getMyGrantedBioIPs();
221
+
222
+ // 2. Create virtual filesystem
223
+ const fs = new FUSEFilesystem(mountPoint);
224
+
225
+ // 3. For each file, create lazy-loading file descriptor
226
+ for (const file of grantedFiles) {
227
+ fs.addFile(file.filename, async () => {
228
+ const url = await api.getBioIPDownloadURL(file.ip_id);
229
+ return axios.get(url, {responseType: 'stream'});
230
+ });
231
+ }
232
+
233
+ // 4. Mount filesystem
234
+ fs.mount();
235
+ console.log(`✅ Mounted ${grantedFiles.length} files to ${mountPoint}`);
236
+ }
237
+ ```
238
+
239
+ **User experience:**
240
+ ```bash
241
+ $ biofs mount ~/genomics
242
+ ✅ Mounted 2 files to /Users/claudia/genomics
243
+
244
+ $ ls ~/genomics/
245
+ 55052008714000.deepvariant.vcf
246
+
247
+ $ head ~/genomics/55052008714000.deepvariant.vcf
248
+ ##fileformat=VCFv4.2
249
+ ##FILTER=<ID=PASS,Description="All filters passed">
250
+ ...
251
+ ```
252
+
253
+ **Advantages:**
254
+ - ✅ Works with current BioIP API
255
+ - ✅ No web3fuse modifications needed
256
+ - ✅ Handles MongoDB S3 paths correctly
257
+ - ✅ Fast implementation
258
+
259
+ **Limitations:**
260
+ - ⚠️ Requires BioFS CLI running
261
+ - ⚠️ Not pure blockchain verification (uses API)
262
+ - ⚠️ Needs Node.js FUSE bindings
263
+
264
+ ---
265
+
266
+ ### Phase 3: web3fuse Integration (1 week) - Full Implementation
267
+ **Extend web3fuse with Story Protocol support:**
268
+
269
+ #### Step 1: Add License Token Support
270
+ ```c
271
+ // src/license_token_verifier.c
272
+
273
+ #include "rpc_client.h"
274
+ #include "license_token_verifier.h"
275
+
276
+ int verify_license_token(
277
+ rpc_client_t *client,
278
+ const char *license_token_id,
279
+ const char *user_wallet,
280
+ license_info_t *license_out
281
+ ) {
282
+ // 1. Query LicenseToken contract on Story Protocol
283
+ char calldata[256];
284
+ sprintf(calldata, "0x6352211e%064s", // ownerOf(uint256)
285
+ license_token_id);
286
+
287
+ rpc_response_t response = rpc_eth_call(
288
+ client,
289
+ "0x1234...", // LicenseToken contract address
290
+ calldata,
291
+ "latest"
292
+ );
293
+
294
+ if (!response.success) return -1;
295
+
296
+ // 2. Verify ownership
297
+ char owner[43];
298
+ parse_address_from_response(response.result, owner);
299
+
300
+ if (strcasecmp(owner, user_wallet) != 0) {
301
+ return 0; // Not the owner
302
+ }
303
+
304
+ // 3. Get IP Asset linked to this license
305
+ sprintf(calldata, "0xabcd1234%064s", // getIPAsset(uint256)
306
+ license_token_id);
307
+
308
+ response = rpc_eth_call(client, "0x1234...", calldata, "latest");
309
+ parse_address_from_response(response.result, license_out->ip_id);
310
+
311
+ license_out->license_token_id = strdup(license_token_id);
312
+ license_out->owner = strdup(user_wallet);
313
+
314
+ return 1; // Verified
315
+ }
316
+ ```
317
+
318
+ #### Step 2: Add BioIP API Client
319
+ ```c
320
+ // src/bioip_api_client.c
321
+
322
+ #include <curl/curl.h>
323
+ #include <jansson.h>
324
+
325
+ int bioip_get_download_url(
326
+ const char *ip_id,
327
+ const char *user_signature,
328
+ char *presigned_url_out
329
+ ) {
330
+ CURL *curl = curl_easy_init();
331
+
332
+ // Build API URL
333
+ char url[512];
334
+ snprintf(url, sizeof(url),
335
+ "https://genobank.app/api_bioip/get_bioip_download_url"
336
+ "?ip_id=%s&user_signature=%s",
337
+ ip_id, user_signature);
338
+
339
+ // Make HTTP request
340
+ struct curl_response response = {0};
341
+ curl_easy_setopt(curl, CURLOPT_URL, url);
342
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
343
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
344
+
345
+ CURLcode res = curl_easy_perform(curl);
346
+ curl_easy_cleanup(curl);
347
+
348
+ if (res != CURLE_OK) return -1;
349
+
350
+ // Parse JSON response
351
+ json_error_t error;
352
+ json_t *root = json_loads(response.data, 0, &error);
353
+
354
+ json_t *presigned_url = json_object_get(
355
+ json_object_get(root, "status_details"),
356
+ "presigned_url"
357
+ );
358
+
359
+ if (presigned_url) {
360
+ strncpy(presigned_url_out,
361
+ json_string_value(presigned_url),
362
+ 512);
363
+ json_decref(root);
364
+ return 0;
365
+ }
366
+
367
+ json_decref(root);
368
+ return -1;
369
+ }
370
+ ```
371
+
372
+ #### Step 3: Update BioCID Parser
373
+ ```c
374
+ // Update src/biocid_parser.c to handle new format
375
+
376
+ int biocid_parse(const char *uri, biocid_t *biocid) {
377
+ // Parse: biocid://v1/story/granted/0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
378
+
379
+ if (strncmp(uri, "biocid://v1/story/granted/", 27) == 0) {
380
+ biocid->type = BIOCID_TYPE_GRANTED;
381
+ biocid->chain = "story";
382
+ biocid->ip_id = strdup(uri + 27); // Extract IP ID
383
+ return 0;
384
+ }
385
+
386
+ // ... existing NFT ownership parsing ...
387
+ }
388
+ ```
389
+
390
+ #### Step 4: Integration
391
+ ```c
392
+ // Main FUSE handler
393
+
394
+ static int biofs_open(const char *path, struct fuse_file_info *fi) {
395
+ // 1. Parse BioCID from path
396
+ biocid_t biocid;
397
+ biocid_parse(path, &biocid);
398
+
399
+ if (biocid.type == BIOCID_TYPE_GRANTED) {
400
+ // 2. Verify user has license token for this IP
401
+ license_info_t license;
402
+ if (!verify_user_has_license(biocid.ip_id, user_wallet, &license)) {
403
+ return -EACCES; // Permission denied
404
+ }
405
+
406
+ // 3. Get presigned URL from BioIP API
407
+ char presigned_url[512];
408
+ if (bioip_get_download_url(biocid.ip_id, user_signature, presigned_url) != 0) {
409
+ return -EIO; // I/O error
410
+ }
411
+
412
+ // 4. Open S3 stream
413
+ fi->fh = (uint64_t)s3_open_stream(presigned_url);
414
+ return 0;
415
+ }
416
+
417
+ // ... existing NFT ownership flow ...
418
+ }
419
+ ```
420
+
421
+ **Estimated timeline:**
422
+ - License Token Verifier: 2 days
423
+ - BioIP API Client: 1 day
424
+ - BioCID Parser updates: 1 day
425
+ - FUSE integration: 2 days
426
+ - Testing: 1 day
427
+ - **Total: 1 week**
428
+
429
+ ---
430
+
431
+ ## 🎯 Recommended Path Forward
432
+
433
+ ### Immediate (TODAY):
434
+ ```bash
435
+ # Implement biofs download for granted files
436
+ biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
437
+ ```
438
+ **Benefit:** Dra. Claudia can access files TODAY
439
+ **Effort:** 1 hour
440
+
441
+ ### Short-term (THIS WEEK):
442
+ ```bash
443
+ # Implement biofs mount (Node.js FUSE)
444
+ biofs mount ~/genomics
445
+ ```
446
+ **Benefit:** Dra. Claudia can mount files like a drive
447
+ **Effort:** 1 day
448
+
449
+ ### Long-term (NEXT WEEK):
450
+ ```bash
451
+ # Extend web3fuse with Story Protocol support
452
+ export USER_SIGNATURE="0x526dde..."
453
+ web3fuse --mount ~/genomics \
454
+ --uri "biocid://v1/story/granted/0xCCe1..."
455
+ ```
456
+ **Benefit:** Pure blockchain verification, no API dependency
457
+ **Effort:** 1 week
458
+
459
+ ---
460
+
461
+ ## ✅ Components Status
462
+
463
+ | Component | Status | ETA | Blocker |
464
+ |-----------|--------|-----|---------|
465
+ | **BioFS CLI download** | ❌ Not implemented | 1 hour | None |
466
+ | **BioFS CLI mount** | ❌ Not implemented | 1 day | FUSE Node.js bindings |
467
+ | **web3fuse License Token** | ❌ Not implemented | 2 days | Contract ABIs |
468
+ | **web3fuse BioIP API** | ❌ Not implemented | 1 day | API documentation |
469
+ | **web3fuse BioCID parser** | ⚠️ Partial | 1 day | Spec update |
470
+ | **web3fuse FUSE integration** | ✅ Exists | N/A | None |
471
+
472
+ ---
473
+
474
+ ## 💡 ANSWER TO YOUR QUESTION
475
+
476
+ **"Could Dra. Claudia mount these files via our code? Possible now? Components missing?"**
477
+
478
+ **CURRENT STATE:**
479
+ - ❌ Cannot mount with web3fuse (License Token support missing)
480
+ - ❌ Cannot mount with BioFS CLI (mount command doesn't exist)
481
+ - ✅ CAN discover files with `biofs files` (works now!)
482
+ - ✅ CAN download with implementation of `biofs download` (1 hour work)
483
+
484
+ **COMPONENTS MISSING:**
485
+ 1. ❌ License Token verification in web3fuse
486
+ 2. ❌ BioIP API client in web3fuse (S3 paths not on blockchain)
487
+ 3. ❌ BioCID spec for granted access
488
+ 4. ❌ `biofs mount` command in CLI
489
+
490
+ **FASTEST PATH:**
491
+ Implement `biofs download` → 1 hour → Dra. Claudia can access files today!
492
+
493
+ **COMPLETE PATH:**
494
+ Implement all components → 1 week → Full FUSE mounting capability
@@ -0,0 +1,165 @@
1
+ # 🔐 Where BioIP License Permissions Live
2
+
3
+ ## TL;DR: Hybrid Storage (Blockchain + Database)
4
+
5
+ Your **2 granted BioIP permissions** for Dra. Claudia exist in **BOTH** locations:
6
+
7
+ ### 1. ✅ **On Story Protocol Blockchain** (Immutable, Verifiable)
8
+ - **License Token #40205**: https://aeneid.storyscan.io/tx/0x23c86b4741a8e0db765ae2a064c9781071e677a5820a272c98afa5d641255be4
9
+ - **License Token #40249**: https://aeneid.storyscan.io/tx/0x90c59317ec4756a7d668cd52d63a7d4e850ef1e5193b2393c39d678292c7ff97
10
+
11
+ ### 2. ✅ **In MongoDB Database** (Fast Query, Rich Metadata)
12
+ - **Collection**: `license_tokens`
13
+ - **Database**: `genobank-api` (MongoDB Atlas)
14
+ - **Records**: 2 documents for `receiver: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d`
15
+
16
+ ---
17
+
18
+ ## 📋 License Token #1 (Request-Based)
19
+
20
+ ### On-Chain (Story Protocol Testnet)
21
+ ```
22
+ License Token ID: 40205
23
+ Transaction Hash: 0x23c86b4741a8e0db765ae2a064c9781071e677a5820a272c98afa5d641255be4
24
+ IP Asset: 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
25
+ Receiver: 0xB3C3a584491B8ca4DF45116A1e250098a0D6192D (Dra. Claudia)
26
+ Sender: 0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a (CEO)
27
+ License Terms ID: 1 (Non-Commercial)
28
+ ```
29
+
30
+ ### In MongoDB
31
+ ```json
32
+ {
33
+ "license_token_id": 40205,
34
+ "ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
35
+ "receiver": "0xB3C3a584491B8ca4DF45116A1e250098a0D6192D",
36
+ "sender": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
37
+ "license_type": "non-commercial",
38
+ "grant_type": "request-based",
39
+ "status": "active",
40
+ "tx_hash": "23c86b4741a8e0db765ae2a064c9781071e677a5820a272c98afa5d641255be4",
41
+ "created_at": "2025-10-05T05:34:00Z"
42
+ }
43
+ ```
44
+
45
+ **Flow**: Dra. Claudia **requested** access → CEO **approved** → License minted on-chain
46
+
47
+ ---
48
+
49
+ ## 📋 License Token #2 (Direct Grant)
50
+
51
+ ### On-Chain (Story Protocol Testnet)
52
+ ```
53
+ License Token ID: 40249
54
+ Transaction Hash: 0x90c59317ec4756a7d668cd52d63a7d4e850ef1e5193b2393c39d678292c7ff97
55
+ IP Asset: 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
56
+ Receiver: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d (Dra. Claudia)
57
+ Sender: 0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a (CEO)
58
+ License Terms ID: 1 (Non-Commercial)
59
+ ```
60
+
61
+ ### In MongoDB
62
+ ```json
63
+ {
64
+ "license_token_id": 40249,
65
+ "ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
66
+ "receiver": "0xb3c3a584491b8ca4df45116a1e250098a0d6192d",
67
+ "sender": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
68
+ "license_type": "non-commercial",
69
+ "grant_type": "direct",
70
+ "status": "active",
71
+ "tx_hash": "90c59317ec4756a7d668cd52d63a7d4e850ef1e5193b2393c39d678292c7ff97",
72
+ "created_at": "2025-10-07T01:16:14Z"
73
+ }
74
+ ```
75
+
76
+ **Flow**: CEO **directly granted** access → License minted on-chain (no request needed)
77
+
78
+ ---
79
+
80
+ ## 🏗️ Architecture: Why Hybrid Storage?
81
+
82
+ ### Blockchain (Story Protocol) = Source of Truth
83
+ - ✅ **Immutable**: Cannot be deleted or modified
84
+ - ✅ **Verifiable**: Anyone can verify on StoryScan
85
+ - ✅ **Decentralized**: No single point of failure
86
+ - ✅ **GDPR Consent**: License token = proof of permission
87
+
88
+ ### MongoDB = Performance Layer
89
+ - ✅ **Fast Queries**: Instant lookup by wallet/IP/status
90
+ - ✅ **Rich Metadata**: grant_type, license_type, timestamps
91
+ - ✅ **Filtering**: Find all active/revoked/expired tokens
92
+ - ✅ **Analytics**: Track usage patterns
93
+
94
+ ---
95
+
96
+ ## 🔍 How BioFS CLI Discovers Granted Files
97
+
98
+ ```typescript
99
+ // 1. Query MongoDB for active license tokens
100
+ const tokens = await db.license_tokens.find({
101
+ receiver: userWallet,
102
+ status: "active"
103
+ });
104
+
105
+ // 2. For each token, fetch BioIP details from registry
106
+ for (const token of tokens) {
107
+ const bioip = await db.bioip_registry.findOne({
108
+ ip_id: token.ip_id
109
+ });
110
+
111
+ // 3. User can now download from BioNFT-Gated S3
112
+ const presignedUrl = await s3.getSignedUrl({
113
+ bucket: "test.vault.genoverse.io",
114
+ key: bioip.s3_path
115
+ });
116
+ }
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 📂 File Storage vs Permission Storage
122
+
123
+ ### ❌ VCF File is NOT on IPFS!
124
+ ```
125
+ S3 Path: users/0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a/bioip/3931d9ff.../55052008714000.deepvariant.vcf
126
+ Location: BioNFT-Gated S3 (test.vault.genoverse.io)
127
+ Access: Requires license token (blockchain proof)
128
+ GDPR: Supports "right to erasure" (can delete from S3)
129
+ ```
130
+
131
+ ### ✅ Only NFT Metadata on IPFS
132
+ ```
133
+ IPFS Hash: QmNyGTuhS7TkJojvZ2N1RVgqt9rGG7hpWSMWc8SbiDhnow
134
+ Content: {"name": "DeepVariant Analysis", "description": "...", "image": "..."}
135
+ Purpose: NFT card display (thumbnail, title, description)
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🎯 Summary
141
+
142
+ **Your 2 granted permissions live in:**
143
+
144
+ 1. **Story Protocol Blockchain** (Chain ID 1514 - Testnet)
145
+ - Token #40205: Request-based grant (Oct 5, 2025)
146
+ - Token #40249: Direct grant (Oct 7, 2025)
147
+ - Both minted with non-commercial PIL terms
148
+ - Both currently active (not revoked)
149
+
150
+ 2. **MongoDB Atlas** (`genobank-api` database)
151
+ - Collection: `license_tokens`
152
+ - Indexed by: receiver, ip_id, status
153
+ - Used for fast permission checks
154
+
155
+ 3. **BioFS CLI** queries MongoDB → verifies on blockchain → grants S3 access
156
+
157
+ **The VCF file itself?** Safely stored in BioNFT-Gated S3, NOT on IPFS! 🧬
158
+
159
+ ---
160
+
161
+ ## 🔗 Verification Links
162
+
163
+ - **IP Asset**: https://aeneid.storyscan.io/ipa/0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
164
+ - **Token #40205 TX**: https://aeneid.storyscan.io/tx/0x23c86b4741a8e0db765ae2a064c9781071e677a5820a272c98afa5d641255be4
165
+ - **Token #40249 TX**: https://aeneid.storyscan.io/tx/0x90c59317ec4756a7d668cd52d63a7d4e850ef1e5193b2393c39d678292c7ff97
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Revoke Consent Command - GDPR Right to Withdraw Consent (User Side)
3
+ * Allows users to revoke their own consent for accessing genomic data
4
+ *
5
+ * NOTE: This is different from revoking license tokens (which owners do)
6
+ * This is for users to withdraw their own consent for data access
7
+ */
8
+ export interface RevokeConsentOptions {
9
+ all?: boolean;
10
+ force?: boolean;
11
+ }
12
+ export declare function revokeConsentCommand(ipId?: string, options?: RevokeConsentOptions): Promise<void>;
13
+ //# sourceMappingURL=revoke-consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revoke-consent.d.ts","sourceRoot":"","sources":["../../../src/commands/access/revoke-consent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,oBAAoB,CACxC,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAkKf"}