@genobank/biofs 1.8.1 ā 1.8.3
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 +120 -152
- package/dist/commands/biofiles.d.ts +9 -0
- package/dist/commands/biofiles.d.ts.map +1 -0
- package/dist/commands/biofiles.js +112 -0
- package/dist/commands/biofiles.js.map +1 -0
- package/dist/commands/labs/list.d.ts +19 -0
- package/dist/commands/labs/list.d.ts.map +1 -0
- package/dist/commands/labs/list.js +98 -0
- package/dist/commands/labs/list.js.map +1 -0
- package/dist/commands/share.d.ts +10 -0
- package/dist/commands/share.d.ts.map +1 -0
- package/dist/commands/share.js +186 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/commands/verify.d.ts +9 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +138 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.js +99 -45
- package/dist/index.js.map +1 -1
- package/dist/lib/ai/classifier.d.ts +1 -3
- package/dist/lib/ai/classifier.d.ts.map +1 -1
- package/dist/lib/ai/classifier.js +17 -37
- package/dist/lib/ai/classifier.js.map +1 -1
- package/dist/lib/api/client.d.ts +46 -0
- package/dist/lib/api/client.d.ts.map +1 -1
- package/dist/lib/api/client.js +159 -19
- package/dist/lib/api/client.js.map +1 -1
- package/dist/lib/auth/server.d.ts.map +1 -1
- package/dist/lib/auth/server.js +2 -11
- package/dist/lib/auth/server.js.map +1 -1
- package/dist/lib/biofiles/fingerprint.d.ts.map +1 -1
- package/dist/lib/biofiles/fingerprint.js +11 -40
- package/dist/lib/biofiles/fingerprint.js.map +1 -1
- package/dist/lib/biofiles/resolver.d.ts.map +1 -1
- package/dist/lib/biofiles/resolver.js +59 -75
- package/dist/lib/biofiles/resolver.js.map +1 -1
- package/dist/lib/config/constants.d.ts +1 -0
- 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/utils/logger.d.ts +5 -6
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/lib/utils/logger.js +5 -23
- package/dist/lib/utils/logger.js.map +1 -1
- package/dist/types/api.d.ts +21 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/biofiles.d.ts +2 -2
- package/dist/types/biofiles.d.ts.map +1 -1
- package/package.json +2 -3
- package/.claude/settings.local.json +0 -33
- package/BIOFS_CLI_NODE_CONVERGENCE_ANALYSIS.md +0 -932
- package/BIOFS_FEDERATED_NETWORK_ARCHITECTURE.md +0 -1071
- package/BIOFS_NODE_CLIENT_ARCHITECTURE.md +0 -557
- package/BIOFS_NODE_IMPLEMENTATION_PLAN.md +0 -2164
- package/BIOROUTER_IMPLEMENTATION_CHECKLIST.md +0 -618
- package/BUBBLEWRAP_INTEGRATION.md +0 -486
- package/BUBBLEWRAP_QUICKSTART.md +0 -356
- package/BUBBLEWRAP_README.md +0 -466
- package/BUBBLEWRAP_STRATEGIC_ANALYSIS.md +0 -625
- package/EXECUTIVE_SUMMARY_BIOROUTER_CONVERGENCE.md +0 -323
- package/GEMINI_REMOVAL_COMPLETE.md +0 -311
- package/debug_credentials.js +0 -60
- package/dist/commands/sandbox.d.ts +0 -10
- package/dist/commands/sandbox.d.ts.map +0 -1
- package/dist/commands/sandbox.js +0 -418
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/lib/sandbox/bubblewrap.d.ts +0 -125
- package/dist/lib/sandbox/bubblewrap.d.ts.map +0 -1
- package/dist/lib/sandbox/bubblewrap.js +0 -343
- package/dist/lib/sandbox/bubblewrap.js.map +0 -1
- package/examples/sandbox-usage.ts +0 -361
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.shareCommand = shareCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const client_1 = require("../lib/api/client");
|
|
10
|
+
const resolver_1 = require("../lib/biofiles/resolver");
|
|
11
|
+
const logger_1 = require("../lib/utils/logger");
|
|
12
|
+
async function shareCommand(biocidOrFilename, options) {
|
|
13
|
+
const api = client_1.GenoBankAPIClient.getInstance();
|
|
14
|
+
const resolver = new resolver_1.BioCIDResolver();
|
|
15
|
+
// Validate lab wallet address
|
|
16
|
+
if (!options.lab || !options.lab.match(/^0x[a-fA-F0-9]{40}$/)) {
|
|
17
|
+
logger_1.Logger.error('Invalid lab wallet address. Must be a valid Ethereum address (0x...)');
|
|
18
|
+
throw new Error('Invalid lab wallet address');
|
|
19
|
+
}
|
|
20
|
+
const licenseType = options.license || 'non-commercial';
|
|
21
|
+
console.log(chalk_1.default.cyan('\nš Preparing biofile for sharing...\n'));
|
|
22
|
+
console.log(`${chalk_1.default.gray('File:')} ${biocidOrFilename}`);
|
|
23
|
+
console.log(`${chalk_1.default.gray('Lab:')} ${options.lab}`);
|
|
24
|
+
console.log(`${chalk_1.default.gray('License:')} ${licenseType}\n`);
|
|
25
|
+
try {
|
|
26
|
+
// Step 1: Verify lab is approved
|
|
27
|
+
const spinner1 = (0, ora_1.default)('Verifying lab authorization...').start();
|
|
28
|
+
const labs = await api.getApprovedLabs();
|
|
29
|
+
const lab = labs.find(l => l.wallet_address.toLowerCase() === options.lab.toLowerCase());
|
|
30
|
+
if (!lab) {
|
|
31
|
+
spinner1.fail();
|
|
32
|
+
logger_1.Logger.error(`Lab ${options.lab} is not in the approved labs registry`);
|
|
33
|
+
logger_1.Logger.info(`Run 'biofs labnfts' to see approved labs`);
|
|
34
|
+
throw new Error('Lab not authorized');
|
|
35
|
+
}
|
|
36
|
+
spinner1.succeed(`Lab verified: ${chalk_1.default.green(lab.name)}`);
|
|
37
|
+
// Step 2: Resolve file and check if already tokenized
|
|
38
|
+
const spinner2 = (0, ora_1.default)('Checking file tokenization status...').start();
|
|
39
|
+
let fileInfo;
|
|
40
|
+
try {
|
|
41
|
+
fileInfo = await resolver.resolve(biocidOrFilename);
|
|
42
|
+
spinner2.info(`File found: ${fileInfo.type} storage`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
spinner2.fail();
|
|
46
|
+
logger_1.Logger.error(`File not found: ${biocidOrFilename}`);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
// Step 3: Mint dual NFTs if needed
|
|
50
|
+
let biocid = '';
|
|
51
|
+
let ipAssetId = '';
|
|
52
|
+
// Check if file already has BioCID
|
|
53
|
+
const existingBiocid = await api.checkExistingBiocid(biocidOrFilename);
|
|
54
|
+
if (existingBiocid && !options.skipSequentias) {
|
|
55
|
+
console.log(`\n${chalk_1.default.green('ā')} File already has BioCID: ${chalk_1.default.cyan(existingBiocid.biocid)}`);
|
|
56
|
+
biocid = existingBiocid.biocid;
|
|
57
|
+
ipAssetId = existingBiocid.story_ip_id || '';
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.log(`\n${chalk_1.default.yellow('ā ļø')} File not yet tokenized as BioNFT`);
|
|
61
|
+
console.log(chalk_1.default.cyan('šØ Initiating dual NFT minting...\n'));
|
|
62
|
+
// Step 3a: Mint BioCID on Sequentias
|
|
63
|
+
if (!options.skipSequentias) {
|
|
64
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
65
|
+
console.log(chalk_1.default.bold('ā Step 1/4: Minting BioCID on Sequentias Network ā'));
|
|
66
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
67
|
+
const spinnerSeq = (0, ora_1.default)('Minting BioCID NFT on Sequentias...').start();
|
|
68
|
+
try {
|
|
69
|
+
const sequentiasResult = await api.mintSequentiasBioCID({
|
|
70
|
+
filename: biocidOrFilename,
|
|
71
|
+
file_type: fileInfo.type,
|
|
72
|
+
s3_path: fileInfo.path || ''
|
|
73
|
+
});
|
|
74
|
+
biocid = sequentiasResult.biocid;
|
|
75
|
+
spinnerSeq.succeed();
|
|
76
|
+
console.log(`${chalk_1.default.gray('š Network:')} Sequentias Mainnet`);
|
|
77
|
+
console.log(`${chalk_1.default.gray('š BioCID:')} ${chalk_1.default.cyan(biocid)}`);
|
|
78
|
+
console.log(`${chalk_1.default.gray('š Biorouter:')} ${sequentiasResult.biorouter_address}`);
|
|
79
|
+
console.log(`${chalk_1.default.gray('āļø Tx Hash:')} ${sequentiasResult.tx_hash}`);
|
|
80
|
+
console.log(chalk_1.default.green('ā
Sequentias BioCID NFT minted!\n'));
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
spinnerSeq.fail();
|
|
84
|
+
logger_1.Logger.error(`Failed to mint Sequentias BioCID: ${error}`);
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Step 3b: Register IP Asset on Story Protocol
|
|
89
|
+
if (!options.skipStory) {
|
|
90
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
91
|
+
console.log(chalk_1.default.bold('ā Step 2/4: Registering IP Asset on Story ā'));
|
|
92
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
93
|
+
const spinnerStory = (0, ora_1.default)('Registering IP Asset on Story Protocol...').start();
|
|
94
|
+
try {
|
|
95
|
+
const storyResult = await api.registerIPAssetWithBiocid({
|
|
96
|
+
biocid: biocid,
|
|
97
|
+
filename: biocidOrFilename,
|
|
98
|
+
file_type: fileInfo.type
|
|
99
|
+
});
|
|
100
|
+
ipAssetId = storyResult.ip_id;
|
|
101
|
+
spinnerStory.succeed();
|
|
102
|
+
console.log(`${chalk_1.default.gray('š Network:')} Story Protocol (Odyssey)`);
|
|
103
|
+
console.log(`${chalk_1.default.gray('šØ Collection:')} ${storyResult.collection_name}`);
|
|
104
|
+
console.log(`${chalk_1.default.gray('š IP Asset ID:')} ${chalk_1.default.cyan(ipAssetId)}`);
|
|
105
|
+
console.log(`${chalk_1.default.gray('āļø Tx Hash:')} ${storyResult.tx_hash}`);
|
|
106
|
+
console.log(chalk_1.default.green('ā
Story Protocol IP Asset registered!\n'));
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
spinnerStory.fail();
|
|
110
|
+
logger_1.Logger.error(`Failed to register Story IP Asset: ${error}`);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
// Step 3c: Attach PIL License Terms
|
|
114
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
115
|
+
console.log(chalk_1.default.bold('ā Step 3/4: Attaching PIL License Terms ā'));
|
|
116
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
117
|
+
const spinnerLicense = (0, ora_1.default)('Attaching license terms...').start();
|
|
118
|
+
try {
|
|
119
|
+
const licenseResult = await api.attachLicenseTerms({
|
|
120
|
+
ip_id: ipAssetId,
|
|
121
|
+
license_type: licenseType
|
|
122
|
+
});
|
|
123
|
+
spinnerLicense.succeed();
|
|
124
|
+
console.log(`${chalk_1.default.gray('š License Type:')} ${licenseType}`);
|
|
125
|
+
console.log(`${chalk_1.default.gray('š License Terms ID:')} ${licenseResult.license_terms_id}`);
|
|
126
|
+
console.log(`${chalk_1.default.gray('āļø Tx Hash:')} ${licenseResult.tx_hash}`);
|
|
127
|
+
console.log(chalk_1.default.green('ā
License terms attached!\n'));
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
spinnerLicense.fail();
|
|
131
|
+
logger_1.Logger.error(`Failed to attach license terms: ${error}`);
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Step 4: Mint License Token to Lab
|
|
137
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
138
|
+
console.log(chalk_1.default.bold('ā Step 4/4: Minting License Token to Lab ā'));
|
|
139
|
+
console.log(chalk_1.default.bold('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
140
|
+
const spinnerToken = (0, ora_1.default)('Minting license token...').start();
|
|
141
|
+
try {
|
|
142
|
+
const tokenResult = await api.shareWithLab({
|
|
143
|
+
ip_id: ipAssetId,
|
|
144
|
+
lab_wallet: options.lab,
|
|
145
|
+
license_type: licenseType
|
|
146
|
+
});
|
|
147
|
+
spinnerToken.succeed();
|
|
148
|
+
console.log(`${chalk_1.default.gray('š„ Recipient:')} ${lab.name} (${formatWallet(options.lab)})`);
|
|
149
|
+
console.log(`${chalk_1.default.gray('š« License Token ID:')} ${tokenResult.license_token_id}`);
|
|
150
|
+
console.log(`${chalk_1.default.gray('āļø Tx Hash:')} ${tokenResult.tx_hash}`);
|
|
151
|
+
console.log(chalk_1.default.green('ā
License token granted!\n'));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
spinnerToken.fail();
|
|
155
|
+
logger_1.Logger.error(`Failed to mint license token: ${error}`);
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
// Success summary
|
|
159
|
+
const summary = [
|
|
160
|
+
chalk_1.default.bold.green('š Biofile Successfully Shared!'),
|
|
161
|
+
'',
|
|
162
|
+
`${chalk_1.default.gray('BioCID (Sequentias):')}`,
|
|
163
|
+
chalk_1.default.cyan(`${biocid}`),
|
|
164
|
+
'',
|
|
165
|
+
`${chalk_1.default.gray('IP Asset (Story Protocol):')}`,
|
|
166
|
+
chalk_1.default.cyan(`https://explorer.story.foundation/ipa/${ipAssetId}`),
|
|
167
|
+
'',
|
|
168
|
+
`${chalk_1.default.gray('Lab can now access via:')}`,
|
|
169
|
+
chalk_1.default.gray(`$ biofs download --biocid ${biocid}`)
|
|
170
|
+
].join('\n');
|
|
171
|
+
console.log(chalk_1.default.green('\n' + 'ā'.repeat(60)));
|
|
172
|
+
console.log(summary);
|
|
173
|
+
console.log(chalk_1.default.green('ā'.repeat(60) + '\n'));
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
logger_1.Logger.error(`Share failed: ${error}`);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function formatWallet(wallet) {
|
|
181
|
+
if (wallet.length === 42) {
|
|
182
|
+
return `${wallet.slice(0, 6)}...${wallet.slice(-4)}`;
|
|
183
|
+
}
|
|
184
|
+
return wallet;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=share.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":";;;;;AAeA,oCAmMC;AAlND,kDAA0B;AAC1B,8CAAsB;AACtB,8CAAsD;AACtD,uDAA0D;AAC1D,gDAA6C;AAWtC,KAAK,UAAU,YAAY,CAChC,gBAAwB,EACxB,OAAqB;IAErB,MAAM,GAAG,GAAG,0BAAiB,CAAC,WAAW,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,yBAAc,EAAE,CAAC;IAEtC,8BAA8B;IAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAC9D,eAAM,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;QACrF,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;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AAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface VerifyOptions {
|
|
2
|
+
verbose?: boolean;
|
|
3
|
+
json?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Verify file integrity using DNA fingerprint (Bloom filter)
|
|
7
|
+
*/
|
|
8
|
+
export declare function verifyCommand(biocidOrFilename: string, localFile: string, options: VerifyOptions): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CAsGf"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.verifyCommand = verifyCommand;
|
|
40
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
+
const client_1 = require("../lib/api/client");
|
|
42
|
+
const resolver_1 = require("../lib/biofiles/resolver");
|
|
43
|
+
const fingerprint_1 = require("../lib/biofiles/fingerprint");
|
|
44
|
+
const logger_1 = require("../lib/utils/logger");
|
|
45
|
+
const fs_1 = require("fs");
|
|
46
|
+
/**
|
|
47
|
+
* Verify file integrity using DNA fingerprint (Bloom filter)
|
|
48
|
+
*/
|
|
49
|
+
async function verifyCommand(biocidOrFilename, localFile, options) {
|
|
50
|
+
const api = client_1.GenoBankAPIClient.getInstance();
|
|
51
|
+
try {
|
|
52
|
+
// Validate local file exists
|
|
53
|
+
if (!(0, fs_1.existsSync)(localFile)) {
|
|
54
|
+
throw new Error(`Local file not found: ${localFile}`);
|
|
55
|
+
}
|
|
56
|
+
if (options.verbose) {
|
|
57
|
+
logger_1.Logger.debug(`Verifying: ${biocidOrFilename}`);
|
|
58
|
+
logger_1.Logger.debug(`Against local file: ${localFile}`);
|
|
59
|
+
}
|
|
60
|
+
// Step 1: Download remote file to temp location
|
|
61
|
+
console.log(chalk_1.default.cyan('š Downloading remote file for comparison...'));
|
|
62
|
+
const tempFile = `/tmp/biofs_verify_${Date.now()}.tmp`;
|
|
63
|
+
// Use the download functionality to get the file
|
|
64
|
+
const resolver = new resolver_1.BioCIDResolver();
|
|
65
|
+
const remoteFile = await resolver.resolve(biocidOrFilename);
|
|
66
|
+
if (!remoteFile.presigned_url) {
|
|
67
|
+
throw new Error('Cannot access remote file - no presigned URL available');
|
|
68
|
+
}
|
|
69
|
+
// Download the remote file
|
|
70
|
+
const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
|
|
71
|
+
const response = await axios.get(remoteFile.presigned_url, {
|
|
72
|
+
responseType: 'arraybuffer'
|
|
73
|
+
});
|
|
74
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
75
|
+
await fs.writeFile(tempFile, response.data);
|
|
76
|
+
// Step 2: Generate fingerprints for both files
|
|
77
|
+
console.log(chalk_1.default.cyan('𧬠Generating DNA fingerprints...'));
|
|
78
|
+
const [remoteFingerprint, localFingerprint] = await Promise.all([
|
|
79
|
+
(0, fingerprint_1.calculateFileFingerprint)(tempFile),
|
|
80
|
+
(0, fingerprint_1.calculateFileFingerprint)(localFile)
|
|
81
|
+
]);
|
|
82
|
+
// Clean up temp file
|
|
83
|
+
await fs.unlink(tempFile);
|
|
84
|
+
// Step 3: Compare fingerprints
|
|
85
|
+
const match = localFingerprint === remoteFingerprint;
|
|
86
|
+
if (options.json) {
|
|
87
|
+
console.log(JSON.stringify({
|
|
88
|
+
match,
|
|
89
|
+
remote: {
|
|
90
|
+
file: biocidOrFilename,
|
|
91
|
+
fingerprint: remoteFingerprint
|
|
92
|
+
},
|
|
93
|
+
local: {
|
|
94
|
+
file: localFile,
|
|
95
|
+
fingerprint: localFingerprint
|
|
96
|
+
}
|
|
97
|
+
}, null, 2));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Display results
|
|
101
|
+
console.log('');
|
|
102
|
+
console.log(chalk_1.default.bold('DNA Fingerprint Verification'));
|
|
103
|
+
console.log('ā'.repeat(60));
|
|
104
|
+
console.log('');
|
|
105
|
+
console.log(chalk_1.default.gray('Remote File:'));
|
|
106
|
+
console.log(` ${remoteFile.filename || biocidOrFilename}`);
|
|
107
|
+
console.log(` Fingerprint: ${chalk_1.default.blue(remoteFingerprint.substring(0, 32) + '...')}`);
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log(chalk_1.default.gray('Local File:'));
|
|
110
|
+
console.log(` ${localFile}`);
|
|
111
|
+
console.log(` Fingerprint: ${chalk_1.default.blue(localFingerprint.substring(0, 32) + '...')}`);
|
|
112
|
+
console.log('');
|
|
113
|
+
if (match) {
|
|
114
|
+
console.log(chalk_1.default.green('ā
MATCH - Files are identical!'));
|
|
115
|
+
console.log(chalk_1.default.gray('The local file matches the remote file exactly.'));
|
|
116
|
+
console.log(chalk_1.default.gray('DNA fingerprints (Bloom filters) are consistent.'));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
console.log(chalk_1.default.red('ā MISMATCH - Files differ!'));
|
|
120
|
+
console.log(chalk_1.default.yellow('ā ļø The local file does NOT match the remote file.'));
|
|
121
|
+
console.log(chalk_1.default.gray('Possible causes:'));
|
|
122
|
+
console.log(chalk_1.default.gray(' ⢠File has been modified'));
|
|
123
|
+
console.log(chalk_1.default.gray(' ⢠Downloaded file is corrupted'));
|
|
124
|
+
console.log(chalk_1.default.gray(' ⢠Wrong file selected for comparison'));
|
|
125
|
+
}
|
|
126
|
+
console.log('');
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (options.json) {
|
|
130
|
+
console.error(JSON.stringify({ error: String(error) }, null, 2));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
logger_1.Logger.error(`Verification failed: ${error}`);
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,sCA0GC;AAzHD,kDAA0B;AAC1B,8CAAsD;AACtD,uDAA0D;AAC1D,6DAAuE;AACvE,gDAA6C;AAC7C,2BAAgC;AAOhC;;GAEG;AACI,KAAK,UAAU,aAAa,CACjC,gBAAwB,EACxB,SAAiB,EACjB,OAAsB;IAEtB,MAAM,GAAG,GAAG,0BAAiB,CAAC,WAAW,EAAE,CAAC;IAE5C,IAAI,CAAC;QACH,6BAA6B;QAC7B,IAAI,CAAC,IAAA,eAAU,EAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,SAAS,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,eAAM,CAAC,KAAK,CAAC,cAAc,gBAAgB,EAAE,CAAC,CAAC;YAC/C,eAAM,CAAC,KAAK,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,qBAAqB,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QAEvD,iDAAiD;QACjD,MAAM,QAAQ,GAAG,IAAI,yBAAc,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,MAAM,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,IAAI,CAAC,kDAAkD,CAAC,CAAC,CAAC;QAC9E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,oDAAoD,CAAC,CAAC,CAAC;YAChF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAElB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,eAAM,CAAC,KAAK,CAAC,wBAAwB,KAAK,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const login_1 = require("./commands/login");
|
|
10
10
|
const logout_1 = require("./commands/logout");
|
|
11
11
|
const whoami_1 = require("./commands/whoami");
|
|
12
|
-
const
|
|
12
|
+
const biofiles_1 = require("./commands/biofiles");
|
|
13
13
|
const download_with_consent_1 = require("./commands/download-with-consent");
|
|
14
14
|
const upload_1 = require("./commands/upload");
|
|
15
15
|
const mount_1 = require("./commands/mount");
|
|
@@ -25,14 +25,17 @@ const status_1 = require("./commands/job/status");
|
|
|
25
25
|
const results_1 = require("./commands/job/results");
|
|
26
26
|
const list_2 = require("./commands/job/list");
|
|
27
27
|
const pipelines_1 = require("./commands/job/pipelines");
|
|
28
|
+
const list_3 = require("./commands/labs/list");
|
|
29
|
+
const share_1 = require("./commands/share");
|
|
30
|
+
const verify_1 = require("./commands/verify");
|
|
28
31
|
const logger_1 = require("./lib/utils/logger");
|
|
29
32
|
const program = new commander_1.Command();
|
|
30
33
|
// Set up the CLI
|
|
31
34
|
program
|
|
32
35
|
.name('biofs')
|
|
33
36
|
.description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
|
|
34
|
-
.version('1.8.
|
|
35
|
-
.option('--debug', 'Enable debug output
|
|
37
|
+
.version('1.8.3')
|
|
38
|
+
.option('--debug', 'Enable debug output')
|
|
36
39
|
.hook('preAction', (thisCommand) => {
|
|
37
40
|
// Set global debug flag if --debug is passed
|
|
38
41
|
const opts = thisCommand.opts();
|
|
@@ -87,22 +90,24 @@ program
|
|
|
87
90
|
process.exit(1);
|
|
88
91
|
}
|
|
89
92
|
});
|
|
90
|
-
//
|
|
93
|
+
// BioFiles command - Comprehensive discovery across all GenoBank data sources
|
|
91
94
|
program
|
|
92
|
-
.command('
|
|
95
|
+
.command('biofiles')
|
|
96
|
+
.alias('files') // Keep 'files' as alias for backward compatibility
|
|
93
97
|
.alias('ls')
|
|
94
|
-
.description('
|
|
98
|
+
.description('Discover all your BioFiles from GenoBank ecosystem (Story Protocol, Avalanche, S3, BioIP)')
|
|
95
99
|
.option('--filter <type>', 'Filter by file type (vcf, fastq, bam, pdf, etc.)')
|
|
96
|
-
.option('--source <source>', 'Filter by source (
|
|
100
|
+
.option('--source <source>', 'Filter by source (story, avalanche, s3, biofs)')
|
|
97
101
|
.option('--json', 'Output as JSON')
|
|
98
102
|
.option('--refresh', 'Clear cache and fetch fresh data')
|
|
99
103
|
.option('--verbose', 'Show debug information')
|
|
104
|
+
.option('--debug', 'Show detailed debug logs')
|
|
100
105
|
.action(async (options) => {
|
|
101
106
|
try {
|
|
102
|
-
await (0,
|
|
107
|
+
await (0, biofiles_1.filesCommand)(options);
|
|
103
108
|
}
|
|
104
109
|
catch (error) {
|
|
105
|
-
logger_1.Logger.error(`Error
|
|
110
|
+
logger_1.Logger.error(`Error discovering BioFiles: ${error}`);
|
|
106
111
|
process.exit(1);
|
|
107
112
|
}
|
|
108
113
|
});
|
|
@@ -350,6 +355,58 @@ jobCmd
|
|
|
350
355
|
process.exit(1);
|
|
351
356
|
}
|
|
352
357
|
});
|
|
358
|
+
// Lab Registry - List approved research labs
|
|
359
|
+
program
|
|
360
|
+
.command('labnfts')
|
|
361
|
+
.alias('labs')
|
|
362
|
+
.description('List approved research labs authorized to receive BioNFT-licensed data')
|
|
363
|
+
.option('--filter <specialization>', 'Filter by lab specialization (e.g., cancer, rare-disease)')
|
|
364
|
+
.option('--location <location>', 'Filter by location')
|
|
365
|
+
.option('--json', 'Output as JSON')
|
|
366
|
+
.option('--verbose', 'Show detailed lab information')
|
|
367
|
+
.action(async (options) => {
|
|
368
|
+
try {
|
|
369
|
+
await (0, list_3.labNFTsCommand)(options);
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
logger_1.Logger.error(`Failed to fetch labs: ${error}`);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
// Share - GDPR-compliant sharing with dual NFT minting
|
|
377
|
+
program
|
|
378
|
+
.command('share <biocid_or_filename>')
|
|
379
|
+
.description('Share biofile with approved lab (mints dual NFT: BioCID + Story IP)')
|
|
380
|
+
.requiredOption('--lab <wallet_address>', 'Lab wallet address (use "biofs labnfts" to list approved labs)')
|
|
381
|
+
.option('--license <type>', 'License type: non-commercial (default), commercial, commercial-remix', 'non-commercial')
|
|
382
|
+
.option('--skip-sequentias', 'Skip BioCID minting on Sequentias (if already minted)')
|
|
383
|
+
.option('--skip-story', 'Skip Story Protocol registration (if already registered)')
|
|
384
|
+
.option('--verbose', 'Show detailed progress')
|
|
385
|
+
.option('--debug', 'Show debug information')
|
|
386
|
+
.action(async (biocidOrFilename, options) => {
|
|
387
|
+
try {
|
|
388
|
+
await (0, share_1.shareCommand)(biocidOrFilename, options);
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
logger_1.Logger.error(`Share failed: ${error}`);
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
// Verify - DNA fingerprint verification
|
|
396
|
+
program
|
|
397
|
+
.command('verify <biocid_or_filename> <local_file>')
|
|
398
|
+
.description('Verify file integrity using DNA fingerprint (Bloom filter)')
|
|
399
|
+
.option('--verbose', 'Show detailed information')
|
|
400
|
+
.option('--json', 'Output as JSON')
|
|
401
|
+
.action(async (biocidOrFilename, localFile, options) => {
|
|
402
|
+
try {
|
|
403
|
+
await (0, verify_1.verifyCommand)(biocidOrFilename, localFile, options);
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
logger_1.Logger.error(`Verification failed: ${error}`);
|
|
407
|
+
process.exit(1);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
353
410
|
// Help command
|
|
354
411
|
program
|
|
355
412
|
.command('help [command]')
|
|
@@ -370,42 +427,39 @@ program
|
|
|
370
427
|
});
|
|
371
428
|
// Show welcome message if no command
|
|
372
429
|
if (process.argv.length === 2) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
console.log('');
|
|
376
|
-
console.log(chalk_1.default.cyan('
|
|
377
|
-
console.log(
|
|
378
|
-
console.log(chalk_1.default.
|
|
379
|
-
console.log(chalk_1.default.
|
|
380
|
-
console.log(chalk_1.default.
|
|
381
|
-
console.log(chalk_1.default.
|
|
382
|
-
console.log(chalk_1.default.
|
|
383
|
-
console.log(chalk_1.default.
|
|
384
|
-
console.log(chalk_1.default.
|
|
385
|
-
console.log(chalk_1.default.
|
|
386
|
-
console.log(chalk_1.default.
|
|
387
|
-
console.log('');
|
|
388
|
-
console.log(chalk_1.default.
|
|
389
|
-
console.log(` ${chalk_1.default.green('
|
|
390
|
-
console.log(` ${chalk_1.default.green('
|
|
391
|
-
console.log(` ${chalk_1.default.green('
|
|
392
|
-
console.log(
|
|
393
|
-
console.log(` ${chalk_1.default.
|
|
394
|
-
console.log(` ${chalk_1.default.
|
|
395
|
-
console.log('');
|
|
396
|
-
console.log(chalk_1.default.
|
|
397
|
-
console.log(` ${chalk_1.default.cyan('access
|
|
398
|
-
console.log(` ${chalk_1.default.cyan('access
|
|
399
|
-
console.log(
|
|
400
|
-
console.log(` ${chalk_1.default.cyan('
|
|
401
|
-
console.log('');
|
|
402
|
-
console.log(chalk_1.default.
|
|
403
|
-
console.log(` ${chalk_1.default.cyan('job
|
|
404
|
-
console.log(` ${chalk_1.default.cyan('job
|
|
405
|
-
console.log(`
|
|
406
|
-
console.log('');
|
|
407
|
-
console.log(`${chalk_1.default.gray('Run')} ${chalk_1.default.cyan('biofs help <command>')} ${chalk_1.default.gray('for detailed usage.')}`);
|
|
408
|
-
console.log('');
|
|
430
|
+
console.log(chalk_1.default.cyan('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
431
|
+
console.log(chalk_1.default.cyan('ā BioFS CLI v1.8.3 ā'));
|
|
432
|
+
console.log(chalk_1.default.cyan('ā BioNFT-Gated S3 CLI ā'));
|
|
433
|
+
console.log(chalk_1.default.cyan('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n'));
|
|
434
|
+
console.log('Available commands:');
|
|
435
|
+
console.log(` ${chalk_1.default.green('login')} - Authenticate with Web3 wallet`);
|
|
436
|
+
console.log(` ${chalk_1.default.green('logout')} - Clear credentials`);
|
|
437
|
+
console.log(` ${chalk_1.default.green('whoami')} - Show current wallet`);
|
|
438
|
+
console.log(` ${chalk_1.default.green('biofiles')} - List your BioFiles (all sources)`);
|
|
439
|
+
console.log(` ${chalk_1.default.green('download')} - Download files (GDPR consent)`);
|
|
440
|
+
console.log(` ${chalk_1.default.green('mount')} - Mount all files (GDPR consent)`);
|
|
441
|
+
console.log(` ${chalk_1.default.green('upload')} - Upload files`);
|
|
442
|
+
console.log(` ${chalk_1.default.green('tokenize')} - Tokenize as BioIP NFT`);
|
|
443
|
+
console.log(` ${chalk_1.default.green('labnfts')} - List approved research labs`);
|
|
444
|
+
console.log(` ${chalk_1.default.green('share')} - Share with lab (dual NFT)`);
|
|
445
|
+
console.log(` ${chalk_1.default.green('verify')} - Verify file integrity (Bloom filter)`);
|
|
446
|
+
console.log(` ${chalk_1.default.green('access')} - Manage BioNFT access control`);
|
|
447
|
+
console.log(` ${chalk_1.default.green('job')} - Manage research jobs (BioOS)`);
|
|
448
|
+
console.log(` ${chalk_1.default.green('help')} - Show help\n`);
|
|
449
|
+
console.log('Access control subcommands:');
|
|
450
|
+
console.log(` ${chalk_1.default.cyan('access request')} <biocid> - Request access to asset`);
|
|
451
|
+
console.log(` ${chalk_1.default.cyan('access grant')} <biocid> <wallet> - Grant access (owner)`);
|
|
452
|
+
console.log(` ${chalk_1.default.cyan('access revoke')} <biocid> <wallet> - Revoke access (owner)`);
|
|
453
|
+
console.log(` ${chalk_1.default.cyan('access list')} [biocid] - List permittees or permissions`);
|
|
454
|
+
console.log(` ${chalk_1.default.cyan('access check')} <biocid> - Check your access level`);
|
|
455
|
+
console.log(` ${chalk_1.default.cyan('access revoke-consent')} [ip_id] - Revoke YOUR consent (GDPR)\n`);
|
|
456
|
+
console.log('Research job subcommands (BioOS):');
|
|
457
|
+
console.log(` ${chalk_1.default.cyan('job create')} "<prompt>" <file> - Create research job`);
|
|
458
|
+
console.log(` ${chalk_1.default.cyan('job status')} <job_id> - Check job status`);
|
|
459
|
+
console.log(` ${chalk_1.default.cyan('job results')} <job_id> - Get job results`);
|
|
460
|
+
console.log(` ${chalk_1.default.cyan('job list')} - List all jobs`);
|
|
461
|
+
console.log(` ${chalk_1.default.cyan('job pipelines')} - List pipeline templates\n`);
|
|
462
|
+
console.log(`Run ${chalk_1.default.cyan('biofs help <command>')} for detailed usage.\n`);
|
|
409
463
|
}
|
|
410
464
|
else {
|
|
411
465
|
// Parse command line arguments
|