pontus-x_cli 0.0.7 → 1.0.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 +559 -157
- package/bin/dev.js +7 -0
- package/bin/run.js +8 -0
- package/dist/commands/access.d.ts +9 -0
- package/dist/commands/access.js +23 -0
- package/dist/commands/access.js.map +1 -0
- package/dist/commands/change-price.d.ts +13 -0
- package/dist/commands/change-price.js +49 -0
- package/dist/commands/change-price.js.map +1 -0
- package/dist/commands/check-participant-compliance.d.ts +10 -0
- package/dist/commands/check-participant-compliance.js +54 -0
- package/dist/commands/check-participant-compliance.js.map +1 -0
- package/dist/commands/compute-results.d.ts +12 -0
- package/dist/commands/compute-results.js +40 -0
- package/dist/commands/compute-results.js.map +1 -0
- package/dist/commands/compute-status.d.ts +12 -0
- package/dist/commands/compute-status.js +40 -0
- package/dist/commands/compute-status.js.map +1 -0
- package/dist/commands/compute.d.ts +14 -0
- package/dist/commands/compute.js +66 -0
- package/dist/commands/compute.js.map +1 -0
- package/dist/commands/edit-algo.d.ts +16 -0
- package/dist/commands/edit-algo.js +51 -0
- package/dist/commands/edit-algo.js.map +1 -0
- package/dist/commands/edit-asset-url.d.ts +13 -0
- package/dist/commands/edit-asset-url.js +55 -0
- package/dist/commands/edit-asset-url.js.map +1 -0
- package/dist/commands/edit-trusted-algos.d.ts +13 -0
- package/dist/commands/edit-trusted-algos.js +54 -0
- package/dist/commands/edit-trusted-algos.js.map +1 -0
- package/dist/commands/export-private-key.d.ts +11 -0
- package/dist/commands/export-private-key.js +67 -0
- package/dist/commands/export-private-key.js.map +1 -0
- package/dist/commands/generate-asset-credentials.d.ts +15 -0
- package/dist/commands/generate-asset-credentials.js +59 -0
- package/dist/commands/generate-asset-credentials.js.map +1 -0
- package/dist/commands/generate-did-web.d.ts +10 -0
- package/dist/commands/generate-did-web.js +39 -0
- package/dist/commands/generate-did-web.js.map +1 -0
- package/dist/commands/generate-participant-credentials.d.ts +12 -0
- package/dist/commands/generate-participant-credentials.js +51 -0
- package/dist/commands/generate-participant-credentials.js.map +1 -0
- package/dist/commands/get.d.ts +9 -0
- package/dist/commands/get.js +23 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.js +51 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +6 -0
- package/dist/commands/logout.js +24 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/publish.d.ts +15 -0
- package/dist/commands/publish.js +107 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/revoke.d.ts +12 -0
- package/dist/commands/revoke.js +50 -0
- package/dist/commands/revoke.js.map +1 -0
- package/dist/commands/self-description.d.ts +13 -0
- package/dist/commands/self-description.js +53 -0
- package/dist/commands/self-description.js.map +1 -0
- package/dist/config.d.ts +48 -0
- package/dist/config.js +106 -117
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -444
- package/dist/index.js.map +1 -1
- package/dist/lib/gaia-x_compliance/generate-credentials/index.d.ts +1 -0
- package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/index.js +55 -105
- package/dist/lib/gaia-x_compliance/generate-credentials/index.js.map +1 -0
- package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/templates/participant.hbs +5 -1
- package/dist/lib/publishFromFile.d.ts +2 -0
- package/dist/lib/publishFromFile.js +143 -0
- package/dist/lib/publishFromFile.js.map +1 -0
- package/dist/types/schema.d.ts +2 -0
- package/dist/types/schema.js +8 -0
- package/dist/types/schema.js.map +1 -0
- package/dist/types/schema.json +474 -0
- package/dist/utils/connection.d.ts +13 -0
- package/dist/utils/connection.js +11 -19
- package/dist/utils/connection.js.map +1 -1
- package/oclif.manifest.json +830 -0
- package/package.json +72 -40
- package/dist/aquarius-query/index.js +0 -30
- package/dist/aquarius-query/index.js.map +0 -1
- package/dist/export-key-as-json/index.js +0 -27
- package/dist/export-key-as-json/index.js.map +0 -1
- package/dist/gaia-x_compliance/generate-credentials/index.js.map +0 -1
- package/dist/gaia-x_compliance/generate-did-web/index.js +0 -14
- package/dist/gaia-x_compliance/generate-did-web/index.js.map +0 -1
- package/dist/publish/samples/algo/index.js +0 -62
- package/dist/publish/samples/algo/index.js.map +0 -1
- package/dist/publish/samples/basic-predictor/index.js +0 -83
- package/dist/publish/samples/basic-predictor/index.js.map +0 -1
- package/dist/publish/samples/data/index.js +0 -55
- package/dist/publish/samples/data/index.js.map +0 -1
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/package-version.js +0 -22
- package/dist/utils/package-version.js.map +0 -1
- package/dist/utils/publish-script-runner.js +0 -60
- package/dist/utils/publish-script-runner.js.map +0 -1
- /package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/templates/dataset.hbs +0 -0
- /package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/templates/lrn-request.hbs +0 -0
- /package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/templates/service.hbs +0 -0
- /package/dist/{gaia-x_compliance → lib/gaia-x_compliance}/generate-credentials/templates/tandc.hbs +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ExportPrivateKey extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: Command.Example[];
|
|
5
|
+
static flags: {
|
|
6
|
+
password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
privateKey: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
filepath: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const ethereumjs_wallet_1 = __importDefault(require("ethereumjs-wallet"));
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
10
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
11
|
+
class ExportPrivateKey extends core_1.Command {
|
|
12
|
+
async run() {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const { flags } = await this.parse(ExportPrivateKey);
|
|
15
|
+
if (flags.privateKey && flags.privateKey.startsWith('0x')) {
|
|
16
|
+
flags.privateKey = flags.privateKey.slice(2);
|
|
17
|
+
}
|
|
18
|
+
const pk = (_a = flags.privateKey) !== null && _a !== void 0 ? _a : readline_sync_1.default.question('\nExporting your private key as a JSON file... \n' +
|
|
19
|
+
'First, get a copy of your private key from Metamask.\n' +
|
|
20
|
+
'\t 1.) On the upper right menu, select "Account details", then "Show private key". \n' +
|
|
21
|
+
'\t 2.) After providing your MetaMask password and revealing, click the button to copy it. \n' +
|
|
22
|
+
'\t 3.) Then, please, paste your private key here: ', { hideEchoBack: true });
|
|
23
|
+
const pkBuffer = Buffer.from(pk, 'hex');
|
|
24
|
+
const account = ethereumjs_wallet_1.default.fromPrivateKey(pkBuffer);
|
|
25
|
+
const password = (_b = flags.password) !== null && _b !== void 0 ? _b : readline_sync_1.default.question('Finally, to securely store your private key, please, enter a password to encrypt it: ', {
|
|
26
|
+
hideEchoBack: true,
|
|
27
|
+
});
|
|
28
|
+
const address = account.getAddress().toString('hex');
|
|
29
|
+
console.log(`Generating encrypted file to store your private key, which corresponds to you account ${address}`);
|
|
30
|
+
account
|
|
31
|
+
.toV3(password, {
|
|
32
|
+
kdf: 'scrypt',
|
|
33
|
+
n: 1 << 14, // cost factor (default is 2**18)
|
|
34
|
+
r: 8,
|
|
35
|
+
p: 1,
|
|
36
|
+
dklen: 32,
|
|
37
|
+
salt: crypto_1.default.randomBytes(32),
|
|
38
|
+
})
|
|
39
|
+
.then((value) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const file = (_a = flags.filepath) !== null && _a !== void 0 ? _a : `${address}.json`;
|
|
42
|
+
node_fs_1.default.writeFileSync(file, JSON.stringify(value));
|
|
43
|
+
console.log(`Your encrypted private key has been saved to ${file}\n`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
ExportPrivateKey.description = 'Export your private key as a JSON file, to use later with the login command or for Pontus-X portals automation';
|
|
48
|
+
ExportPrivateKey.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
49
|
+
ExportPrivateKey.flags = {
|
|
50
|
+
password: core_1.Flags.string({
|
|
51
|
+
char: 'p',
|
|
52
|
+
description: 'Password to encrypt the private key file',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
privateKey: core_1.Flags.string({
|
|
56
|
+
char: 'k',
|
|
57
|
+
description: 'Your private key',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
filepath: core_1.Flags.string({
|
|
61
|
+
char: 'f',
|
|
62
|
+
description: 'File path to save the encrypted private key (default is <address>.json)',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
exports.default = ExportPrivateKey;
|
|
67
|
+
//# sourceMappingURL=export-private-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-private-key.js","sourceRoot":"","sources":["../../src/commands/export-private-key.ts"],"names":[],"mappings":";;;;;AAAA,sCAA0C;AAC1C,0EAAsC;AACtC,sDAAwB;AACxB,kEAAwC;AACxC,oDAA2B;AAE3B,MAAqB,gBAAiB,SAAQ,cAAO;IAsBnD,KAAK,CAA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AM,IAAI,GAAG,MAAA,KAAK,CAAC,QAAQ,mCAAI,GAAG,OAAO,OAAO,CAAA;YAChD,iBAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;YAC7C,OAAO,CAAC,GAAG,CAAC,gDAAgD,IAAI,IAAI,CAAC,CAAA;QACvE,CAAC,CAAC,CAAA;IACN,CAAC;;AAjEM,4BAAW,GAChB,gHAAgH,CAAA;AAC3G,yBAAQ,GAAsB,CAAC,qCAAqC,CAAC,CAAA;AACrE,sBAAK,GAAG;IACb,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0CAA0C;QACvD,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kBAAkB;QAC/B,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,yEAAyE;QACtF,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAA;kBApBkB,gBAAgB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class GenerateAssetCredentials extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
did: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: Command.Example[];
|
|
8
|
+
static flags: {
|
|
9
|
+
certificate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
didjson: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
participant: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
8
|
+
const generate_credentials_1 = require("../lib/gaia-x_compliance/generate-credentials");
|
|
9
|
+
const connection_1 = require("../utils/connection");
|
|
10
|
+
class GenerateAssetCredentials extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
var _a;
|
|
13
|
+
const { args, flags } = await this.parse(GenerateAssetCredentials);
|
|
14
|
+
this.log(`Retrieving asset metadata for DID: ${args.did}`);
|
|
15
|
+
const { nautilus } = await connection_1.Connection.connect();
|
|
16
|
+
const ddo = await nautilus.getAquariusAsset(args.did);
|
|
17
|
+
this.log(`Asset ${args.did} metadata: \n\n ${JSON.stringify(ddo, null, 2)} \n`);
|
|
18
|
+
try {
|
|
19
|
+
const password = (_a = flags.password) !== null && _a !== void 0 ? _a : readline_sync_1.default.question(`Enter the password for your private key file ${flags.certificate}: `, {
|
|
20
|
+
hideEchoBack: true,
|
|
21
|
+
});
|
|
22
|
+
await (0, generate_credentials_1.generateCredentials)(flags.participant, flags.didjson, flags.certificate, password, ddo);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.error(error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
GenerateAssetCredentials.args = {
|
|
30
|
+
did: core_1.Args.string({ description: 'DID of the asset', required: true }),
|
|
31
|
+
};
|
|
32
|
+
GenerateAssetCredentials.description = 'Generate the Gaia-X credentials for the input DID asset, including its verifiable presentation';
|
|
33
|
+
GenerateAssetCredentials.examples = [
|
|
34
|
+
'<%= config.bin %> <%= command.id %> -p ./CEP.data.json -d ./did.json -c certificate.key did:op:01f8bc1e797a854dc718bd7a802acb07c5fc39f706b03dd454bceb66be6828c6',
|
|
35
|
+
];
|
|
36
|
+
GenerateAssetCredentials.flags = {
|
|
37
|
+
certificate: core_1.Flags.string({
|
|
38
|
+
char: 'c',
|
|
39
|
+
description: 'Path to the certificate.key file',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
didjson: core_1.Flags.string({
|
|
43
|
+
char: 'd',
|
|
44
|
+
description: 'Path to the did.json file',
|
|
45
|
+
required: true,
|
|
46
|
+
}),
|
|
47
|
+
participant: core_1.Flags.string({
|
|
48
|
+
char: 'p',
|
|
49
|
+
description: 'Path to the JSON file including the required participant data',
|
|
50
|
+
required: true,
|
|
51
|
+
}),
|
|
52
|
+
password: core_1.Flags.string({
|
|
53
|
+
char: 'w',
|
|
54
|
+
description: 'Password for the private key file (if not provided, it will be asked interactively)',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
exports.default = GenerateAssetCredentials;
|
|
59
|
+
//# sourceMappingURL=generate-asset-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-asset-credentials.js","sourceRoot":"","sources":["../../src/commands/generate-asset-credentials.ts"],"names":[],"mappings":";;;;;AAAA,sCAAgD;AAChD,kEAAwC;AAExC,wFAAiF;AACjF,oDAA8C;AAE9C,MAAqB,wBAAyB,SAAQ,cAAO;IA+B3D,KAAK,CAAC,GAAG;;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAChE,IAAI,CAAC,GAAG,CAAC,sCAAsC,IAAI,C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QAAQ,EAAE,IAAI;KACf,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,+DAA+D;QAC5E,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,qFAAqF;QAClG,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAA;kBA7BkB,wBAAwB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class GenerateDidWeb extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: Command.Example[];
|
|
5
|
+
static flags: {
|
|
6
|
+
certificate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const did_web_generator_1 = require("@gaia-x/did-web-generator");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
class GenerateDidWeb extends core_1.Command {
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = await this.parse(GenerateDidWeb);
|
|
10
|
+
try {
|
|
11
|
+
const x509 = (0, node_fs_1.readFileSync)(flags.certificate, 'utf8');
|
|
12
|
+
const didJson = await (0, did_web_generator_1.createDidDocument)(flags.domain, (0, node_path_1.basename)(flags.certificate), x509);
|
|
13
|
+
const folder = (0, node_path_1.dirname)(flags.certificate);
|
|
14
|
+
console.log('Writing DID Web document to ' + (0, node_path_1.resolve)(folder, 'did.json'));
|
|
15
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.resolve)(folder, 'did.json'), JSON.stringify(didJson, null, 2));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
this.error(error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
GenerateDidWeb.description = 'Generate a did.json to set up a DID-Web source to publish Gaia-X complaint credentials';
|
|
23
|
+
GenerateDidWeb.examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %> -d <https://compliance.agrospai.udl.cat> -c certificate-chain.crt',
|
|
25
|
+
];
|
|
26
|
+
GenerateDidWeb.flags = {
|
|
27
|
+
certificate: core_1.Flags.string({
|
|
28
|
+
char: 'c',
|
|
29
|
+
description: 'Path to the file with the certificate chain for the DID domain URL',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
domain: core_1.Flags.string({
|
|
33
|
+
char: 'd',
|
|
34
|
+
description: 'URL where the DID-Web document will be hosted',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
exports.default = GenerateDidWeb;
|
|
39
|
+
//# sourceMappingURL=generate-did-web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-did-web.js","sourceRoot":"","sources":["../../src/commands/generate-did-web.ts"],"names":[],"mappings":";;AAAA,iEAA2D;AAC3D,sCAA0C;AAC1C,qCAAmD;AACnD,yCAAoD;AAEpD,MAAqB,cAAe,SAAQ,cAAO;IAkBjD,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAChD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YACpD,MAAM,OAAO,GAAG,MAAM,IAAA,qCAAiB,EAAC,KAAK,CAAC,MAAM,EAAE,IAAA,oBAAQ,EAAC,KAAK,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAA;YACxF,MAAM,MAAM,GAAG,IAAA,mBAAO,EAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YACzC,OAAO,CAAC,GAAG,CAAC,8BAA8B,GAAG,IAAA,mBAAO,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;YACzE,IAAA,uBAAa,EAAC,IAAA,mBAAO,EAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;;AA5BM,0BAAW,GAAG,wFAAwF,CAAA;AACtG,uBAAQ,GAAsB;IACnC,uGAAuG;CACxG,CAAA;AACM,oBAAK,GAAG;IACb,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,oEAAoE;QACjF,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,MAAM,EAAE,YAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,+CAA+C;QAC5D,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAA;kBAhBkB,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class GenerateParticipantCredentials extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: Command.Example[];
|
|
5
|
+
static flags: {
|
|
6
|
+
certificate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
didjson: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
participant: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
8
|
+
const generate_credentials_1 = require("../lib/gaia-x_compliance/generate-credentials");
|
|
9
|
+
class GenerateParticipantCredentials extends core_1.Command {
|
|
10
|
+
async run() {
|
|
11
|
+
var _a;
|
|
12
|
+
const { flags } = await this.parse(GenerateParticipantCredentials);
|
|
13
|
+
try {
|
|
14
|
+
const password = (_a = flags.password) !== null && _a !== void 0 ? _a : readline_sync_1.default.question(`Enter the password for your private key file ${flags.certificate}: `, {
|
|
15
|
+
hideEchoBack: true,
|
|
16
|
+
});
|
|
17
|
+
await (0, generate_credentials_1.generateCredentials)(flags.participant, flags.didjson, flags.certificate, password);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
this.error(error);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
GenerateParticipantCredentials.description = 'Generate the Gaia-X credentials for the participant including their verifiable presentation';
|
|
25
|
+
GenerateParticipantCredentials.examples = [
|
|
26
|
+
'<%= config.bin %> <%= command.id %> -p ./CEP.data.json -d ./did.json -c certificate.key',
|
|
27
|
+
];
|
|
28
|
+
GenerateParticipantCredentials.flags = {
|
|
29
|
+
certificate: core_1.Flags.string({
|
|
30
|
+
char: 'c',
|
|
31
|
+
description: 'Path to the certificate.key file',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
didjson: core_1.Flags.string({
|
|
35
|
+
char: 'd',
|
|
36
|
+
description: 'Path to the did.json file',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
participant: core_1.Flags.string({
|
|
40
|
+
char: 'p',
|
|
41
|
+
description: 'Path to the JSON file including the required participant data',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
password: core_1.Flags.string({
|
|
45
|
+
char: 'w',
|
|
46
|
+
description: 'Password for the private key file (if not provided, it will be asked interactively)',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
exports.default = GenerateParticipantCredentials;
|
|
51
|
+
//# sourceMappingURL=generate-participant-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-participant-credentials.js","sourceRoot":"","sources":["../../src/commands/generate-participant-credentials.ts"],"names":[],"mappings":";;;;;AAAA,sCAA0C;AAC1C,kEAAwC;AAExC,wFAAiF;AAEjF,MAAqB,8BAA+B,SAAQ,cAAO;IA4BjE,KAAK,CAAC,GAAG;;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QAChE,IAAI,CAAC;YACH,MAAM,QAAQ,GACZ,MAAA,KAAK,CAAC,QAAQ,mCACd,uBAAY,CAAC,QAAQ,CAAC,gDAAgD,KAAK,CAAC,WAAW,IAAI,EAAE;gBAC3F,YAAY,EAAE,IAAI;aACnB,CAAC,CAAA;YACJ,MAAM,IAAA,0CAAmB,EAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;QAC1F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;;AAvCM,0CAAW,GAAG,6FAA6F,CAAA;AAC3G,uCAAQ,GAAsB;IACnC,yFAAyF;CAC1F,CAAA;AACM,oCAAK,GAAG;IACb,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2BAA2B;QACxC,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,WAAW,EAAE,YAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,+DAA+D;QAC5E,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,qFAAqF;QAClG,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAA;kBA1BkB,8BAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Get extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
did: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: Command.Example[];
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const connection_1 = require("../utils/connection");
|
|
5
|
+
class Get extends core_1.Command {
|
|
6
|
+
async run() {
|
|
7
|
+
const { args } = await this.parse(Get);
|
|
8
|
+
const { did } = args;
|
|
9
|
+
this.log(`Retrieving asset metadata for DID: ${did}`);
|
|
10
|
+
const { nautilus } = await connection_1.Connection.connect();
|
|
11
|
+
const aquariusAsset = await nautilus.getAquariusAsset(did);
|
|
12
|
+
this.log(`Asset ${did} metadata: \n\n ${JSON.stringify(aquariusAsset, null, 2)} \n`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
Get.args = {
|
|
16
|
+
did: core_1.Args.string({ description: 'DID of the asset', required: true }),
|
|
17
|
+
};
|
|
18
|
+
Get.description = 'Get the available metadata to the asset with the given DID';
|
|
19
|
+
Get.examples = [
|
|
20
|
+
'<%= config.bin %> <%= command.id %> did:op:ffeee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7a',
|
|
21
|
+
];
|
|
22
|
+
exports.default = Get;
|
|
23
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":";;AAAA,sCAAyC;AAEzC,oDAA8C;AAE9C,MAAqB,GAAI,SAAQ,cAAO;IAStC,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACpC,MAAM,EAAC,GAAG,EAAC,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,GAAG,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAA;QACrD,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,uBAAU,CAAC,OAAO,EAAE,CAAA;QAC7C,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAC1D,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,mBAAmB,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;IACtF,CAAC;;AAfM,QAAI,GAAG;IACZ,GAAG,EAAE,WAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;CACpE,CAAA;AACM,eAAW,GAAG,4DAA4D,CAAA;AAC1E,YAAQ,GAAsB;IACnC,6GAA6G;CAC9G,CAAA;kBAPkB,GAAG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Login extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
keyFile: import("@oclif/core/lib/interfaces").Arg<string, {
|
|
5
|
+
exists?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: Command.Example[];
|
|
10
|
+
static flags: {
|
|
11
|
+
password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
+
const ethereumjs_wallet_1 = __importDefault(require("ethereumjs-wallet"));
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
11
|
+
dotenv_1.default.config();
|
|
12
|
+
class Login extends core_1.Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(Login);
|
|
15
|
+
const keyFileName = args.keyFile;
|
|
16
|
+
const keyStore = JSON.parse((0, node_fs_1.readFileSync)(keyFileName, 'utf8'));
|
|
17
|
+
const password = flags.password === undefined
|
|
18
|
+
? readline_sync_1.default.question(`Enter the password to decrypt the key file ${keyFileName}: `, {
|
|
19
|
+
hideEchoBack: true,
|
|
20
|
+
})
|
|
21
|
+
: flags.password;
|
|
22
|
+
const wallet = await ethereumjs_wallet_1.default.fromV3(keyStore, password);
|
|
23
|
+
this.log('Storing your private key for this session with Pontus-X CLI, do not forget to logout.\n');
|
|
24
|
+
const envConfig = dotenv_1.default.parse((0, node_fs_1.readFileSync)('.env', 'utf8'));
|
|
25
|
+
envConfig.PRIVATE_KEY = wallet.getPrivateKeyString();
|
|
26
|
+
const updatedEnvConfig = Object.entries(envConfig)
|
|
27
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
28
|
+
.join('\n');
|
|
29
|
+
(0, node_fs_1.writeFileSync)('.env', updatedEnvConfig, 'utf8');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
Login.args = {
|
|
33
|
+
keyFile: core_1.Args.file({
|
|
34
|
+
description: 'Path to the keyFile.json',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
Login.description = 'Login to retrieve your private key from a JSON key store and store it in .env';
|
|
39
|
+
Login.examples = [
|
|
40
|
+
'<%= config.bin %> <%= command.id %> d999baae98ac5246568fd726be8832c49626867d.json',
|
|
41
|
+
];
|
|
42
|
+
Login.flags = {
|
|
43
|
+
password: core_1.Flags.string({
|
|
44
|
+
char: 'p',
|
|
45
|
+
description: 'Password to decrypt the key file',
|
|
46
|
+
env: 'PASSWORD',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
exports.default = Login;
|
|
51
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":";;;;;AAAA,sCAAgD;AAChD,oDAA2B;AAC3B,0EAAsC;AACtC,qCAAmD;AACnD,kEAAwC;AAExC,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAqB,KAAM,SAAQ,cAAO;IAoBxC,KAAK,CAAC,GAAG;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cAAQ,GAAsB;IACnC,mFAAmF;CACpF,CAAA;AACM,WAAK,GAAG;IACb,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAA;kBAlBkB,KAAK"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
dotenv_1.default.config();
|
|
10
|
+
class Logout extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
const envConfig = dotenv_1.default.parse((0, node_fs_1.readFileSync)('.env', 'utf8'));
|
|
13
|
+
delete envConfig.PRIVATE_KEY;
|
|
14
|
+
const updatedEnvConfig = Object.entries(envConfig)
|
|
15
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
16
|
+
.join('\n');
|
|
17
|
+
(0, node_fs_1.writeFileSync)('.env', updatedEnvConfig, 'utf8');
|
|
18
|
+
this.log('Logged out and removed PRIVATE_KEY from .env');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
Logout.description = 'Logout to remove your private key from .env file';
|
|
22
|
+
Logout.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
23
|
+
exports.default = Logout;
|
|
24
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":";;;;;AAAA,sCAAmC;AACnC,oDAA2B;AAC3B,qCAAmD;AAEnD,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAqB,MAAO,SAAQ,cAAO;IAIzC,KAAK,CAAC,GAAG;QACP,MAAM,SAAS,GAAG,gBAAM,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QAC5D,OAAO,SAAS,CAAC,WAAW,CAAA;QAC5B,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;aAC/C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;aACxC,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,IAAA,uBAAa,EAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAA;QAC/C,IAAI,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAA;IAC1D,CAAC;;AAXM,kBAAW,GAAG,kDAAkD,CAAA;AAChE,eAAQ,GAAsB,CAAC,qCAAqC,CAAC,CAAA;kBAFzD,MAAM"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Publish extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
path: import("@oclif/core/lib/interfaces").Arg<string, {
|
|
5
|
+
exists?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: Command.Example[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
provider: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<string | void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const core_1 = require("@oclif/core");
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const vm = __importStar(require("node:vm"));
|
|
39
|
+
const ts = __importStar(require("typescript"));
|
|
40
|
+
const publishFromFile_1 = require("../lib/publishFromFile");
|
|
41
|
+
const connection_1 = require("../utils/connection");
|
|
42
|
+
async function invokeFunctionFromFile(filePath, functionName, ...args) {
|
|
43
|
+
// Read the TypeScript file content
|
|
44
|
+
const tsContent = fs.readFileSync(filePath, 'utf8');
|
|
45
|
+
// Transpile TypeScript to JavaScript
|
|
46
|
+
const jsContent = ts.transpileModule(tsContent, {
|
|
47
|
+
compilerOptions: { module: ts.ModuleKind.CommonJS },
|
|
48
|
+
}).outputText;
|
|
49
|
+
// Create a new context for the script
|
|
50
|
+
const script = new vm.Script(jsContent);
|
|
51
|
+
const context = vm.createContext({ console, exports, module, require });
|
|
52
|
+
// Run the script in the context
|
|
53
|
+
script.runInContext(context);
|
|
54
|
+
// Invoke the function by name
|
|
55
|
+
if (typeof context[functionName] === 'function') {
|
|
56
|
+
return context[functionName](...args);
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`Function ${functionName} not found in ${filePath}`);
|
|
59
|
+
}
|
|
60
|
+
class Publish extends core_1.Command {
|
|
61
|
+
async run() {
|
|
62
|
+
const { args, flags } = await this.parse(Publish);
|
|
63
|
+
const connection = await connection_1.Connection.connect();
|
|
64
|
+
this.log(`Publishing asset ${args.path} in provider ${flags.provider} from wallet ${connection.wallet.address}`);
|
|
65
|
+
try {
|
|
66
|
+
if (args.path.endsWith('.ts')) {
|
|
67
|
+
const dirPath = args.path.split('/').slice(0, -1).join('/');
|
|
68
|
+
await invokeFunctionFromFile(args.path, 'publish', dirPath, connection, flags.provider, flags['dry-run']);
|
|
69
|
+
}
|
|
70
|
+
else if (args.path.endsWith('.json') || args.path.endsWith('.yaml')) {
|
|
71
|
+
return await (0, publishFromFile_1.publishFromFile)(args.path, flags.provider, connection, flags['dry-run']);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.error('The provided file must be a .json/.yaml or .ts file');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
this.error(error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Publish.args = {
|
|
83
|
+
path: core_1.Args.directory({
|
|
84
|
+
description: 'Path to the JSON/YAML or TS file describing the asset to publish',
|
|
85
|
+
required: true,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
Publish.description = 'Publish the asset as instructed in the provided script folder.';
|
|
89
|
+
Publish.examples = [
|
|
90
|
+
'<%= config.bin %> <%= command.id %> samples/publish/algo/spec.json',
|
|
91
|
+
'<%= config.bin %> <%= command.id %> samples/publish/algo/spec.yaml',
|
|
92
|
+
'<%= config.bin %> <%= command.id %> samples/publish/algo/index.ts',
|
|
93
|
+
];
|
|
94
|
+
Publish.flags = {
|
|
95
|
+
'dry-run': core_1.Flags.boolean({
|
|
96
|
+
default: false,
|
|
97
|
+
description: 'Dry run the publishing process',
|
|
98
|
+
}),
|
|
99
|
+
provider: core_1.Flags.string({
|
|
100
|
+
char: 'p',
|
|
101
|
+
description: 'The Provider URL',
|
|
102
|
+
required: true,
|
|
103
|
+
default: 'https://provider.agrospai.udl.cat',
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
exports.default = Publish;
|
|
107
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAgD;AAChD,4CAA6B;AAC7B,4CAA6B;AAC7B,+CAAgC;AAChC,4DAAsD;AACtD,oDAA8C;AAE9C,KAAK,UAAU,sBAAsB,CAAC,QAAgB,EAAE,YAAoB,EAAE,GAAG,IAAW;IAC1F,mCAAmC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAEnD,qCAAqC;IACrC,MAAM,SAAS,GAAG,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE;QAC9C,eAAe,EAAE,EAAC,MAAM,EA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
|
+
static args: {
|
|
4
|
+
dids: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static flags: {
|
|
7
|
+
yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: Command.Example[];
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
const nautilus_1 = require("@deltadao/nautilus");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const readline_sync_1 = __importDefault(require("readline-sync"));
|
|
9
|
+
const connection_1 = require("../utils/connection");
|
|
10
|
+
class Revoke extends core_1.Command {
|
|
11
|
+
async run() {
|
|
12
|
+
const { args, flags } = await this.parse(Revoke);
|
|
13
|
+
const dids = args.dids.split(' ');
|
|
14
|
+
const connection = await connection_1.Connection.connect();
|
|
15
|
+
if (flags.yes || readline_sync_1.default.keyInYNStrict(`Revoke assets ${dids.join(', ')}? `)) {
|
|
16
|
+
try {
|
|
17
|
+
for (const did of dids) {
|
|
18
|
+
const aquariusAsset = await connection.nautilus.getAquariusAsset(did);
|
|
19
|
+
this.log('Sending transaction to revoke asset...');
|
|
20
|
+
const tx = await connection.nautilus.setAssetLifecycleState(aquariusAsset, nautilus_1.LifecycleStates.REVOKED_BY_PUBLISHER);
|
|
21
|
+
this.log(`Asset revoked, transaction: ${connection.networkConfig.explorerUri}/tx/${tx.transactionHash}\n`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.error(`Error revoking asset: ${error}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
Revoke.args = {
|
|
31
|
+
dids: core_1.Args.string({
|
|
32
|
+
description: 'DIDs to revoke',
|
|
33
|
+
multiple: true,
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
Revoke.flags = {
|
|
38
|
+
yes: core_1.Flags.boolean({
|
|
39
|
+
char: 'y',
|
|
40
|
+
description: 'Skip confirmation prompt',
|
|
41
|
+
required: false,
|
|
42
|
+
default: false,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
Revoke.description = 'Publisher revocation of one or more owned DIDs';
|
|
46
|
+
Revoke.examples = [
|
|
47
|
+
'<%= config.bin %> <%= command.id %> did:op:ffeee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7a did:op:abcee8c8f19328985ef6743b08e61ef89d5141027fd47612e32e7900cacd2b7b',
|
|
48
|
+
];
|
|
49
|
+
exports.default = Revoke;
|
|
50
|
+
//# sourceMappingURL=revoke.js.map
|