@genobank/biofs 2.5.2 → 2.6.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/README.md +4 -4
- package/dist/commands/admin/register-lab.d.ts.map +1 -1
- package/dist/commands/admin/register-lab.js +27 -3
- package/dist/commands/admin/register-lab.js.map +1 -1
- package/dist/commands/context/create.d.ts +25 -0
- package/dist/commands/context/create.d.ts.map +1 -0
- package/dist/commands/context/create.js +316 -0
- package/dist/commands/context/create.js.map +1 -0
- package/dist/commands/context/publish.d.ts +9 -0
- package/dist/commands/context/publish.d.ts.map +1 -0
- package/dist/commands/context/publish.js +99 -0
- package/dist/commands/context/publish.js.map +1 -0
- package/dist/commands/context/revoke.d.ts +10 -0
- package/dist/commands/context/revoke.d.ts.map +1 -0
- package/dist/commands/context/revoke.js +113 -0
- package/dist/commands/context/revoke.js.map +1 -0
- package/dist/commands/context/verify.d.ts +6 -0
- package/dist/commands/context/verify.d.ts.map +1 -0
- package/dist/commands/context/verify.js +77 -0
- package/dist/commands/context/verify.js.map +1 -0
- package/dist/commands/link-clara.d.ts.map +1 -1
- package/dist/commands/link-clara.js +21 -7
- package/dist/commands/link-clara.js.map +1 -1
- package/dist/index.js +75 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/ai/classifier.d.ts +1 -1
- package/dist/lib/ai/classifier.d.ts.map +1 -1
- package/dist/lib/ai/classifier.js +25 -12
- package/dist/lib/ai/classifier.js.map +1 -1
- package/dist/lib/config/constants.d.ts +1 -1
- package/dist/lib/config/constants.d.ts.map +1 -1
- package/dist/lib/config/constants.js +3 -3
- package/dist/lib/config/constants.js.map +1 -1
- package/dist/lib/context/manifest.d.ts +90 -0
- package/dist/lib/context/manifest.d.ts.map +1 -0
- package/dist/lib/context/manifest.js +228 -0
- package/dist/lib/context/manifest.js.map +1 -0
- package/package.json +21 -2
- package/docs/AI_AGENT_MCP_MANUAL.md +0 -1029
- package/docs/USER_MANUAL.md +0 -603
- package/docs/technical-details.html +0 -555
- package/lib/bionfs-client.js +0 -127
- package/lib/consent-manager.js +0 -90
- package/lib/consent-prompt.js +0 -120
- package/presentation/biofs-x402-kite-presentation.html +0 -813
- package/scripts/build_annotator_dictionary.py +0 -353
- package/scripts/deploy-clara-nft.js +0 -37
package/lib/consent-manager.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GDPR Consent Manager for BioNFS
|
|
3
|
-
* Manages genomic data access consent records
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const axios = require('axios');
|
|
7
|
-
const chalk = require('chalk');
|
|
8
|
-
|
|
9
|
-
const API_BASE = process.env.GENOBANK_API_URL || 'https://genobank.app';
|
|
10
|
-
|
|
11
|
-
class ConsentManager {
|
|
12
|
-
/**
|
|
13
|
-
* Check if user has already given consent for this file
|
|
14
|
-
*/
|
|
15
|
-
async hasConsent(wallet, ipId, action, userSignature) {
|
|
16
|
-
try {
|
|
17
|
-
const response = await axios.post(`${API_BASE}/bionfs/v1/verify_consent`, {
|
|
18
|
-
user_signature: userSignature,
|
|
19
|
-
ip_id: ipId,
|
|
20
|
-
action: action // 'download' or 'mount'
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return response.data.has_consent === true;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
// If endpoint doesn't exist yet, assume no consent
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Record user's consent after they agree
|
|
32
|
-
*/
|
|
33
|
-
async recordConsent(wallet, fileInfo, action, ipAddress, userSignature) {
|
|
34
|
-
try {
|
|
35
|
-
const response = await axios.post(`${API_BASE}/bionfs/v1/record_consent`, {
|
|
36
|
-
user_signature: userSignature,
|
|
37
|
-
ip_id: fileInfo.ip_id,
|
|
38
|
-
action: action,
|
|
39
|
-
ip_address: ipAddress
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (response.data.status === 'Success') {
|
|
43
|
-
console.log(chalk.green('✅ Consent recorded'));
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return false;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error(chalk.yellow('⚠️ Could not record consent:', error.message));
|
|
50
|
-
console.log(chalk.gray('Proceeding with download (consent will be recorded when API is ready)'));
|
|
51
|
-
return true; // Allow download even if consent recording fails
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Revoke consent for an IP asset
|
|
57
|
-
*/
|
|
58
|
-
async revokeConsent(wallet, ipId, userSignature) {
|
|
59
|
-
try {
|
|
60
|
-
const response = await axios.post(`${API_BASE}/bionfs/v1/revoke_consent`, {
|
|
61
|
-
user_signature: userSignature,
|
|
62
|
-
ip_id: ipId || 'all'
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return response.data.status === 'Success';
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error(chalk.red('Error revoking consent:', error.message));
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Get all consent records for a wallet
|
|
74
|
-
*/
|
|
75
|
-
async getMyConsents(userSignature) {
|
|
76
|
-
try {
|
|
77
|
-
const response = await axios.get(`${API_BASE}/bionfs/v1/my_consents`, {
|
|
78
|
-
params: { user_signature: userSignature }
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return response.data.consents || [];
|
|
82
|
-
} catch (error) {
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
module.exports = ConsentManager;
|
|
89
|
-
|
|
90
|
-
|
package/lib/consent-prompt.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GDPR Consent Prompt for Genomic Data Access
|
|
3
|
-
* Displays interactive consent notice before file access
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const chalk = require('chalk');
|
|
7
|
-
const inquirer = require('inquirer');
|
|
8
|
-
const axios = require('axios');
|
|
9
|
-
|
|
10
|
-
class ConsentPrompt {
|
|
11
|
-
/**
|
|
12
|
-
* Display GDPR consent notice and get user agreement
|
|
13
|
-
*/
|
|
14
|
-
async showConsentNotice(fileInfo, action = 'download') {
|
|
15
|
-
console.log('\n');
|
|
16
|
-
console.log(chalk.yellow('═'.repeat(72)));
|
|
17
|
-
console.log(chalk.bold.yellow(' 🔒 GENOMIC DATA ACCESS CONSENT'));
|
|
18
|
-
console.log(chalk.yellow('═'.repeat(72)));
|
|
19
|
-
console.log('');
|
|
20
|
-
|
|
21
|
-
console.log(chalk.bold('FILE INFORMATION:'));
|
|
22
|
-
console.log(` Filename: ${chalk.cyan(fileInfo.filename)}`);
|
|
23
|
-
console.log(` Owner: ${chalk.cyan(this.truncateAddress(fileInfo.owner))}`);
|
|
24
|
-
console.log(` IP Asset: ${chalk.gray(this.truncateAddress(fileInfo.ip_id))}`);
|
|
25
|
-
console.log(` License Type: ${chalk.green(fileInfo.license_type || 'non-commercial')}`);
|
|
26
|
-
console.log('');
|
|
27
|
-
|
|
28
|
-
console.log(chalk.bold('YOU ARE ABOUT TO ACCESS:'));
|
|
29
|
-
console.log(' • Genomic variants (VCF format)');
|
|
30
|
-
console.log(' • Potentially identifying genetic information');
|
|
31
|
-
console.log(' • Protected under GDPR Article 9 (Special Categories of Data)');
|
|
32
|
-
console.log('');
|
|
33
|
-
|
|
34
|
-
console.log(chalk.bold('PURPOSE OF ACCESS:'));
|
|
35
|
-
console.log(` ${action === 'mount' ? 'Mounting for' : 'Downloading for'} research and clinical analysis`);
|
|
36
|
-
console.log('');
|
|
37
|
-
|
|
38
|
-
console.log(chalk.bold.green('YOUR RIGHTS:'));
|
|
39
|
-
console.log(' ✓ Revoke access anytime via: ' + chalk.cyan('biofs access revoke <ip_id>'));
|
|
40
|
-
console.log(' ✓ All access is logged (audit trail)');
|
|
41
|
-
console.log(' ✓ Data owner can revoke your license token');
|
|
42
|
-
console.log('');
|
|
43
|
-
|
|
44
|
-
console.log(chalk.bold('LICENSE TERMS:'));
|
|
45
|
-
if (fileInfo.license_type === 'non-commercial' || !fileInfo.license_type) {
|
|
46
|
-
console.log(' • Non-commercial use only');
|
|
47
|
-
console.log(' • Attribution required');
|
|
48
|
-
console.log(' • No redistribution without permission');
|
|
49
|
-
} else if (fileInfo.license_type === 'commercial') {
|
|
50
|
-
console.log(' • Commercial use permitted');
|
|
51
|
-
console.log(' • Subject to license agreement terms');
|
|
52
|
-
}
|
|
53
|
-
console.log('');
|
|
54
|
-
|
|
55
|
-
console.log(chalk.bold('GDPR COMPLIANCE:'));
|
|
56
|
-
console.log(' This access will be recorded with:');
|
|
57
|
-
console.log(` • Your wallet: ${fileInfo.wallet ? this.truncateAddress(fileInfo.wallet) : 'authenticated'}`);
|
|
58
|
-
console.log(` • Timestamp: ${new Date().toISOString()}`);
|
|
59
|
-
const ipAddress = await this.getPublicIP();
|
|
60
|
-
console.log(` • IP address: ${ipAddress}`);
|
|
61
|
-
console.log('');
|
|
62
|
-
|
|
63
|
-
console.log(chalk.yellow('─'.repeat(72)));
|
|
64
|
-
console.log('');
|
|
65
|
-
console.log(chalk.bold('By proceeding, you confirm:'));
|
|
66
|
-
console.log(' 1. You understand this is genomic data protected under GDPR');
|
|
67
|
-
console.log(' 2. You will use it only for the stated purpose');
|
|
68
|
-
console.log(' 3. You will comply with all license terms');
|
|
69
|
-
console.log(' 4. You acknowledge this access is being recorded');
|
|
70
|
-
console.log('');
|
|
71
|
-
|
|
72
|
-
// Require explicit "I AGREE"
|
|
73
|
-
const answer = await inquirer.prompt([
|
|
74
|
-
{
|
|
75
|
-
type: 'input',
|
|
76
|
-
name: 'consent',
|
|
77
|
-
message: chalk.bold('Type "I AGREE" to confirm consent and proceed:'),
|
|
78
|
-
validate: (input) => {
|
|
79
|
-
const normalized = input.trim().toUpperCase();
|
|
80
|
-
if (normalized === 'I AGREE') {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
if (normalized === 'NO' || normalized === 'N' || normalized === 'CANCEL') {
|
|
84
|
-
return 'Consent declined';
|
|
85
|
-
}
|
|
86
|
-
return 'You must type "I AGREE" exactly to proceed (or "cancel" to abort)';
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]);
|
|
90
|
-
|
|
91
|
-
return answer.consent.trim().toUpperCase() === 'I AGREE';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Get user's public IP address for audit trail
|
|
96
|
-
*/
|
|
97
|
-
async getPublicIP() {
|
|
98
|
-
try {
|
|
99
|
-
const response = await axios.get('https://api.ipify.org?format=json', {
|
|
100
|
-
timeout: 3000
|
|
101
|
-
});
|
|
102
|
-
return response.data.ip;
|
|
103
|
-
} catch {
|
|
104
|
-
return 'unknown';
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Truncate Ethereum address for display
|
|
110
|
-
*/
|
|
111
|
-
truncateAddress(address) {
|
|
112
|
-
if (!address) return 'unknown';
|
|
113
|
-
if (address.length !== 42) return address;
|
|
114
|
-
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
module.exports = ConsentPrompt;
|
|
119
|
-
|
|
120
|
-
|