@genobank/biofs 2.5.0 → 2.5.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.
- package/CHANGELOG.md +2 -0
- package/LICENSE +37 -0
- package/README.md +2 -1
- package/bin/biofs.js +2 -1
- package/contracts/ClaraJobNFT.sol +2 -0
- package/dist/commands/link-clara.d.ts.map +1 -1
- package/dist/commands/link-clara.js +9 -3
- package/dist/commands/link-clara.js.map +1 -1
- package/dist/commands/tokenize-biosample.d.ts.map +1 -1
- package/dist/commands/tokenize-biosample.js +9 -3
- package/dist/commands/tokenize-biosample.js.map +1 -1
- package/dist/index.js +1 -1
- package/docs/AI_AGENT_MCP_MANUAL.md +2 -0
- package/docs/USER_MANUAL.md +2 -0
- package/docs/technical-details.html +555 -0
- package/lib/bionfs-client.js +2 -0
- package/lib/consent-manager.js +2 -0
- package/lib/consent-prompt.js +2 -0
- package/package.json +3 -3
- package/presentation/biofs-x402-kite-presentation.html +2 -0
- package/scripts/build_annotator_dictionary.py +1 -0
- package/scripts/deploy-clara-nft.js +2 -0
- package/test-complete-flow.sh +1 -1
- package/test.vcf +1 -0
- package/test_23andme.txt +1 -0
- package/ADMIN_REGISTER_LAB.md +0 -252
- package/ANNOTATOR_RECOMMENDATIONS_API.md +0 -490
- package/BIOFS_QUICK_START.md +0 -200
- package/BIOFS_TOKENIZE_COMPLETE.md +0 -541
- package/BIOFS_V1.2.7_PUBLISHED.md +0 -317
- package/BIOFS_V1.2.9_FIXES.md +0 -306
- package/BIOFS_V1.3.0_DIRECT_GRANT.md +0 -381
- package/BIOFS_V1.3.1_GRANTED_FILES.md +0 -328
- package/BIONFS_DEPLOYMENT_GUIDE.md +0 -408
- package/BIONFS_MOUNT_INTEGRATION_PLAN.md +0 -415
- package/BIONFS_PROTOCOL_SPECIFICATION.md +0 -688
- package/BIONFS_SEQUENTIAS_INTEGRATION.md +0 -457
- package/BIONFT_NFS_PROTOCOL_ARCHITECTURE.md +0 -583
- package/BIOOS_CLI_IMPLEMENTATION_COMPLETE.md +0 -422
- package/BIOOS_JOB_MANAGEMENT.md +0 -681
- package/BUGFIX_V2.1.3.md +0 -72
- package/CHANGELOG_V2.1.0.md +0 -386
- package/CHANGELOG_V2.2.0.md +0 -284
- package/ENHANCEMENT_DOCUMENTATION.md +0 -218
- package/GDPR_BIONFS_CONSENT_ARCHITECTURE.md +0 -798
- package/GDPR_BIONFS_IMPLEMENTATION_STATUS.md +0 -462
- package/INSTALL_V1.2.7_ON_MAC.md +0 -306
- package/LABNFT_BIOFS_INTEGRATION.md +0 -396
- package/OPENCRAVAT_ANNOTATORS_REFERENCE.md +0 -340
- package/OPENCRAVAT_ANNOTATOR_INTELLIGENCE_COMPLETE.md +0 -479
- package/QUICK_START_V2.1.0.md +0 -116
- package/RELEASE_SUMMARY_V1.2.7.md +0 -479
- package/RELEASE_SUMMARY_V1.3.0.md +0 -324
- package/SEQUENTIAS_PROTOCOL_ARCHITECTURE.md +0 -880
- package/SEQUENTIA_MIGRATION_GUIDE.md +0 -337
- package/SESSION_SUMMARY_DIRECT_GRANT.md +0 -321
- package/ULTRATHINK_BIONFS_COMPLETE.md +0 -458
- package/WEB3FUSE_LICENSE_TOKEN_ANALYSIS.md +0 -494
- package/WHERE_PERMISSIONS_LIVE.md +0 -165
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +0 -63
- package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.json +0 -328
- package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +0 -357
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +0 -296
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.json +0 -45
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.json +0 -373
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.json +0 -341
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +0 -30
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +0 -30
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +0 -10
- package/artifacts/build-info/1adfbc50ae3e1821260f858a9c689a37.json +0 -1
- package/artifacts/contracts/ClaraJobNFT.sol/ClaraJobNFT.dbg.json +0 -4
- package/artifacts/contracts/ClaraJobNFT.sol/ClaraJobNFT.json +0 -667
- package/cache/solidity-files-cache.json +0 -628
- package/check_clara2.js +0 -70
- package/check_clara3.js +0 -65
- package/config.json +0 -21
- package/hardhat.config.js +0 -25
- package/jest.config.js +0 -27
- package/mint_and_link_all.js +0 -128
- package/opencravat_annotators_dictionary.json +0 -2356
- package/package.json.working.v1.9.2.20251105_023952 +0 -48
- package/test_v2_mint.js +0 -101
|
@@ -1,494 +0,0 @@
|
|
|
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
|
|
@@ -1,165 +0,0 @@
|
|
|
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
|