@genobank/biofs 1.3.0 → 1.3.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/BIOFS_V1.3.1_GRANTED_FILES.md +328 -0
- package/RELEASE_SUMMARY_V1.3.0.md +324 -0
- package/SESSION_SUMMARY_DIRECT_GRANT.md +321 -0
- package/debug_credentials.js +60 -0
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +91 -8
- package/dist/commands/whoami.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/api/client.d.ts +1 -0
- package/dist/lib/api/client.d.ts.map +1 -1
- package/dist/lib/api/client.js +13 -0
- package/dist/lib/api/client.js.map +1 -1
- package/dist/lib/biofiles/resolver.d.ts.map +1 -1
- package/dist/lib/biofiles/resolver.js +24 -1
- package/dist/lib/biofiles/resolver.js.map +1 -1
- package/dist/types/biofiles.d.ts +3 -0
- package/dist/types/biofiles.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,328 @@
|
|
|
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
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# BioFS v1.3.0 Release Summary
|
|
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
|
+
**Package Size**: 167.3 kB (unpacked: 763.9 kB)
|
|
9
|
+
|
|
10
|
+
## Major Feature: Direct Grant Access Control
|
|
11
|
+
|
|
12
|
+
### What Changed
|
|
13
|
+
|
|
14
|
+
**NEW**: IP asset owners can now grant access to researchers **directly** without requiring them to request access first.
|
|
15
|
+
|
|
16
|
+
### Both Access Flows Now Supported
|
|
17
|
+
|
|
18
|
+
#### 1. Direct Grant (NEW) ✨
|
|
19
|
+
```bash
|
|
20
|
+
# Owner grants access directly (no request needed)
|
|
21
|
+
biofs access grant <ip_id> <researcher_wallet>
|
|
22
|
+
|
|
23
|
+
# Example:
|
|
24
|
+
biofs access grant 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
25
|
+
|
|
26
|
+
# Output shows:
|
|
27
|
+
Grant Type: Direct Grant (owner-initiated)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### 2. Request-Based Grant (Existing)
|
|
31
|
+
```bash
|
|
32
|
+
# Researcher requests access
|
|
33
|
+
biofs access request <ip_id>
|
|
34
|
+
|
|
35
|
+
# Owner approves
|
|
36
|
+
biofs access grant <ip_id> <researcher_wallet>
|
|
37
|
+
|
|
38
|
+
# Output shows:
|
|
39
|
+
Grant Type: Request-Based (researcher-requested)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Smart Fallback Mechanism
|
|
43
|
+
|
|
44
|
+
The CLI automatically tries the best flow:
|
|
45
|
+
1. **Tries direct grant first** (no request needed)
|
|
46
|
+
2. **Falls back to request-based** if request exists
|
|
47
|
+
3. **Clear error messages** if both fail
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### New Install
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g @genobank/biofs@1.3.0
|
|
54
|
+
biofs --version # Should show: 1.3.0
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Update from Previous Version
|
|
58
|
+
```bash
|
|
59
|
+
npm update -g @genobank/biofs
|
|
60
|
+
biofs --version # Should show: 1.3.0
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Testing the Feature
|
|
64
|
+
|
|
65
|
+
### Live Test Results ✅
|
|
66
|
+
|
|
67
|
+
Successfully tested on production server:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# 1. Listed server's BioIP files
|
|
71
|
+
./bin/biofs.js files --json
|
|
72
|
+
# Found: 17 BioIP files owned by 0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a
|
|
73
|
+
|
|
74
|
+
# 2. Granted direct access to Dra. Claudia
|
|
75
|
+
./bin/biofs.js access grant 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
76
|
+
|
|
77
|
+
# Result:
|
|
78
|
+
══════════════════════════════════════════════════════════════════
|
|
79
|
+
License Token Grant Confirmation (GDPR Consent)
|
|
80
|
+
══════════════════════════════════════════════════════════════════
|
|
81
|
+
Grant Type: Direct Grant (owner-initiated)
|
|
82
|
+
IP Asset ID: 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
|
|
83
|
+
Granted To: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
84
|
+
License Type: Non-Commercial (GDPR Research Consent)
|
|
85
|
+
══════════════════════════════════════════════════════════════════
|
|
86
|
+
|
|
87
|
+
# 3. Verified grant in access list
|
|
88
|
+
./bin/biofs.js access list 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
|
|
89
|
+
|
|
90
|
+
# Shows:
|
|
91
|
+
┌─────────────────────────────────────────────┬────────────────────┬───────────────┬────────────┬───────────────┐
|
|
92
|
+
│ Researcher Wallet │ License Type │ Date │ Status │ Token ID │
|
|
93
|
+
├─────────────────────────────────────────────┼────────────────────┼───────────────┼────────────┼───────────────┤
|
|
94
|
+
│ 0xb3c3a584491b8ca4df45116a1e250098a0d6192d │ GDPR Research │ 10/7/2025 │ active │ 40249 │
|
|
95
|
+
└─────────────────────────────────────────────┴────────────────────┴───────────────┴────────────┴───────────────┘
|
|
96
|
+
|
|
97
|
+
✅ License token ID 40249 successfully minted on blockchain
|
|
98
|
+
✅ Dra. Claudia can now access the file
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Files Modified
|
|
102
|
+
|
|
103
|
+
### Frontend (CLI)
|
|
104
|
+
1. **`src/lib/api/client.ts`** - Added `directGrantLicenseToken()` method
|
|
105
|
+
2. **`src/commands/access/grant.ts`** - Smart fallback: try direct grant → request-based
|
|
106
|
+
3. **`package.json`** - Version 1.2.9 → 1.3.0
|
|
107
|
+
4. **`src/index.ts`** - Version and banner updated
|
|
108
|
+
|
|
109
|
+
### Backend (API)
|
|
110
|
+
1. **`plugins/bioip/api_bioip.py`** - Added `direct_grant_license_token()` endpoint
|
|
111
|
+
2. **Production API restarted** - New endpoint now live
|
|
112
|
+
|
|
113
|
+
### Documentation
|
|
114
|
+
1. **`BIOFS_V1.3.0_DIRECT_GRANT.md`** - Comprehensive feature documentation
|
|
115
|
+
2. **`RELEASE_SUMMARY_V1.3.0.md`** - This release summary
|
|
116
|
+
|
|
117
|
+
## API Changes
|
|
118
|
+
|
|
119
|
+
### New Endpoint
|
|
120
|
+
|
|
121
|
+
**POST** `/api_bioip/direct_grant_license_token`
|
|
122
|
+
|
|
123
|
+
**Request:**
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"user_signature": "0x...",
|
|
127
|
+
"ip_id": "0x...",
|
|
128
|
+
"receiver_wallet": "0x...",
|
|
129
|
+
"license_type": "non-commercial"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Response:**
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"status": "Success",
|
|
137
|
+
"status_details": {
|
|
138
|
+
"data": {
|
|
139
|
+
"license_token_id": 40249,
|
|
140
|
+
"tx_hash": "0x...",
|
|
141
|
+
"ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
|
|
142
|
+
"receiver": "0xb3c3a584491b8ca4df45116a1e250098a0d6192d",
|
|
143
|
+
"owner": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
|
|
144
|
+
"license_type": "non-commercial",
|
|
145
|
+
"grant_type": "direct",
|
|
146
|
+
"message": "Direct access granted! 0xb3c3a584... can now access the data"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### New Client Method
|
|
153
|
+
|
|
154
|
+
**TypeScript:**
|
|
155
|
+
```typescript
|
|
156
|
+
async directGrantLicenseToken(
|
|
157
|
+
ipId: string,
|
|
158
|
+
receiverWallet: string,
|
|
159
|
+
licenseType: string = 'non-commercial'
|
|
160
|
+
): Promise<any> {
|
|
161
|
+
const signature = await this.getSignature();
|
|
162
|
+
const response = await this.axios.post('/api_bioip/direct_grant_license_token', {
|
|
163
|
+
user_signature: signature,
|
|
164
|
+
ip_id: ipId,
|
|
165
|
+
receiver_wallet: receiverWallet,
|
|
166
|
+
license_type: licenseType
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
if (response.data.status === 'Success') {
|
|
170
|
+
return response.data.status_details?.data || response.data;
|
|
171
|
+
}
|
|
172
|
+
throw new Error(response.data.status_details?.message || 'Direct grant failed');
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## MongoDB Changes
|
|
177
|
+
|
|
178
|
+
### New Field: `grant_type`
|
|
179
|
+
|
|
180
|
+
License tokens now track how they were created:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"_id": ObjectId("..."),
|
|
185
|
+
"ip_id": "0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7",
|
|
186
|
+
"sender": "0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a",
|
|
187
|
+
"receiver": "0xb3c3a584491b8ca4df45116a1e250098a0d6192d",
|
|
188
|
+
"license_token_id": 40249,
|
|
189
|
+
"tx_hash": "0x...",
|
|
190
|
+
"status": "active",
|
|
191
|
+
"grant_type": "direct", // NEW: "direct" or "request-based"
|
|
192
|
+
"created_at": ISODate("2025-10-07T01:15:00Z")
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Use Cases
|
|
197
|
+
|
|
198
|
+
### 1. Collaborative Research
|
|
199
|
+
PI shares genomic data with collaborators without requiring requests:
|
|
200
|
+
```bash
|
|
201
|
+
biofs access grant 0xMyDataset 0xCollaborator1
|
|
202
|
+
biofs access grant 0xMyDataset 0xCollaborator2
|
|
203
|
+
biofs access grant 0xMyDataset 0xCollaborator3
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 2. Teaching & Workshops
|
|
207
|
+
Instructor shares datasets with students:
|
|
208
|
+
```bash
|
|
209
|
+
for wallet in $(cat student_wallets.txt); do
|
|
210
|
+
biofs access grant 0xTeachingDataset $wallet
|
|
211
|
+
done
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 3. Consortium Data Sharing
|
|
215
|
+
Consortium lead shares aggregated data with all member institutions:
|
|
216
|
+
```bash
|
|
217
|
+
biofs access grant 0xConsortiumData 0xInstitution1
|
|
218
|
+
biofs access grant 0xConsortiumData 0xInstitution2
|
|
219
|
+
# ... (continues for all members)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 4. Traditional Request Flow
|
|
223
|
+
Researcher discovers public dataset and requests access:
|
|
224
|
+
```bash
|
|
225
|
+
# Researcher: request access
|
|
226
|
+
biofs access request 0xPublicDataset
|
|
227
|
+
|
|
228
|
+
# Owner: approve request
|
|
229
|
+
biofs access grant 0xPublicDataset 0xResearcher
|
|
230
|
+
# Output: "Grant Type: Request-Based (researcher-requested)"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Security & Compliance
|
|
234
|
+
|
|
235
|
+
### Access Control ✅
|
|
236
|
+
- **Ownership Verification**: Only IP asset owner can grant (both flows)
|
|
237
|
+
- **Blockchain Enforcement**: All grants = Story Protocol license tokens
|
|
238
|
+
- **Revocation Supported**: `biofs access revoke` works for both flows
|
|
239
|
+
|
|
240
|
+
### GDPR Compliance ✅
|
|
241
|
+
- **Right to Erasure**: Revoke license token = revoke data access
|
|
242
|
+
- **Consent Management**: License tokens = GDPR consent mechanism
|
|
243
|
+
- **Audit Trail**: MongoDB records all grants with timestamps and grant_type
|
|
244
|
+
|
|
245
|
+
## Backward Compatibility ✅
|
|
246
|
+
|
|
247
|
+
**Fully Backward Compatible**:
|
|
248
|
+
- ✅ Existing request-based flow unchanged
|
|
249
|
+
- ✅ Old CLI versions still work (just lack direct grant)
|
|
250
|
+
- ✅ MongoDB queries unchanged (grant_type is optional)
|
|
251
|
+
- ✅ API endpoints are additive (no breaking changes)
|
|
252
|
+
|
|
253
|
+
## Breaking Changes
|
|
254
|
+
|
|
255
|
+
**None**. This is a purely additive feature.
|
|
256
|
+
|
|
257
|
+
## Version History
|
|
258
|
+
|
|
259
|
+
- **v1.3.0** (Oct 7, 2025): ✨ Added direct grant access control
|
|
260
|
+
- **v1.2.9** (Oct 7, 2025): Fixed ESM warnings, added verbose mode
|
|
261
|
+
- **v1.2.8** (Oct 7, 2025): Version banner fix
|
|
262
|
+
- **v1.2.7** (Oct 7, 2025): Added annotator intelligence
|
|
263
|
+
- **v1.2.6** (Oct 5, 2025): Added BioOS job management
|
|
264
|
+
|
|
265
|
+
## Support
|
|
266
|
+
|
|
267
|
+
- **npm Package**: https://www.npmjs.com/package/@genobank/biofs
|
|
268
|
+
- **GitHub**: https://github.com/Genobank/genobank-cli
|
|
269
|
+
- **Documentation**: See `BIOFS_V1.3.0_DIRECT_GRANT.md`
|
|
270
|
+
- **Support**: support@genobank.io
|
|
271
|
+
|
|
272
|
+
## Next Steps for Users
|
|
273
|
+
|
|
274
|
+
### Dra. Claudia (Researcher)
|
|
275
|
+
|
|
276
|
+
1. **Update to v1.3.0**:
|
|
277
|
+
```bash
|
|
278
|
+
npm install -g @genobank/biofs@1.3.0
|
|
279
|
+
biofs --version # Should show: 1.3.0
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
2. **Authenticate**:
|
|
283
|
+
```bash
|
|
284
|
+
biofs login # Use wallet: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
3. **Verify Access**:
|
|
288
|
+
```bash
|
|
289
|
+
biofs files
|
|
290
|
+
# Should now show: 55052008714000.deepvariant.vcf
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
4. **Download File**:
|
|
294
|
+
```bash
|
|
295
|
+
biofs download 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7 ./my-analysis/
|
|
296
|
+
# File downloads successfully!
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### IP Asset Owners
|
|
300
|
+
|
|
301
|
+
1. **Share Data Proactively**:
|
|
302
|
+
```bash
|
|
303
|
+
# No longer need to wait for requests!
|
|
304
|
+
biofs access grant <your_ip_id> <researcher_wallet>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
2. **View All Grants**:
|
|
308
|
+
```bash
|
|
309
|
+
biofs access list <your_ip_id>
|
|
310
|
+
# Shows all granted wallets with grant type
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
3. **Revoke Access**:
|
|
314
|
+
```bash
|
|
315
|
+
biofs access revoke <your_ip_id> <researcher_wallet> --yes
|
|
316
|
+
# GDPR right to erasure
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
**Status**: ✅ Published, tested, and ready for production use
|
|
322
|
+
**Key Feature**: Direct Grant enables owner-initiated data sharing
|
|
323
|
+
**Impact**: Simplifies collaborative research workflows
|
|
324
|
+
**Compliance**: Fully GDPR compliant with right to erasure support
|