@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,462 +0,0 @@
|
|
|
1
|
-
# ๐ GDPR-Compliant BioNFS Implementation Status
|
|
2
|
-
|
|
3
|
-
## โ
COMPLETED: Core Libraries
|
|
4
|
-
|
|
5
|
-
### 1. Consent Manager (`lib/consent-manager.js`)
|
|
6
|
-
**Purpose:** Manages GDPR consent records via API
|
|
7
|
-
|
|
8
|
-
**Features:**
|
|
9
|
-
- โ
Check if user has already given consent
|
|
10
|
-
- โ
Record new consent after user agrees
|
|
11
|
-
- โ
Revoke consent for IP assets
|
|
12
|
-
- โ
Get all consent records for wallet
|
|
13
|
-
|
|
14
|
-
**API Integration:**
|
|
15
|
-
- `POST /bionfs/v1/verify_consent` - Check consent status
|
|
16
|
-
- `POST /bionfs/v1/record_consent` - Record consent
|
|
17
|
-
- `POST /bionfs/v1/revoke_consent` - Revoke consent
|
|
18
|
-
- `GET /bionfs/v1/my_consents` - List consents
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
### 2. Consent Prompt (`lib/consent-prompt.js`)
|
|
23
|
-
**Purpose:** Display GDPR-compliant consent notice
|
|
24
|
-
|
|
25
|
-
**Features:**
|
|
26
|
-
- โ
Shows file information (owner, license, IP asset)
|
|
27
|
-
- โ
Explains genomic data nature (GDPR Article 9)
|
|
28
|
-
- โ
Lists user rights (revoke, audit trail)
|
|
29
|
-
- โ
Shows license terms (non-commercial, attribution)
|
|
30
|
-
- โ
Records IP address and timestamp
|
|
31
|
-
- โ
Requires explicit "I AGREE" input
|
|
32
|
-
|
|
33
|
-
**GDPR Compliance:**
|
|
34
|
-
- โ
Informed consent (user understands what they're accessing)
|
|
35
|
-
- โ
Explicit agreement (active "I AGREE" required)
|
|
36
|
-
- โ
Purpose limitation (stated purpose of access)
|
|
37
|
-
- โ
Right to withdraw (revoke command mentioned)
|
|
38
|
-
- โ
Audit trail (timestamp + IP logged)
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
### 3. BioNFS Client (`lib/bionfs-client.js`)
|
|
43
|
-
**Purpose:** Stream files via BioNFS protocol
|
|
44
|
-
|
|
45
|
-
**Features:**
|
|
46
|
-
- โ
Authenticate with BioNFS server
|
|
47
|
-
- โ
Stream files by IP Asset ID or BioCID
|
|
48
|
-
- โ
Fallback to direct API if BioNFS unavailable
|
|
49
|
-
- โ
Parse BioCID format
|
|
50
|
-
|
|
51
|
-
**Streaming Methods:**
|
|
52
|
-
1. **BioNFS Protocol** (preferred):
|
|
53
|
-
- Authenticate โ Get session ID
|
|
54
|
-
- Stream via `/bionfs/v1/stream/<ip_id>`
|
|
55
|
-
- Uses session-based permissions
|
|
56
|
-
|
|
57
|
-
2. **Direct API** (fallback):
|
|
58
|
-
- Download via `/api_bioip/download_granted_file`
|
|
59
|
-
- Uses signature-based auth
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## ๐ง IN PROGRESS: Command Integration
|
|
64
|
-
|
|
65
|
-
### Next Steps
|
|
66
|
-
|
|
67
|
-
#### 1. Update Download Command
|
|
68
|
-
**File:** `bin/biofs.js` (download command section)
|
|
69
|
-
|
|
70
|
-
**Add:**
|
|
71
|
-
```javascript
|
|
72
|
-
const ConsentManager = require('../lib/consent-manager');
|
|
73
|
-
const ConsentPrompt = require('../lib/consent-prompt');
|
|
74
|
-
const BioNFSClient = require('../lib/bionfs-client');
|
|
75
|
-
|
|
76
|
-
// In download command:
|
|
77
|
-
program
|
|
78
|
-
.command('download')
|
|
79
|
-
.action(async (biocid, destination, options) => {
|
|
80
|
-
// 1. Load auth
|
|
81
|
-
const { wallet, signature } = loadAuth();
|
|
82
|
-
|
|
83
|
-
// 2. Resolve BioCID to file info
|
|
84
|
-
const fileInfo = await resolveFile(biocid, signature);
|
|
85
|
-
|
|
86
|
-
// 3. Check consent
|
|
87
|
-
const consentManager = new ConsentManager();
|
|
88
|
-
const hasConsent = await consentManager.hasConsent(
|
|
89
|
-
wallet, fileInfo.ip_id, 'download', signature
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
if (!hasConsent) {
|
|
93
|
-
// 4. Show GDPR consent notice
|
|
94
|
-
const consentPrompt = new ConsentPrompt();
|
|
95
|
-
fileInfo.wallet = wallet;
|
|
96
|
-
const agreed = await consentPrompt.showConsentNotice(fileInfo, 'download');
|
|
97
|
-
|
|
98
|
-
if (!agreed) {
|
|
99
|
-
console.log('โ Consent declined');
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// 5. Record consent
|
|
104
|
-
const ipAddress = await consentPrompt.getPublicIP();
|
|
105
|
-
await consentManager.recordConsent(wallet, fileInfo, 'download', ipAddress, signature);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 6. Download file
|
|
109
|
-
const bionfs = new BioNFSClient();
|
|
110
|
-
await bionfs.authenticate(wallet, signature);
|
|
111
|
-
await bionfs.streamFile(fileInfo.ip_id, destination, signature);
|
|
112
|
-
|
|
113
|
-
console.log('โ
Downloaded:', destination);
|
|
114
|
-
});
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### 2. Add Mount Command
|
|
118
|
-
**File:** `bin/biofs.js`
|
|
119
|
-
|
|
120
|
-
**Add:**
|
|
121
|
-
```javascript
|
|
122
|
-
program
|
|
123
|
-
.command('mount')
|
|
124
|
-
.argument('<mount-point>', 'Directory to mount files')
|
|
125
|
-
.option('--read-only', 'Mount as read-only')
|
|
126
|
-
.description('Mount all granted BioFiles to local directory')
|
|
127
|
-
.action(async (mountPoint, options) => {
|
|
128
|
-
// 1. Get all granted files
|
|
129
|
-
const files = await api.getGrantedBioIPs(signature);
|
|
130
|
-
|
|
131
|
-
// 2. Check/request consent for each
|
|
132
|
-
for (const file of files) {
|
|
133
|
-
const hasConsent = await consentManager.hasConsent(
|
|
134
|
-
wallet, file.ip_id, 'mount', signature
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
if (!hasConsent) {
|
|
138
|
-
const agreed = await consentPrompt.showConsentNotice(file, 'mount');
|
|
139
|
-
if (agreed) {
|
|
140
|
-
await consentManager.recordConsent(wallet, file, 'mount', ipAddress, signature);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// 3. Download all consented files
|
|
146
|
-
fs.mkdirSync(mountPoint, { recursive: true });
|
|
147
|
-
for (const file of files) {
|
|
148
|
-
const localPath = path.join(mountPoint, file.filename);
|
|
149
|
-
await bionfs.streamFile(file.ip_id, localPath, signature);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
console.log(`โ
Mounted ${files.length} files to ${mountPoint}`);
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### 3. Add Revoke Command
|
|
157
|
-
**File:** `bin/biofs.js`
|
|
158
|
-
|
|
159
|
-
**Add:**
|
|
160
|
-
```javascript
|
|
161
|
-
program
|
|
162
|
-
.command('access')
|
|
163
|
-
.command('revoke [ip-id]')
|
|
164
|
-
.option('--all', 'Revoke all consents')
|
|
165
|
-
.description('Revoke access consent for genomic files')
|
|
166
|
-
.action(async (ipId, options) => {
|
|
167
|
-
const consentManager = new ConsentManager();
|
|
168
|
-
|
|
169
|
-
if (options.all) {
|
|
170
|
-
await consentManager.revokeConsent(wallet, null, signature);
|
|
171
|
-
console.log('โ
Revoked all consents');
|
|
172
|
-
} else {
|
|
173
|
-
await consentManager.revokeConsent(wallet, ipId, signature);
|
|
174
|
-
console.log('โ
Revoked consent for', ipId);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## ๐ PENDING: API Endpoints
|
|
182
|
-
|
|
183
|
-
### API Implementation Required
|
|
184
|
-
|
|
185
|
-
**File:** `/home/ubuntu/Genobank_APIs/production_api/plugins/bioip/api_bioip.py`
|
|
186
|
-
|
|
187
|
-
**Add these endpoints:**
|
|
188
|
-
|
|
189
|
-
```python
|
|
190
|
-
@app.route('/bionfs/v1/verify_consent', methods=['POST'])
|
|
191
|
-
def verify_consent():
|
|
192
|
-
"""Check if user has given consent for this file"""
|
|
193
|
-
user_signature = request.json.get('user_signature')
|
|
194
|
-
ip_id = request.json.get('ip_id')
|
|
195
|
-
action = request.json.get('action')
|
|
196
|
-
|
|
197
|
-
wallet = recover_wallet(user_signature)
|
|
198
|
-
|
|
199
|
-
# Check MongoDB
|
|
200
|
-
consent = db.bioip_access_consents.find_one({
|
|
201
|
-
'wallet_address': wallet.lower(),
|
|
202
|
-
'ip_id': ip_id.lower(),
|
|
203
|
-
'action': action,
|
|
204
|
-
'revoked': False
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
if consent:
|
|
208
|
-
return jsonify({
|
|
209
|
-
'has_consent': True,
|
|
210
|
-
'consent_given_at': consent['consent_given_at'].isoformat(),
|
|
211
|
-
'access_count': consent['access_count']
|
|
212
|
-
})
|
|
213
|
-
else:
|
|
214
|
-
return jsonify({'has_consent': False})
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
@app.route('/bionfs/v1/record_consent', methods=['POST'])
|
|
218
|
-
def record_consent():
|
|
219
|
-
"""Record GDPR consent after user agrees"""
|
|
220
|
-
user_signature = request.json.get('user_signature')
|
|
221
|
-
ip_id = request.json.get('ip_id')
|
|
222
|
-
action = request.json.get('action')
|
|
223
|
-
ip_address = request.json.get('ip_address')
|
|
224
|
-
|
|
225
|
-
wallet = recover_wallet(user_signature)
|
|
226
|
-
|
|
227
|
-
# Get file info
|
|
228
|
-
bioip = bioip_dao.get_bioip_by_ip_id(ip_id)
|
|
229
|
-
|
|
230
|
-
consent_record = {
|
|
231
|
-
'wallet_address': wallet.lower(),
|
|
232
|
-
'ip_id': ip_id.lower(),
|
|
233
|
-
'filename': bioip.get('filename'),
|
|
234
|
-
'data_owner': bioip.get('owner', '').lower(),
|
|
235
|
-
'license_token_id': bioip.get('license_token_id'),
|
|
236
|
-
'license_type': bioip.get('license_type', 'non-commercial'),
|
|
237
|
-
|
|
238
|
-
'action': action,
|
|
239
|
-
'purpose': 'research_and_clinical_analysis',
|
|
240
|
-
|
|
241
|
-
'consent_text_version': 'v1.0',
|
|
242
|
-
'consent_given_at': datetime.utcnow(),
|
|
243
|
-
'consent_ip_address': ip_address,
|
|
244
|
-
'consent_user_agent': request.headers.get('User-Agent'),
|
|
245
|
-
|
|
246
|
-
'gdpr_rights_acknowledged': True,
|
|
247
|
-
'license_terms_acknowledged': True,
|
|
248
|
-
|
|
249
|
-
'access_count': 1,
|
|
250
|
-
'last_accessed_at': datetime.utcnow(),
|
|
251
|
-
|
|
252
|
-
'revoked': False
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
db.bioip_access_consents.insert_one(consent_record)
|
|
256
|
-
|
|
257
|
-
# Audit log
|
|
258
|
-
db.audit_log.insert_one({
|
|
259
|
-
'event_type': 'consent_granted',
|
|
260
|
-
'wallet': wallet,
|
|
261
|
-
'ip_id': ip_id,
|
|
262
|
-
'action': action,
|
|
263
|
-
'timestamp': datetime.utcnow()
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
return jsonify({'status': 'Success', 'message': 'Consent recorded'})
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@app.route('/bionfs/v1/revoke_consent', methods=['POST'])
|
|
270
|
-
def revoke_consent():
|
|
271
|
-
"""Revoke consent (GDPR right to withdraw)"""
|
|
272
|
-
user_signature = request.json.get('user_signature')
|
|
273
|
-
ip_id = request.json.get('ip_id')
|
|
274
|
-
|
|
275
|
-
wallet = recover_wallet(user_signature)
|
|
276
|
-
|
|
277
|
-
if ip_id == 'all':
|
|
278
|
-
result = db.bioip_access_consents.update_many(
|
|
279
|
-
{
|
|
280
|
-
'wallet_address': wallet.lower(),
|
|
281
|
-
'revoked': False
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
'$set': {
|
|
285
|
-
'revoked': True,
|
|
286
|
-
'revoked_at': datetime.utcnow(),
|
|
287
|
-
'revoked_reason': 'user_requested'
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
count = result.modified_count
|
|
292
|
-
else:
|
|
293
|
-
result = db.bioip_access_consents.update_many(
|
|
294
|
-
{
|
|
295
|
-
'wallet_address': wallet.lower(),
|
|
296
|
-
'ip_id': ip_id.lower(),
|
|
297
|
-
'revoked': False
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
'$set': {
|
|
301
|
-
'revoked': True,
|
|
302
|
-
'revoked_at': datetime.utcnow(),
|
|
303
|
-
'revoked_reason': 'user_requested'
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
)
|
|
307
|
-
count = result.modified_count
|
|
308
|
-
|
|
309
|
-
db.audit_log.insert_one({
|
|
310
|
-
'event_type': 'consent_revoked',
|
|
311
|
-
'wallet': wallet,
|
|
312
|
-
'ip_id': ip_id,
|
|
313
|
-
'timestamp': datetime.utcnow()
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
return jsonify({
|
|
317
|
-
'status': 'Success',
|
|
318
|
-
'message': f'Revoked {count} consent(s)'
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
@app.route('/api_bioip/download_granted_file', methods=['GET', 'POST'])
|
|
323
|
-
def download_granted_file():
|
|
324
|
-
"""Download a file you have a license token for"""
|
|
325
|
-
user_signature = request.values.get('user_signature')
|
|
326
|
-
ip_id = request.values.get('ip_id')
|
|
327
|
-
|
|
328
|
-
wallet = recover_wallet(user_signature)
|
|
329
|
-
|
|
330
|
-
# Verify license token
|
|
331
|
-
has_license = story_protocol_service.verify_license(ip_id, wallet)
|
|
332
|
-
if not has_license:
|
|
333
|
-
return jsonify({'error': 'No valid license found'}), 403
|
|
334
|
-
|
|
335
|
-
# Get S3 path
|
|
336
|
-
bioip = bioip_dao.get_bioip_by_ip_id(ip_id)
|
|
337
|
-
if not bioip:
|
|
338
|
-
return jsonify({'error': 'File not found'}), 404
|
|
339
|
-
|
|
340
|
-
s3_path = bioip['s3_path']
|
|
341
|
-
|
|
342
|
-
# Stream from S3
|
|
343
|
-
return stream_s3_file_response(s3_path, bioip['filename'])
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
## ๐งช Testing Plan
|
|
349
|
-
|
|
350
|
-
### Test 1: Dr. Claudia's First Download (Shows Consent)
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
biofs download "biocid://0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a/bioip/0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7"
|
|
354
|
-
|
|
355
|
-
# Expected:
|
|
356
|
-
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
357
|
-
# ๐ GENOMIC DATA ACCESS CONSENT
|
|
358
|
-
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
359
|
-
#
|
|
360
|
-
# FILE INFORMATION:
|
|
361
|
-
# Filename: 55052008714000.deepvariant.vcf
|
|
362
|
-
# Owner: 0x5f5a...d19a
|
|
363
|
-
# License Type: non-commercial
|
|
364
|
-
#
|
|
365
|
-
# YOU ARE ABOUT TO ACCESS:
|
|
366
|
-
# โข Genomic variants (VCF format)
|
|
367
|
-
# โข Protected under GDPR Article 9
|
|
368
|
-
#
|
|
369
|
-
# > Type "I AGREE" to proceed: I AGREE
|
|
370
|
-
#
|
|
371
|
-
# โ
Consent recorded
|
|
372
|
-
# โ
Downloaded: ./55052008714000.deepvariant.vcf
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
### Test 2: Second Download (Uses Existing Consent)
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
biofs download "55052008714000.deepvariant.vcf" ~/second-copy.vcf
|
|
379
|
-
|
|
380
|
-
# Expected:
|
|
381
|
-
# โ Using existing consent
|
|
382
|
-
# โ
Downloaded: ~/second-copy.vcf
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### Test 3: Mount (Shows Consent for Each File)
|
|
386
|
-
|
|
387
|
-
```bash
|
|
388
|
-
biofs mount ~/dr-claudia-genomic-data
|
|
389
|
-
|
|
390
|
-
# Expected:
|
|
391
|
-
# ๐ File 1 of 1:
|
|
392
|
-
# [Shows consent notice]
|
|
393
|
-
# > Type "I AGREE" to proceed: I AGREE
|
|
394
|
-
#
|
|
395
|
-
# โ
Consent recorded
|
|
396
|
-
# โ
Mounted 1 file(s) to ~/dr-claudia-genomic-data
|
|
397
|
-
#
|
|
398
|
-
# Your Files:
|
|
399
|
-
# โ 55052008714000.deepvariant.vcf
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
### Test 4: Revoke Access
|
|
403
|
-
|
|
404
|
-
```bash
|
|
405
|
-
biofs access revoke 0xCCe14315eE3D6a41596EeB4a2839eE50A8ec59f7
|
|
406
|
-
|
|
407
|
-
# Expected:
|
|
408
|
-
# โ
Revoked consent for 0xCCe1...59f7
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
---
|
|
412
|
-
|
|
413
|
-
## ๐ GDPR Compliance Checklist
|
|
414
|
-
|
|
415
|
-
โ
**Article 6 (Lawfulness)** - Consent is basis for processing
|
|
416
|
-
โ
**Article 7 (Conditions for Consent)** - Explicit "I AGREE" required
|
|
417
|
-
โ
**Article 9 (Special Categories)** - Genomic data explicitly mentioned
|
|
418
|
-
โ
**Article 13 (Information)** - User informed of purpose, rights, audit
|
|
419
|
-
โ
**Article 17 (Right to Erasure)** - Revoke command available
|
|
420
|
-
โ
**Article 30 (Records of Processing)** - Audit trail in MongoDB
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
## ๐ File Summary
|
|
425
|
-
|
|
426
|
-
**Created:**
|
|
427
|
-
- โ
`/home/ubuntu/genobank-cli/lib/consent-manager.js`
|
|
428
|
-
- โ
`/home/ubuntu/genobank-cli/lib/consent-prompt.js`
|
|
429
|
-
- โ
`/home/ubuntu/genobank-cli/lib/bionfs-client.js`
|
|
430
|
-
- โ
`/home/ubuntu/genobank-cli/GDPR_BIONFS_CONSENT_ARCHITECTURE.md`
|
|
431
|
-
- โ
`/home/ubuntu/genobank-cli/BIONFS_MOUNT_INTEGRATION_PLAN.md`
|
|
432
|
-
|
|
433
|
-
**To Update:**
|
|
434
|
-
- โณ `/home/ubuntu/genobank-cli/bin/biofs.js` - Add download/mount/revoke commands
|
|
435
|
-
- โณ `/home/ubuntu/Genobank_APIs/production_api/plugins/bioip/api_bioip.py` - Add BioNFS endpoints
|
|
436
|
-
|
|
437
|
-
**To Create:**
|
|
438
|
-
- โณ MongoDB collection: `bioip_access_consents`
|
|
439
|
-
- โณ MongoDB collection: `audit_log` (if not exists)
|
|
440
|
-
|
|
441
|
-
---
|
|
442
|
-
|
|
443
|
-
## ๐ Next Actions
|
|
444
|
-
|
|
445
|
-
1. **Update bin/biofs.js** with consent flow integration
|
|
446
|
-
2. **Deploy API endpoints** to production API
|
|
447
|
-
3. **Create MongoDB collections** with proper indexes
|
|
448
|
-
4. **Test with Dr. Claudia's file**
|
|
449
|
-
5. **Document user guide** for GDPR consent workflow
|
|
450
|
-
|
|
451
|
-
---
|
|
452
|
-
|
|
453
|
-
## ๐ก Key Innovation
|
|
454
|
-
|
|
455
|
-
This implementation provides:
|
|
456
|
-
- **First GDPR-compliant genomic data CLI** with explicit consent
|
|
457
|
-
- **Blockchain-verified access control** (Story Protocol licenses)
|
|
458
|
-
- **Full audit trail** for regulatory compliance
|
|
459
|
-
- **User-friendly consent flow** (not just legalese)
|
|
460
|
-
- **Revocable access** (right to withdraw)
|
|
461
|
-
|
|
462
|
-
Dr. Claudia will have full transparency and control over her genomic data access! ๐
|