@genobank/biofs 2.5.0 → 2.5.2
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/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-complete-flow.sh +0 -60
- package/test.vcf +0 -12
- package/test_23andme.txt +0 -12
- package/test_v2_mint.js +0 -101
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
# BioFS v1.3.0 - Direct Grant Feature
|
|
2
|
-
|
|
3
|
-
## ✅ Successfully Published to npm
|
|
4
|
-
|
|
5
|
-
**Package**: `@genobank/biofs@1.3.0`
|
|
6
|
-
**Published**: October 7, 2025
|
|
7
|
-
**npm URL**: https://www.npmjs.com/package/@genobank/biofs
|
|
8
|
-
|
|
9
|
-
## Major New Feature: Direct Grant Access Control
|
|
10
|
-
|
|
11
|
-
### Problem Solved
|
|
12
|
-
|
|
13
|
-
Previously, BioFS access control only supported one flow:
|
|
14
|
-
1. Researcher **requests** access → `biofs access request <ip_id>`
|
|
15
|
-
2. Owner **approves** request → `biofs access grant <ip_id> <wallet>`
|
|
16
|
-
|
|
17
|
-
This required researchers to know about the asset and proactively request access.
|
|
18
|
-
|
|
19
|
-
### What's New in v1.3.0
|
|
20
|
-
|
|
21
|
-
**Two Access Grant Flows Now Supported:**
|
|
22
|
-
|
|
23
|
-
#### 1. Direct Grant (NEW) - Owner-Initiated
|
|
24
|
-
Owner can proactively grant access to researchers **WITHOUT** requiring them to request access first.
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
# Owner grants access directly (no request needed)
|
|
28
|
-
biofs access grant <ip_id> <researcher_wallet>
|
|
29
|
-
|
|
30
|
-
# Example:
|
|
31
|
-
biofs access grant 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
32
|
-
|
|
33
|
-
# Output:
|
|
34
|
-
══════════════════════════════════════════════════════════════════
|
|
35
|
-
License Token Grant Confirmation (GDPR Consent)
|
|
36
|
-
══════════════════════════════════════════════════════════════════
|
|
37
|
-
Grant Type: Direct Grant (owner-initiated)
|
|
38
|
-
IP Asset ID: 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
|
|
39
|
-
Granted To: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
40
|
-
License Type: Non-Commercial (GDPR Research Consent)
|
|
41
|
-
License Token ID: 40249
|
|
42
|
-
Blockchain TX: 0x...
|
|
43
|
-
══════════════════════════════════════════════════════════════════
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
#### 2. Request-Based Grant (Existing) - Researcher-Initiated
|
|
47
|
-
Traditional flow where researcher requests, then owner approves.
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Researcher requests access
|
|
51
|
-
biofs access request <ip_id>
|
|
52
|
-
|
|
53
|
-
# Owner approves request
|
|
54
|
-
biofs access grant <ip_id> <researcher_wallet>
|
|
55
|
-
|
|
56
|
-
# Output:
|
|
57
|
-
══════════════════════════════════════════════════════════════════
|
|
58
|
-
License Token Grant Confirmation (GDPR Consent)
|
|
59
|
-
══════════════════════════════════════════════════════════════════
|
|
60
|
-
Grant Type: Request-Based (researcher-requested)
|
|
61
|
-
IP Asset ID: 0x...
|
|
62
|
-
Granted To: 0x...
|
|
63
|
-
License Type: Non-Commercial (GDPR Research Consent)
|
|
64
|
-
══════════════════════════════════════════════════════════════════
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### How It Works
|
|
68
|
-
|
|
69
|
-
The CLI now uses a **smart fallback mechanism**:
|
|
70
|
-
|
|
71
|
-
1. **Tries Direct Grant First**: Attempts to grant access directly (no request needed)
|
|
72
|
-
2. **Falls Back to Request-Based**: If direct grant fails, looks for pending request
|
|
73
|
-
3. **Clear Error Messages**: Tells you exactly what's needed if both fail
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
// From src/commands/access/grant.ts
|
|
77
|
-
try {
|
|
78
|
-
// Try direct grant first
|
|
79
|
-
result = await api.directGrantLicenseToken(ipId, walletAddress, licenseType);
|
|
80
|
-
grantType = 'direct';
|
|
81
|
-
} catch (directGrantError) {
|
|
82
|
-
// Fall back to request-based grant
|
|
83
|
-
const requests = await api.getPendingLicenseRequests(ipId);
|
|
84
|
-
const pendingRequest = requests.find(r =>
|
|
85
|
-
r.requester?.toLowerCase() === walletAddress.toLowerCase()
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
if (!pendingRequest) {
|
|
89
|
-
throw new Error('No pending license token request found for this wallet address. The researcher must request access first, or you can use the direct grant flow.');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
result = await api.grantLicenseToken(pendingRequest._id, walletAddress);
|
|
93
|
-
grantType = 'request-based';
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### API Changes
|
|
98
|
-
|
|
99
|
-
#### New API Client Method
|
|
100
|
-
|
|
101
|
-
Added `directGrantLicenseToken()` to `/src/lib/api/client.ts`:
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
async directGrantLicenseToken(
|
|
105
|
-
ipId: string,
|
|
106
|
-
receiverWallet: string,
|
|
107
|
-
licenseType: string = 'non-commercial'
|
|
108
|
-
): Promise<any> {
|
|
109
|
-
const signature = await this.getSignature();
|
|
110
|
-
const response = await this.axios.post('/api_bioip/direct_grant_license_token', {
|
|
111
|
-
user_signature: signature,
|
|
112
|
-
ip_id: ipId,
|
|
113
|
-
receiver_wallet: receiverWallet,
|
|
114
|
-
license_type: licenseType
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
if (response.data.status === 'Success') {
|
|
118
|
-
return response.data.status_details?.data || response.data;
|
|
119
|
-
}
|
|
120
|
-
throw new Error(response.data.status_details?.message || 'Direct grant failed');
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### New Backend Endpoint
|
|
125
|
-
|
|
126
|
-
Added `direct_grant_license_token()` to `/production_api/plugins/bioip/api_bioip.py`:
|
|
127
|
-
|
|
128
|
-
```python
|
|
129
|
-
@cherrypy.expose
|
|
130
|
-
@cherrypy.tools.CORS()
|
|
131
|
-
@cherrypy.tools.allow(methods=["POST"])
|
|
132
|
-
@cherrypy.tools.json_in()
|
|
133
|
-
@cherrypy.tools.json_out()
|
|
134
|
-
def direct_grant_license_token(
|
|
135
|
-
self,
|
|
136
|
-
user_signature=None,
|
|
137
|
-
ip_id=None,
|
|
138
|
-
receiver_wallet=None,
|
|
139
|
-
license_type="non-commercial"
|
|
140
|
-
):
|
|
141
|
-
"""
|
|
142
|
-
DIRECT GRANT: Mint a license token without requiring a request first
|
|
143
|
-
|
|
144
|
-
Allows the IP owner to proactively grant access to researchers
|
|
145
|
-
without waiting for them to request access first.
|
|
146
|
-
"""
|
|
147
|
-
# Verify ownership
|
|
148
|
-
owner_wallet = self.signature_service.recover_from_signature(user_signature, ...)
|
|
149
|
-
bioip = self.bioip_service.fetch_one({"ip_id": ip_id})
|
|
150
|
-
|
|
151
|
-
if asset_owner.lower() != owner_wallet.lower():
|
|
152
|
-
return self.create_response("Failure", {
|
|
153
|
-
'message': 'Unauthorized',
|
|
154
|
-
'description': 'Only the IP asset owner can grant access'
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
# Check for existing token
|
|
158
|
-
existing_token = license_tokens_collection.find_one({
|
|
159
|
-
"ip_id": ip_id,
|
|
160
|
-
"receiver": receiver_wallet,
|
|
161
|
-
"status": {"$ne": "revoked"}
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
if existing_token:
|
|
165
|
-
return self.create_response("Failure", {
|
|
166
|
-
'message': 'Already Has Access',
|
|
167
|
-
'description': f'Wallet already has an active license token'
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
# Mint license token on blockchain
|
|
171
|
-
license_token_result = self.story_protocol_manager.mint_license_token(
|
|
172
|
-
ip_id=ip_id,
|
|
173
|
-
license_terms_id=int(license_terms_id),
|
|
174
|
-
receiver=receiver_wallet,
|
|
175
|
-
amount=1
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
# Save to MongoDB with grant_type='direct'
|
|
179
|
-
license_token_data = {
|
|
180
|
-
"ip_id": ip_id,
|
|
181
|
-
"sender": owner_wallet,
|
|
182
|
-
"receiver": receiver_wallet,
|
|
183
|
-
"license_token_id": license_token_result["startLicenseTokenId"],
|
|
184
|
-
"tx_hash": license_token_result["tx_hash"],
|
|
185
|
-
"status": "active",
|
|
186
|
-
"grant_type": "direct", # Mark as direct grant
|
|
187
|
-
"created_at": datetime.datetime.now()
|
|
188
|
-
}
|
|
189
|
-
self.license_token_service.create(license_token_data)
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## Use Cases
|
|
193
|
-
|
|
194
|
-
### Use Case 1: Collaborative Research
|
|
195
|
-
**Scenario**: PI wants to share genomic data with collaborators
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
# PI grants access to 3 collaborators without requiring requests
|
|
199
|
-
biofs access grant 0xMyDataset 0xCollaborator1
|
|
200
|
-
biofs access grant 0xMyDataset 0xCollaborator2
|
|
201
|
-
biofs access grant 0xMyDataset 0xCollaborator3
|
|
202
|
-
|
|
203
|
-
# All 3 can immediately download
|
|
204
|
-
biofs download 0xMyDataset ./my-analysis/
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Use Case 2: Data Sharing Workshop
|
|
208
|
-
**Scenario**: Instructor wants to share teaching datasets with students
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
# Instructor shares dataset with 20 students
|
|
212
|
-
for wallet in $(cat student_wallets.txt); do
|
|
213
|
-
biofs access grant 0xTeachingDataset $wallet
|
|
214
|
-
done
|
|
215
|
-
|
|
216
|
-
# Students can immediately access data
|
|
217
|
-
biofs files # Shows shared dataset
|
|
218
|
-
biofs download 0xTeachingDataset ./course-materials/
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Use Case 3: Consortium Data Sharing
|
|
222
|
-
**Scenario**: Consortium lead shares aggregated data with all members
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
# Consortium lead grants access to all member institutions
|
|
226
|
-
biofs access grant 0xConsortiumData 0xInstitution1
|
|
227
|
-
biofs access grant 0xConsortiumData 0xInstitution2
|
|
228
|
-
# ... (continues for all members)
|
|
229
|
-
|
|
230
|
-
# Members can access immediately without requesting
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Use Case 4: Traditional Request Flow Still Supported
|
|
234
|
-
**Scenario**: Researcher discovers public dataset and requests access
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
# Researcher requests access
|
|
238
|
-
biofs access request 0xPublicDataset
|
|
239
|
-
|
|
240
|
-
# Owner approves (uses same grant command)
|
|
241
|
-
biofs access grant 0xPublicDataset 0xResearcher
|
|
242
|
-
|
|
243
|
-
# Output shows: "Grant Type: Request-Based (researcher-requested)"
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Installation & Update
|
|
247
|
-
|
|
248
|
-
### Install New Version
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
# Uninstall old version
|
|
252
|
-
npm uninstall -g @genobank/biofs
|
|
253
|
-
|
|
254
|
-
# Install v1.3.0
|
|
255
|
-
npm install -g @genobank/biofs@1.3.0
|
|
256
|
-
|
|
257
|
-
# Verify
|
|
258
|
-
biofs --version # Should show: 1.3.0
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Update from v1.2.9
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
npm update -g @genobank/biofs
|
|
265
|
-
biofs --version # Should show: 1.3.0
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## Testing the Feature
|
|
269
|
-
|
|
270
|
-
### Test Direct Grant
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# 1. Authenticate as owner
|
|
274
|
-
biofs login
|
|
275
|
-
|
|
276
|
-
# 2. List your BioIP assets
|
|
277
|
-
biofs files
|
|
278
|
-
|
|
279
|
-
# 3. Grant access to a wallet directly
|
|
280
|
-
biofs access grant <ip_id> <researcher_wallet>
|
|
281
|
-
|
|
282
|
-
# 4. Verify grant
|
|
283
|
-
biofs access list <ip_id>
|
|
284
|
-
# Should show the granted wallet with status: active
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Test Researcher Access
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# 1. Authenticate as researcher
|
|
291
|
-
biofs login
|
|
292
|
-
|
|
293
|
-
# 2. List accessible files
|
|
294
|
-
biofs files
|
|
295
|
-
# Should show granted dataset
|
|
296
|
-
|
|
297
|
-
# 3. Download granted file
|
|
298
|
-
biofs download <ip_id> ./destination/
|
|
299
|
-
# Should download successfully
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Files Modified
|
|
303
|
-
|
|
304
|
-
### CLI Changes
|
|
305
|
-
|
|
306
|
-
1. **`src/lib/api/client.ts`** - Added `directGrantLicenseToken()` method
|
|
307
|
-
2. **`src/commands/access/grant.ts`** - Updated to try direct grant first, fall back to request-based
|
|
308
|
-
3. **`package.json`** - Version bumped to 1.3.0
|
|
309
|
-
|
|
310
|
-
### Backend Changes
|
|
311
|
-
|
|
312
|
-
1. **`plugins/bioip/api_bioip.py`** - Added `direct_grant_license_token()` endpoint
|
|
313
|
-
2. **`plugins/bioip/libs/dao/license_tokens_dao.py`** - Supports `grant_type` field
|
|
314
|
-
3. **`plugins/bioip/libs/service/license_token_service.py`** - Handles direct grants
|
|
315
|
-
|
|
316
|
-
## MongoDB Changes
|
|
317
|
-
|
|
318
|
-
### New Field: `grant_type`
|
|
319
|
-
|
|
320
|
-
License tokens now include `grant_type` to distinguish flows:
|
|
321
|
-
|
|
322
|
-
```json
|
|
323
|
-
{
|
|
324
|
-
"_id": ObjectId("..."),
|
|
325
|
-
"ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
|
|
326
|
-
"sender": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
|
|
327
|
-
"receiver": "0xb3c3a584491b8ca4df45116a1e250098a0d6192d",
|
|
328
|
-
"license_token_id": 40249,
|
|
329
|
-
"tx_hash": "0x...",
|
|
330
|
-
"status": "active",
|
|
331
|
-
"grant_type": "direct", // NEW: "direct" or "request-based"
|
|
332
|
-
"created_at": ISODate("2025-10-07T01:15:00Z")
|
|
333
|
-
}
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## Security & GDPR Compliance
|
|
337
|
-
|
|
338
|
-
### Access Control Unchanged
|
|
339
|
-
|
|
340
|
-
- **Ownership Verification**: Only IP asset owner can grant access (both flows)
|
|
341
|
-
- **Blockchain Enforcement**: All grants minted as Story Protocol license tokens
|
|
342
|
-
- **Revocation Supported**: `biofs access revoke <ip_id> <wallet>` works for both flows
|
|
343
|
-
|
|
344
|
-
### GDPR Rights Preserved
|
|
345
|
-
|
|
346
|
-
- **Right to Erasure**: Revoke license token = revoke data access (both flows)
|
|
347
|
-
- **Consent Management**: License tokens = GDPR consent mechanism
|
|
348
|
-
- **Audit Trail**: MongoDB records all grants with timestamps and grant_type
|
|
349
|
-
|
|
350
|
-
## Backward Compatibility
|
|
351
|
-
|
|
352
|
-
✅ **Fully Backward Compatible**
|
|
353
|
-
|
|
354
|
-
- Existing request-based flow works unchanged
|
|
355
|
-
- Old CLI versions still work (just don't have direct grant)
|
|
356
|
-
- MongoDB queries unchanged (grant_type is optional field)
|
|
357
|
-
- API endpoints are additive (no breaking changes)
|
|
358
|
-
|
|
359
|
-
## Breaking Changes
|
|
360
|
-
|
|
361
|
-
**None**. This is a purely additive feature.
|
|
362
|
-
|
|
363
|
-
## Version History
|
|
364
|
-
|
|
365
|
-
- **v1.3.0** (Oct 7, 2025): Added direct grant access control
|
|
366
|
-
- **v1.2.9** (Oct 7, 2025): Fixed ESM warnings, added verbose mode
|
|
367
|
-
- **v1.2.8** (Oct 7, 2025): Version banner fix
|
|
368
|
-
- **v1.2.7** (Oct 7, 2025): Added annotator intelligence
|
|
369
|
-
- **v1.2.6** (Oct 5, 2025): Added BioOS job management
|
|
370
|
-
|
|
371
|
-
## Support
|
|
372
|
-
|
|
373
|
-
- **npm Package**: https://www.npmjs.com/package/@genobank/biofs
|
|
374
|
-
- **GitHub**: https://github.com/Genobank/genobank-cli
|
|
375
|
-
- **Support**: support@genobank.io
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
**Version**: 1.3.0
|
|
380
|
-
**Status**: ✅ Published and ready for use
|
|
381
|
-
**Key Feature**: Direct Grant - Owner can proactively share data without requiring requests
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
# BioFS v1.3.1 - Granted Files Feature
|
|
2
|
-
|
|
3
|
-
## ✅ Successfully Published to npm
|
|
4
|
-
|
|
5
|
-
**Package**: `@genobank/biofs@1.3.1`
|
|
6
|
-
**Published**: October 7, 2025
|
|
7
|
-
**npm URL**: https://www.npmjs.com/package/@genobank/biofs
|
|
8
|
-
|
|
9
|
-
## What's New in v1.3.1
|
|
10
|
-
|
|
11
|
-
### 1. ✅ Granted Files Discovery
|
|
12
|
-
|
|
13
|
-
**`biofs files` now shows files you've been granted access to via license tokens, not just files you own!**
|
|
14
|
-
|
|
15
|
-
Previously, `biofs files` only showed:
|
|
16
|
-
- Files you uploaded
|
|
17
|
-
- Files you own
|
|
18
|
-
|
|
19
|
-
Now it also shows:
|
|
20
|
-
- Files other users have granted you access to (marked with 🔑)
|
|
21
|
-
|
|
22
|
-
### 2. ✅ Fixed ESM Warning from inquirer
|
|
23
|
-
|
|
24
|
-
Downgraded `inquirer` from v9.2.0 (ESM-only) to v8.2.6 (CommonJS) to eliminate experimental warnings.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
### Update to v1.3.1
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# Uninstall old version
|
|
32
|
-
npm uninstall -g @genobank/biofs
|
|
33
|
-
|
|
34
|
-
# Install v1.3.1
|
|
35
|
-
npm install -g @genobank/biofs@1.3.1
|
|
36
|
-
|
|
37
|
-
# Verify version
|
|
38
|
-
biofs --version # Should show: 1.3.1
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Testing the Granted Files Feature
|
|
42
|
-
|
|
43
|
-
### For Dra. Claudia (Researcher)
|
|
44
|
-
|
|
45
|
-
You've been granted access to a VCF file from the server! Here's how to see and use it:
|
|
46
|
-
|
|
47
|
-
#### Step 1: Update to v1.3.1
|
|
48
|
-
```bash
|
|
49
|
-
npm install -g @genobank/biofs@1.3.1
|
|
50
|
-
biofs --version # Should show: 1.3.1
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### Step 2: Authenticate
|
|
54
|
-
```bash
|
|
55
|
-
biofs login
|
|
56
|
-
# Use your wallet: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
#### Step 3: List Files (with verbose mode)
|
|
60
|
-
```bash
|
|
61
|
-
biofs files --verbose
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Expected Output:**
|
|
65
|
-
```
|
|
66
|
-
🔍 Fetching S3 files...
|
|
67
|
-
✅ Found 0 S3 files
|
|
68
|
-
🔍 Fetching Story Protocol IP assets...
|
|
69
|
-
✅ Found 0 IP assets
|
|
70
|
-
🔍 Fetching BioIP files...
|
|
71
|
-
✅ Found 0 BioIP files
|
|
72
|
-
🔍 Fetching granted BioIP files...
|
|
73
|
-
✅ Found 1 granted BioIP files ← NEW! Files granted to you
|
|
74
|
-
🔍 Fetching VCF files...
|
|
75
|
-
✅ Found 0 VCF files
|
|
76
|
-
|
|
77
|
-
📊 Total files discovered: 1
|
|
78
|
-
|
|
79
|
-
📁 Your BioFiles (1 file)
|
|
80
|
-
|
|
81
|
-
VCF Files (1):
|
|
82
|
-
╭──────────────────────────────────────────────────────────────────────────────╮
|
|
83
|
-
│ │
|
|
84
|
-
│ BioCID: biocid://0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a/bioip/... │
|
|
85
|
-
│ Filename: 55052008714000.deepvariant.vcf 🔑 ← 🔑 indicates granted │
|
|
86
|
-
│ Type: VCF │
|
|
87
|
-
│ Source: IPFS │
|
|
88
|
-
│ Owner: 0x5f5a...Ed19a │
|
|
89
|
-
│ License: non-commercial │
|
|
90
|
-
│ IP Asset: 0xCCe1...59f7 │
|
|
91
|
-
│ │
|
|
92
|
-
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### Step 4: Download the Granted File
|
|
96
|
-
```bash
|
|
97
|
-
# Download by IP Asset ID
|
|
98
|
-
biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 ./my-analysis/
|
|
99
|
-
|
|
100
|
-
# Or download by filename
|
|
101
|
-
biofs download "55052008714000.deepvariant.vcf" ./my-analysis/
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Expected Output:**
|
|
105
|
-
```
|
|
106
|
-
✓ File downloaded successfully to ./my-analysis/55052008714000.deepvariant.vcf
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
#### Step 5: Verify Access Control
|
|
110
|
-
```bash
|
|
111
|
-
# Check your access status
|
|
112
|
-
biofs access list --mine
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Expected Output:**
|
|
116
|
-
```
|
|
117
|
-
✓ Assets with license tokens: 1
|
|
118
|
-
|
|
119
|
-
┌─────────────────────────────────────────────┬─────────────────────┬────────────────────┬────────┐
|
|
120
|
-
│ IP Asset ID │ Owner │ License Type │ Status │
|
|
121
|
-
├─────────────────────────────────────────────┼─────────────────────┼────────────────────┼────────┤
|
|
122
|
-
│ 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 │ 0x5f5a...Ed19a │ GDPR Research │ Active │
|
|
123
|
-
└─────────────────────────────────────────────┴─────────────────────┴────────────────────┴────────┘
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## What's Happening Behind the Scenes
|
|
127
|
-
|
|
128
|
-
### New Backend Endpoint
|
|
129
|
-
|
|
130
|
-
**GET** `/api_bioip/get_my_granted_bioips?user_signature={sig}`
|
|
131
|
-
|
|
132
|
-
Returns all BioIP assets where the user has been granted license tokens:
|
|
133
|
-
|
|
134
|
-
```json
|
|
135
|
-
{
|
|
136
|
-
"status": "Success",
|
|
137
|
-
"status_details": {
|
|
138
|
-
"granted_bioips": [
|
|
139
|
-
{
|
|
140
|
-
"ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
|
|
141
|
-
"filename": "55052008714000.deepvariant.vcf",
|
|
142
|
-
"file_category": "vcf",
|
|
143
|
-
"s3_path": "users/0x5f5a.../bioip/.../55052008714000.deepvariant.vcf",
|
|
144
|
-
"ipfs_hash": "QmNyGTuhS7TkJojvZ2N1RVgqt9rGG7hpWSMWc8SbiDhnow",
|
|
145
|
-
"owner": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
|
|
146
|
-
"license_token_id": 40249,
|
|
147
|
-
"license_type": "non-commercial",
|
|
148
|
-
"granted_at": "2025-10-07T01:16:14Z",
|
|
149
|
-
"grant_type": "direct"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"count": 1
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### File Discovery Flow
|
|
158
|
-
|
|
159
|
-
The `biofs files` command now fetches from **5 sources**:
|
|
160
|
-
|
|
161
|
-
1. **S3 files** (owned by user)
|
|
162
|
-
2. **Story Protocol IP assets** (owned by user)
|
|
163
|
-
3. **BioIP files** (owned by user)
|
|
164
|
-
4. **Granted BioIP files** (license tokens) ← **NEW!**
|
|
165
|
-
5. **VCF files** (owned by user)
|
|
166
|
-
|
|
167
|
-
### Granted File Indicators
|
|
168
|
-
|
|
169
|
-
Files granted via license tokens are marked with:
|
|
170
|
-
- **🔑 emoji** in filename
|
|
171
|
-
- **`granted: true`** in metadata
|
|
172
|
-
- **`owner`** field shows who granted access
|
|
173
|
-
- **`license_type`** shows the license terms
|
|
174
|
-
|
|
175
|
-
## Use Cases
|
|
176
|
-
|
|
177
|
-
### 1. Collaborative Research
|
|
178
|
-
Researcher receives direct grant from PI:
|
|
179
|
-
```bash
|
|
180
|
-
# PI grants access
|
|
181
|
-
biofs access grant 0xMyDataset 0xResearcher
|
|
182
|
-
|
|
183
|
-
# Researcher sees file immediately
|
|
184
|
-
biofs files
|
|
185
|
-
# Shows: my-dataset.vcf 🔑
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### 2. Data Sharing
|
|
189
|
-
Data owner shares with multiple researchers:
|
|
190
|
-
```bash
|
|
191
|
-
# Owner grants to 3 researchers
|
|
192
|
-
biofs access grant 0xDataset 0xResearcher1
|
|
193
|
-
biofs access grant 0xDataset 0xResearcher2
|
|
194
|
-
biofs access grant 0xDataset 0xResearcher3
|
|
195
|
-
|
|
196
|
-
# All 3 can now see and download
|
|
197
|
-
biofs files # Each sees: dataset.vcf 🔑
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### 3. Teaching & Workshops
|
|
201
|
-
Instructor shares teaching data with students:
|
|
202
|
-
```bash
|
|
203
|
-
# Instructor grants to all students
|
|
204
|
-
for wallet in $(cat students.txt); do
|
|
205
|
-
biofs access grant 0xTeachingData $wallet
|
|
206
|
-
done
|
|
207
|
-
|
|
208
|
-
# Students see teaching data
|
|
209
|
-
biofs files
|
|
210
|
-
# Shows: teaching-dataset.vcf 🔑
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Technical Details
|
|
214
|
-
|
|
215
|
-
### New CLI Methods
|
|
216
|
-
|
|
217
|
-
**`src/lib/api/client.ts`**:
|
|
218
|
-
```typescript
|
|
219
|
-
async getMyGrantedBioIPs(): Promise<any[]> {
|
|
220
|
-
try {
|
|
221
|
-
const signature = await this.getSignature();
|
|
222
|
-
const response = await this.axios.get('/api_bioip/get_my_granted_bioips', {
|
|
223
|
-
params: { user_signature: signature }
|
|
224
|
-
});
|
|
225
|
-
return response.data.status_details?.granted_bioips || [];
|
|
226
|
-
} catch (error) {
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**`src/lib/biofiles/resolver.ts`**:
|
|
233
|
-
```typescript
|
|
234
|
-
// Get BioIP files (granted access via license tokens)
|
|
235
|
-
if (verbose) console.log('🔍 Fetching granted BioIP files...');
|
|
236
|
-
const grantedBioips = await this.api.getMyGrantedBioIPs();
|
|
237
|
-
if (verbose) console.log(`✅ Found ${grantedBioips.length} granted BioIP files`);
|
|
238
|
-
|
|
239
|
-
for (const bioip of grantedBioips) {
|
|
240
|
-
if (bioip.s3_path || bioip.ipfs_hash) {
|
|
241
|
-
bioFiles.push({
|
|
242
|
-
filename: (bioip.filename || 'Granted BioIP') + ' 🔑',
|
|
243
|
-
biocid: `biocid://${bioip.owner}/bioip/${bioip.ip_id}`,
|
|
244
|
-
type: bioip.file_category || 'bioip',
|
|
245
|
-
source: bioip.ipfs_hash ? 'IPFS' : 'S3',
|
|
246
|
-
created_at: bioip.granted_at,
|
|
247
|
-
s3_path: bioip.s3_path,
|
|
248
|
-
ipfs_hash: bioip.ipfs_hash,
|
|
249
|
-
ip_asset: bioip.ip_id,
|
|
250
|
-
granted: true,
|
|
251
|
-
owner: bioip.owner,
|
|
252
|
-
license_type: bioip.license_type
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Updated Type Definitions
|
|
259
|
-
|
|
260
|
-
**`src/types/biofiles.ts`**:
|
|
261
|
-
```typescript
|
|
262
|
-
export interface BioFile {
|
|
263
|
-
filename: string;
|
|
264
|
-
biocid: string;
|
|
265
|
-
type: string;
|
|
266
|
-
size?: number;
|
|
267
|
-
source: 'S3' | 'IPFS' | 'Story';
|
|
268
|
-
created_at?: string;
|
|
269
|
-
ip_asset?: string;
|
|
270
|
-
s3_path?: string;
|
|
271
|
-
ipfs_hash?: string;
|
|
272
|
-
presigned_url?: string;
|
|
273
|
-
granted?: boolean; // NEW: True if access granted via license token
|
|
274
|
-
owner?: string; // NEW: Owner wallet (for granted files)
|
|
275
|
-
license_type?: string; // NEW: License type (for granted files)
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## Fixes in v1.3.1
|
|
280
|
-
|
|
281
|
-
### 1. ESM Warning Fixed ✅
|
|
282
|
-
- Downgraded `inquirer`: ^9.2.0 → ^8.2.6 (CommonJS)
|
|
283
|
-
- No more experimental warnings!
|
|
284
|
-
|
|
285
|
-
### 2. Granted Files Query Fixed ✅
|
|
286
|
-
- Case-insensitive wallet matching
|
|
287
|
-
- Supports old tokens without `status` field
|
|
288
|
-
- Uses regex query: `$regex: "^{wallet}$", $options: "i"`
|
|
289
|
-
|
|
290
|
-
### 3. License Token Storage Fixed ✅
|
|
291
|
-
- Direct MongoDB insert preserves all fields
|
|
292
|
-
- Includes: `status`, `grant_type`, `license_type`, `created_at`
|
|
293
|
-
- Old service method was dropping fields
|
|
294
|
-
|
|
295
|
-
## Testing Checklist for Dra. Claudia
|
|
296
|
-
|
|
297
|
-
- [ ] Update to v1.3.1: `npm install -g @genobank/biofs@1.3.1`
|
|
298
|
-
- [ ] Verify version: `biofs --version` shows 1.3.1
|
|
299
|
-
- [ ] No ESM warnings when running commands
|
|
300
|
-
- [ ] Login with your wallet: `biofs login`
|
|
301
|
-
- [ ] List files with verbose: `biofs files --verbose`
|
|
302
|
-
- [ ] See granted file with 🔑: `55052008714000.deepvariant.vcf 🔑`
|
|
303
|
-
- [ ] Download granted file: `biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 ./test/`
|
|
304
|
-
- [ ] Check access: `biofs access list --mine`
|
|
305
|
-
|
|
306
|
-
## Known Issues & Solutions
|
|
307
|
-
|
|
308
|
-
### Issue: "No granted files" but token exists
|
|
309
|
-
**Solution**: The backend query is case-insensitive and supports old tokens without `status` field. The fix is deployed.
|
|
310
|
-
|
|
311
|
-
### Issue: ESM warning from inquirer
|
|
312
|
-
**Solution**: Fixed in v1.3.1 by downgrading to inquirer v8.2.6.
|
|
313
|
-
|
|
314
|
-
### Issue: Can't download granted file
|
|
315
|
-
**Solution**: Make sure you're authenticated with the correct wallet that received the grant.
|
|
316
|
-
|
|
317
|
-
## Support
|
|
318
|
-
|
|
319
|
-
- **npm Package**: https://www.npmjs.com/package/@genobank/biofs
|
|
320
|
-
- **GitHub**: https://github.com/Genobank/genobank-cli
|
|
321
|
-
- **Support**: support@genobank.io
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
**Version**: 1.3.1
|
|
326
|
-
**Status**: ✅ Published and ready for testing
|
|
327
|
-
**Key Feature**: Granted Files Discovery - See files others have shared with you
|
|
328
|
-
**Fixes**: ESM warnings eliminated, license token storage fixed
|