@axinom/mosaic-cli 0.7.2-rc.3 → 0.8.0-rc.0
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/dist/cli/index.js +0 -2
- package/dist/cli/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/commands/encrypt-encoding-secret/encrypt-encoding-secret-options.d.ts +0 -6
- package/dist/commands/encrypt-encoding-secret/encrypt-encoding-secret-options.js +0 -3
- package/dist/commands/encrypt-encoding-secret/encrypt-encoding-secret-options.js.map +0 -1
- package/dist/commands/encrypt-encoding-secret/generate-encrypted-encoding-secret.d.ts +0 -2
- package/dist/commands/encrypt-encoding-secret/generate-encrypted-encoding-secret.js +0 -41
- package/dist/commands/encrypt-encoding-secret/generate-encrypted-encoding-secret.js.map +0 -1
- package/dist/commands/encrypt-encoding-secret/index.d.ts +0 -3
- package/dist/commands/encrypt-encoding-secret/index.js +0 -64
- package/dist/commands/encrypt-encoding-secret/index.js.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.run = void 0;
|
|
4
4
|
const yargs = require("yargs");
|
|
5
5
|
const apply_templates_1 = require("../commands/apply-templates");
|
|
6
|
-
const encrypt_encoding_secret_1 = require("../commands/encrypt-encoding-secret");
|
|
7
6
|
const get_access_token_1 = require("../commands/get-access-token");
|
|
8
7
|
const msg_codegen_1 = require("../commands/msg-codegen");
|
|
9
8
|
const pg_dump_1 = require("../commands/pg-dump");
|
|
@@ -38,7 +37,6 @@ const run = () => {
|
|
|
38
37
|
.command(publish_schema_to_db_1.publishSchemaToDb)
|
|
39
38
|
.command(pg_dump_1.pgDump)
|
|
40
39
|
.command(msg_codegen_1.msgCodegen)
|
|
41
|
-
.command(encrypt_encoding_secret_1.encryptEncodingSecret)
|
|
42
40
|
.demandCommand()
|
|
43
41
|
.help()
|
|
44
42
|
.epilog(`For more information, visit https://portal.axinom.com.`).argv;
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iEAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iEAA6D;AAC7D,mEAA8D;AAC9D,yDAAqD;AACrD,iDAA6C;AAC7C,2EAAqE;AAE9D,MAAM,GAAG,GAAG,GAAS,EAAE;IAC5B,KAAK;SACF,UAAU,CAAC,QAAQ,CAAC;SACpB,GAAG,EAAE;SACL,OAAO,CACN,iBAAiB,EACjB,+CAA+C,EAC/C,CAAC,KAAK,EAAE,EAAE;QACR,KAAK;aACF,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EACN,gHAAgH;YAClH,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,KAAK,EAAE,GAAG;YACV,QAAQ,EACN,2EAA2E;YAC7E,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,QAAQ,EACN,4FAA4F;YAC9F,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC,EACD,gCAAc,CACf;SACA,OAAO,CAAC,iCAAc,CAAC;SACvB,OAAO,CAAC,wCAAiB,CAAC;SAC1B,OAAO,CAAC,gBAAM,CAAC;SACf,OAAO,CAAC,wBAAU,CAAC;SACnB,aAAa,EAAE;SACf,IAAI,EAAE;SACN,MAAM,CAAC,wDAAwD,CAAC,CAAC,IAAI,CAAC;AAC3E,CAAC,CAAC;AAzCW,QAAA,GAAG,OAyCd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-rc.0",
|
|
4
4
|
"description": "The Axinom Mosaic CLI",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@asyncapi/modelina": "^0.43.0",
|
|
30
30
|
"@asyncapi/parser": "^1.13.2",
|
|
31
|
-
"@axinom/mosaic-id-link-be": "^0.5.2-rc.
|
|
32
|
-
"@axinom/mosaic-service-common": "^0.13.1-rc.
|
|
31
|
+
"@axinom/mosaic-id-link-be": "^0.5.2-rc.4",
|
|
32
|
+
"@axinom/mosaic-service-common": "^0.13.1-rc.4",
|
|
33
33
|
"@stoplight/spectral": "^5.9.1",
|
|
34
34
|
"chalk": "^4.1.0",
|
|
35
35
|
"diff": "^5.0.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "0fb5bb371564aec71a2228a332fcdccf05954a4c"
|
|
62
62
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encrypt-encoding-secret-options.js","sourceRoot":"","sources":["../../../src/commands/encrypt-encoding-secret/encrypt-encoding-secret-options.ts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateEncryptedEncodingSecret = exports.downloadCertificate = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const mosaic_service_common_1 = require("@axinom/mosaic-service-common");
|
|
6
|
-
const chalk = require("chalk");
|
|
7
|
-
const crypto = require("crypto");
|
|
8
|
-
const os_1 = require("os");
|
|
9
|
-
const request = require("superagent");
|
|
10
|
-
const downloadCertificate = (encodingUrl, tenantSecret) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
11
|
-
const url = new URL(encodingUrl);
|
|
12
|
-
const result = yield request
|
|
13
|
-
.get(`https://${url.host}/certificate`)
|
|
14
|
-
.set('Authorization', `Tenant-Auth ${tenantSecret}`)
|
|
15
|
-
.send();
|
|
16
|
-
return result.text;
|
|
17
|
-
});
|
|
18
|
-
exports.downloadCertificate = downloadCertificate;
|
|
19
|
-
const generateEncryptedEncodingSecret = (secret, publicKey) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
20
|
-
try {
|
|
21
|
-
let key;
|
|
22
|
-
if (publicKey.startsWith('-----')) {
|
|
23
|
-
key = publicKey;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
key = `-----BEGIN CERTIFICATE-----${os_1.EOL}${publicKey}${os_1.EOL}-----END CERTIFICATE-----`;
|
|
27
|
-
}
|
|
28
|
-
const buffer = Buffer.from(secret);
|
|
29
|
-
const encrypted = crypto.publicEncrypt({
|
|
30
|
-
key: key,
|
|
31
|
-
padding: crypto.constants.RSA_PKCS1_PADDING,
|
|
32
|
-
}, buffer);
|
|
33
|
-
console.log(encrypted.toString('base64'));
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
(0, mosaic_service_common_1.assertError)(err);
|
|
37
|
-
console.log(chalk.red('Command failed:'), err.message);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
exports.generateEncryptedEncodingSecret = generateEncryptedEncodingSecret;
|
|
41
|
-
//# sourceMappingURL=generate-encrypted-encoding-secret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-encrypted-encoding-secret.js","sourceRoot":"","sources":["../../../src/commands/encrypt-encoding-secret/generate-encrypted-encoding-secret.ts"],"names":[],"mappings":";;;;AAAA,yEAA4D;AAC5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mCAwB1C"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encryptEncodingSecret = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const chalk = require("chalk");
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const generate_encrypted_encoding_secret_1 = require("./generate-encrypted-encoding-secret");
|
|
8
|
-
exports.encryptEncodingSecret = {
|
|
9
|
-
command: 'encrypt-encoding-secret',
|
|
10
|
-
describe: 'Encrypt a secret with the public key of the Axinom Encoding Service. This way nobody except of the encoding service can decrypt the secret for e.g. the acquisition credentials. It can either download the certificate (if the "url" and "tenantSecret" are provided) or use a local file (if the "certificate" path is provided).',
|
|
11
|
-
builder: (yargs) => yargs
|
|
12
|
-
.option('url', {
|
|
13
|
-
alias: 'u',
|
|
14
|
-
describe: 'The Axinom Encoding Service URL to use ',
|
|
15
|
-
string: true,
|
|
16
|
-
default: 'https://vip-eu-west-1.axinom.com',
|
|
17
|
-
})
|
|
18
|
-
.option('tenantSecret', {
|
|
19
|
-
alias: 't',
|
|
20
|
-
describe: 'The Axinom Encoding tenant API secret',
|
|
21
|
-
string: true,
|
|
22
|
-
})
|
|
23
|
-
.option('certificate', {
|
|
24
|
-
alias: 'c',
|
|
25
|
-
describe: 'Local path to the certificate',
|
|
26
|
-
string: true,
|
|
27
|
-
})
|
|
28
|
-
.option('secret', {
|
|
29
|
-
alias: 's',
|
|
30
|
-
describe: 'The secret that should be encrypted',
|
|
31
|
-
string: true,
|
|
32
|
-
})
|
|
33
|
-
.group(['url', 'tenantSecret'], 'Download the certificate from the Axinom Encoding Service:')
|
|
34
|
-
.group('certificate', 'Use a local certificate from the Axinom Encoding Service:')
|
|
35
|
-
.check((argv) => {
|
|
36
|
-
if (argv.certificate) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (argv.url && argv.tenantSecret) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
throw new Error('Either a local certificate path or the url and tenantSecret must be provided');
|
|
43
|
-
})
|
|
44
|
-
.demandOption('secret')
|
|
45
|
-
.example('yarn mosaic encrypt-encoding-secret -u https://vip-us-west-2.axinom.com -t 23ded9f9-3b53-4647-be13-6a20f8ed8f97 -s MySecret', 'Applies credentials protection based on the US West Encoding Service certificate to the secret value "MySecret".')
|
|
46
|
-
.example('yarn mosaic encrypt-encoding-secret -c c:\\temp\\encoding-cert.pem -s MySecret', 'Applies credentials protection based on a local Encoding Service certificate to the secret value "MySecret".'),
|
|
47
|
-
handler: (options) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
48
|
-
var _a;
|
|
49
|
-
// TODO: revision required for security reasons: offer a way to enter the secret value into the CLI without showing up on the screen.
|
|
50
|
-
if (options._.length > 1) {
|
|
51
|
-
console.log(chalk.red('Error: Additional input parameters are not allowed. Please make sure that passed parameters do not contain spaces. If they do contain spaces - pass the whole parameter string in double quotes.'));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let cert;
|
|
55
|
-
if (options.certificate) {
|
|
56
|
-
cert = yield fs_1.promises.readFile(options.certificate, 'utf8');
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
cert = yield (0, generate_encrypted_encoding_secret_1.downloadCertificate)(options.url, (_a = options.tenantSecret) !== null && _a !== void 0 ? _a : '');
|
|
60
|
-
}
|
|
61
|
-
yield (0, generate_encrypted_encoding_secret_1.generateEncryptedEncodingSecret)(options.secret, cert);
|
|
62
|
-
}),
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/encrypt-encoding-secret/index.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,2BAAqC;AAGrC,6FAG8C;AAEjC,QAAA,qBAAqB,GAG9B;IACF,OAAO,EAA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