@sebastienrousseau/crypto-cli 0.0.7 → 0.0.9

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.
Files changed (59) hide show
  1. package/README.md +325 -3
  2. package/dist/cli.js +37 -196
  3. package/dist/commands/decrypt.command.js +2 -2
  4. package/dist/commands/encrypt.command.js +2 -2
  5. package/dist/commands/generate.command.js +2 -2
  6. package/dist/commands/modern/cbom.command.d.ts +2 -1
  7. package/dist/commands/modern/cbom.command.d.ts.map +1 -1
  8. package/dist/commands/modern/cbom.command.js +99 -146
  9. package/dist/commands/modern/cbom.core.d.ts +5 -0
  10. package/dist/commands/modern/cbom.core.d.ts.map +1 -0
  11. package/dist/commands/modern/cbom.core.js +57 -0
  12. package/dist/commands/modern/encrypt.command.d.ts.map +1 -1
  13. package/dist/commands/modern/encrypt.command.js +42 -63
  14. package/dist/commands/modern/hash.command.d.ts.map +1 -1
  15. package/dist/commands/modern/hash.command.js +1 -1
  16. package/dist/commands/modern/keygen.command.js +1 -1
  17. package/dist/commands/modern/password-hash.command.d.ts.map +1 -1
  18. package/dist/commands/modern/password-hash.command.js +28 -27
  19. package/dist/commands/modern/sign.command.d.ts.map +1 -1
  20. package/dist/commands/modern/sign.command.js +83 -73
  21. package/dist/commands/reformat.command.js +2 -2
  22. package/dist/commands/revoke.command.js +2 -2
  23. package/dist/commands/session.command.js +2 -2
  24. package/dist/commands/sign.command.js +2 -2
  25. package/dist/commands/verify.command.js +2 -2
  26. package/dist/menu.d.ts +12 -0
  27. package/dist/menu.d.ts.map +1 -0
  28. package/dist/menu.js +107 -0
  29. package/dist/program/cbom.d.ts +4 -0
  30. package/dist/program/cbom.d.ts.map +1 -0
  31. package/dist/program/cbom.js +49 -0
  32. package/dist/program/encrypt.d.ts +6 -0
  33. package/dist/program/encrypt.d.ts.map +1 -0
  34. package/dist/program/encrypt.js +73 -0
  35. package/dist/program/hash.d.ts +4 -0
  36. package/dist/program/hash.d.ts.map +1 -0
  37. package/dist/program/hash.js +21 -0
  38. package/dist/program/index.d.ts +7 -0
  39. package/dist/program/index.d.ts.map +1 -0
  40. package/dist/program/index.js +69 -0
  41. package/dist/program/io.d.ts +35 -0
  42. package/dist/program/io.d.ts.map +1 -0
  43. package/dist/program/io.js +65 -0
  44. package/dist/program/keygen.d.ts +4 -0
  45. package/dist/program/keygen.d.ts.map +1 -0
  46. package/dist/program/keygen.js +32 -0
  47. package/dist/program/password.d.ts +4 -0
  48. package/dist/program/password.d.ts.map +1 -0
  49. package/dist/program/password.js +73 -0
  50. package/dist/program/secrets.d.ts +30 -0
  51. package/dist/program/secrets.d.ts.map +1 -0
  52. package/dist/program/secrets.js +70 -0
  53. package/dist/program/sign.d.ts +18 -0
  54. package/dist/program/sign.d.ts.map +1 -0
  55. package/dist/program/sign.js +130 -0
  56. package/dist/program/usage.d.ts +7 -0
  57. package/dist/program/usage.d.ts.map +1 -0
  58. package/dist/program/usage.js +36 -0
  59. package/package.json +28 -36
package/README.md CHANGED
@@ -75,7 +75,23 @@ yarn add @sebastienrousseau/crypto-cli
75
75
 
76
76
  ## Quick Start
77
77
 
78
- Launch the interactive menu:
78
+ Run a subcommand, for scripts and CI:
79
+
80
+ ```bash
81
+ crypto-cli hash --json < file.txt
82
+ crypto-cli hash --algorithm blake3 file.txt
83
+ crypto-cli cbom scan src --output cbom.json
84
+
85
+ openssl rand -hex 32 > secret.key && chmod 600 secret.key
86
+ crypto-cli encrypt --key-file secret.key file.txt > file.txt.sealed
87
+ crypto-cli decrypt --key-file secret.key file.txt.sealed > file.txt.out
88
+
89
+ crypto-cli keygen --algorithm ed25519 --json > signer.json && chmod 600 signer.json
90
+ crypto-cli sign --key-file signer.json file.txt > file.txt.sig
91
+ crypto-cli verify --key-file signer.json --signature-file file.txt.sig file.txt
92
+ ```
93
+
94
+ Run it with no arguments in a terminal for the interactive menu:
79
95
 
80
96
  ```bash
81
97
  cryptocli
@@ -134,8 +150,10 @@ crypto-cli is the command-line interface for the Crypto Service
134
150
  Suite. It offers both legacy OpenPGP commands (key generation,
135
151
  encryption, decryption, signing, verification, revocation) and
136
152
  modern v2 commands using `@noble/*` primitives with post-quantum
137
- algorithm support. All operations run interactively via a guided
138
- prompt menu.
153
+ algorithm support. Hashing, key generation, symmetric encryption,
154
+ signing, password hashing and CBOM scan and audit also run as
155
+ non-interactive subcommands with JSON output; every operation is
156
+ available from the interactive menu.
139
157
 
140
158
  <p align="right"><a href="#contents">Back to Top</a></p>
141
159
 
@@ -164,6 +182,310 @@ prompt menu.
164
182
  | `Modern Sign` | Sign and verify with 8 algorithms including ML-DSA |
165
183
  | `Password Hash` | Hash and verify passwords with 3 Argon2 variants |
166
184
 
185
+ ### Non-interactive commands
186
+
187
+ With arguments, `crypto-cli` runs a subcommand instead of the menu:
188
+
189
+ - `--json` prints the result as one line of JSON on stdout, and
190
+ nothing else goes to stdout.
191
+ - A command that takes a file reads standard input when the file is
192
+ omitted or `-`.
193
+ - Errors, usage and notes go to stderr.
194
+ - Exit codes: `0` success, `1` the operation failed (unreadable input,
195
+ a cryptographic error, a wrong key or modified ciphertext, a
196
+ signature or password that does not verify, an invalid CBOM, a CBOM
197
+ audit with status `FAIL`), `2` usage error (unknown command or
198
+ option, missing or invalid argument, no key or password source, key
199
+ and data both on standard input).
200
+ - With no arguments, the interactive menu starts only when stdin and
201
+ stdout are both terminals; otherwise usage goes to stderr and the
202
+ exit code is `2`.
203
+
204
+ Keys and passwords are never command-line values, which other users
205
+ can see in the process list and shells keep in their history:
206
+
207
+ - `encrypt`, `decrypt`, `sign` and `verify` read the key from
208
+ `--key-file <path>`, or from standard input with `--key-stdin`, in
209
+ which case the data must be a file argument (a run with both on
210
+ standard input exits `2`). `password hash` and `password verify`
211
+ take `--password-file <path>` or `--password-stdin` in the same way
212
+ (one trailing line break is ignored), and otherwise ask for the
213
+ password with a hidden prompt when standard input is a terminal
214
+ (twice for `password hash`).
215
+ - `encrypt` and `decrypt` use XChaCha20-Poly1305 (crypto-lib's
216
+ secretbox). The key is 32 bytes, written as 64 hexadecimal
217
+ characters or raw. `encrypt` prints base64 of the 24-byte nonce,
218
+ the ciphertext and the 16-byte tag; `decrypt` reads that or the
219
+ `encrypt --json` line and writes the plaintext bytes unchanged
220
+ (base64 in its `--json` output).
221
+ - `sign` reads a key pair saved from `keygen --json` (Ed25519,
222
+ Ed448, P-256, P-384 or ML-DSA) and prints the signature in hex.
223
+ `verify` reads the same file, or JSON with only `algorithm` and
224
+ `publicKey`, and prints `valid` or `invalid` (`{"valid": ...}` with
225
+ `--json`), exiting `1` when the signature does not verify.
226
+ - `password hash` uses Argon2id with crypto-lib's defaults (t=3,
227
+ m=64 MiB, p=4) and prints a PHC string; `password verify` reads it
228
+ from a file or standard input.
229
+ - On Linux and macOS, a secret file that its group or other users can
230
+ read gets a warning on stderr (`chmod 600` it); the command still
231
+ runs, because secrets mounted by container platforms are often
232
+ group- or world-readable. Windows has no such mode bits, so nothing
233
+ is checked there.
234
+
235
+ The reference below is generated from the command definitions
236
+ (`pnpm run readme:usage`); a test fails when it is out of date.
237
+
238
+ <!-- cli-usage:start (generated: pnpm run readme:usage) -->
239
+
240
+ #### `crypto-cli`
241
+
242
+ ```text
243
+ Usage: crypto-cli [options] [command]
244
+
245
+ Cryptographic operations from the command line. Run without arguments in a
246
+ terminal for the interactive menu.
247
+
248
+ Options:
249
+ -V, --version print the version
250
+ -h, --help print help
251
+
252
+ Commands:
253
+ hash [options] [file] Hash a file, or standard input when no file is given
254
+ keygen [options] Generate a key pair (the private key is printed to
255
+ stdout)
256
+ encrypt [options] [file] Encrypt with XChaCha20-Poly1305 and print the sealed
257
+ box as base64
258
+ decrypt [options] [file] Decrypt the output of encrypt; exits 1 on a wrong
259
+ key or modified input
260
+ sign [options] [file] Sign a file with a key pair from keygen --json and
261
+ print the signature in hex
262
+ verify [options] [file] Verify a signature from sign; exits 1 when it is not
263
+ valid
264
+ password Hash or verify a password (Argon2id)
265
+ cbom Generate or audit a Cryptographic Bill of Materials
266
+ ```
267
+
268
+ #### `crypto-cli hash`
269
+
270
+ ```text
271
+ Usage: crypto-cli hash [options] [file]
272
+
273
+ Hash a file, or standard input when no file is given
274
+
275
+ Arguments:
276
+ file file to hash; '-' or omitted reads standard input
277
+
278
+ Options:
279
+ -a, --algorithm <name> hash algorithm (choices: "sha256", "sha384", "sha512",
280
+ "sha3-256", "sha3-512", "blake2b", "blake3", default:
281
+ "sha256")
282
+ --json print the result as one line of JSON
283
+ -h, --help print help
284
+ ```
285
+
286
+ #### `crypto-cli keygen`
287
+
288
+ ```text
289
+ Usage: crypto-cli keygen [options]
290
+
291
+ Generate a key pair (the private key is printed to stdout)
292
+
293
+ Options:
294
+ -a, --algorithm <name> key algorithm (choices: "ed25519", "x25519", "ed448",
295
+ "x448", "p256", "p384", "ml-kem-512", "ml-kem-768",
296
+ "ml-kem-1024", "ml-dsa-44", "ml-dsa-65", "ml-dsa-87")
297
+ --kid <id> key ID (default: thumbprint of the public key)
298
+ --use <use> intended key usage (choices: "sig", "enc")
299
+ --json print the key pair as one line of JSON
300
+ -h, --help print help
301
+ ```
302
+
303
+ #### `crypto-cli encrypt`
304
+
305
+ ```text
306
+ Usage: crypto-cli encrypt [options] [file]
307
+
308
+ Encrypt with XChaCha20-Poly1305 and print the sealed box as base64
309
+
310
+ Arguments:
311
+ file file to encrypt; '-' or omitted reads standard input
312
+
313
+ Options:
314
+ --key-file <path> read the key from a file: 32 bytes, as 64 hex characters or
315
+ raw
316
+ --key-stdin read the key from standard input (the data must then be a
317
+ file argument)
318
+ --json print the result as one line of JSON
319
+ -h, --help print help
320
+ ```
321
+
322
+ #### `crypto-cli decrypt`
323
+
324
+ ```text
325
+ Usage: crypto-cli decrypt [options] [file]
326
+
327
+ Decrypt the output of encrypt; exits 1 on a wrong key or modified input
328
+
329
+ Arguments:
330
+ file output of encrypt (base64 or its --json line); '-' or
331
+ omitted reads standard input
332
+
333
+ Options:
334
+ --key-file <path> read the key from a file: 32 bytes, as 64 hex characters or
335
+ raw
336
+ --key-stdin read the key from standard input (the data must then be a
337
+ file argument)
338
+ --json print the result as one line of JSON
339
+ -h, --help print help
340
+ ```
341
+
342
+ #### `crypto-cli sign`
343
+
344
+ ```text
345
+ Usage: crypto-cli sign [options] [file]
346
+
347
+ Sign a file with a key pair from keygen --json and print the signature in hex
348
+
349
+ Arguments:
350
+ file file to sign; '-' or omitted reads standard input
351
+
352
+ Options:
353
+ --key-file <path> read the key pair from a file: keygen --json output
354
+ (ed25519, ed448, p256, p384, ml-dsa-44, ml-dsa-65,
355
+ ml-dsa-87)
356
+ --key-stdin read the key pair from standard input (the data must then
357
+ be a file argument)
358
+ --json print the result as one line of JSON
359
+ -h, --help print help
360
+ ```
361
+
362
+ #### `crypto-cli verify`
363
+
364
+ ```text
365
+ Usage: crypto-cli verify [options] [file]
366
+
367
+ Verify a signature from sign; exits 1 when it is not valid
368
+
369
+ Arguments:
370
+ file file to verify; '-' or omitted reads standard input
371
+
372
+ Options:
373
+ --key-file <path> read the public key from a file: keygen --json
374
+ output, or JSON with algorithm and publicKey
375
+ --key-stdin read the public key from standard input (the data
376
+ must then be a file argument)
377
+ --signature <hex> the signature, in hex
378
+ --signature-file <path> read the signature from a file (sign output or its
379
+ --json line)
380
+ --json print the result as one line of JSON
381
+ -h, --help print help
382
+ ```
383
+
384
+ #### `crypto-cli password`
385
+
386
+ ```text
387
+ Usage: crypto-cli password [options] [command]
388
+
389
+ Hash or verify a password (Argon2id)
390
+
391
+ Options:
392
+ -h, --help print help
393
+
394
+ Commands:
395
+ hash [options] Hash a password with Argon2id (crypto-lib defaults:
396
+ t=3, m=64 MiB, p=4) and print its PHC string
397
+ verify [options] [file] Check a password against a PHC string; exits 1 when
398
+ it does not match
399
+ ```
400
+
401
+ #### `crypto-cli password hash`
402
+
403
+ ```text
404
+ Usage: crypto-cli password hash [options]
405
+
406
+ Hash a password with Argon2id (crypto-lib defaults: t=3, m=64 MiB, p=4) and
407
+ print its PHC string
408
+
409
+ Options:
410
+ --password-file <path> read the password from a file: one trailing line break
411
+ is ignored
412
+ --password-stdin read the password from standard input
413
+ --json print the result as one line of JSON
414
+ -h, --help print help
415
+ ```
416
+
417
+ #### `crypto-cli password verify`
418
+
419
+ ```text
420
+ Usage: crypto-cli password verify [options] [file]
421
+
422
+ Check a password against a PHC string; exits 1 when it does not match
423
+
424
+ Arguments:
425
+ file PHC string (password hash output or its --json line);
426
+ '-' or omitted reads standard input
427
+
428
+ Options:
429
+ --password-file <path> read the password from a file: one trailing line break
430
+ is ignored
431
+ --password-stdin read the password from standard input (the data must
432
+ then be a file argument)
433
+ --json print the result as one line of JSON
434
+ -h, --help print help
435
+ ```
436
+
437
+ #### `crypto-cli cbom`
438
+
439
+ ```text
440
+ Usage: crypto-cli cbom [options] [command]
441
+
442
+ Generate or audit a Cryptographic Bill of Materials
443
+
444
+ Options:
445
+ -h, --help print help
446
+
447
+ Commands:
448
+ scan [options] [directory] Scan source code and print its CBOM
449
+ audit [options] [file] Validate and audit a CBOM; exits 1 when the audit
450
+ status is FAIL
451
+ ```
452
+
453
+ #### `crypto-cli cbom scan`
454
+
455
+ ```text
456
+ Usage: crypto-cli cbom scan [options] [directory]
457
+
458
+ Scan source code and print its CBOM
459
+
460
+ Arguments:
461
+ directory directory or file to scan (default: ".")
462
+
463
+ Options:
464
+ -f, --format <format> CBOM standard (choices: "cyclonedx", "spdx", default:
465
+ "cyclonedx")
466
+ -o, --output <file> write the CBOM to a file, not stdout
467
+ --json print the CBOM as one line of JSON
468
+ -h, --help print help
469
+ ```
470
+
471
+ #### `crypto-cli cbom audit`
472
+
473
+ ```text
474
+ Usage: crypto-cli cbom audit [options] [file]
475
+
476
+ Validate and audit a CBOM; exits 1 when the audit status is FAIL
477
+
478
+ Arguments:
479
+ file CBOM JSON file; '-' or omitted reads standard input
480
+
481
+ Options:
482
+ -o, --output <file> write the audit report to a file, not stdout
483
+ --json print the audit report as one line of JSON
484
+ -h, --help print help
485
+ ```
486
+
487
+ <!-- cli-usage:end -->
488
+
167
489
  <p align="right"><a href="#contents">Back to Top</a></p>
168
490
 
169
491
  ## Configuration
package/dist/cli.js CHANGED
@@ -1,201 +1,42 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const index_1 = require("./commands/index");
8
- const banner_1 = require("./helpers/banner");
9
- const index_2 = require("./constants/index");
10
- const write_utils_1 = require("./utils/write.utils");
11
- const kleur_1 = __importDefault(require("kleur"));
12
- const prompts_1 = __importDefault(require("prompts"));
13
- (0, index_2.language)(index_2.locale);
14
- console.clear();
15
- (0, banner_1.welcome)(index_2.constants.CLI_TITLE);
16
- write_utils_1.writeUtils.writeLn(index_2.constants.CLI_TITLE);
17
- write_utils_1.writeUtils.writeLn("");
18
- write_utils_1.writeUtils.writeLn(index_2.constants.CLI_DESCRIPTION);
19
- write_utils_1.writeUtils.writeLn("");
20
- (async () => {
21
- const response = await (0, prompts_1.default)({
22
- type: "select",
23
- name: index_2.constants.PROMPT_SELECT_TTL,
24
- message: index_2.constants.PROMPT_SELECT_DES + "\n\n",
25
- choices: [
26
- {
27
- title: index_2.constants.CLI_FN_1_TTL,
28
- description: index_2.constants.CLI_FN_1_DES,
29
- value: index_2.constants.CLI_FN_1_TTL,
30
- },
31
- {
32
- title: index_2.constants.CLI_FN_2_TTL,
33
- description: index_2.constants.CLI_FN_2_DES,
34
- value: index_2.constants.CLI_FN_2_TTL,
35
- },
36
- {
37
- title: index_2.constants.CLI_FN_3_TTL,
38
- description: index_2.constants.CLI_FN_3_DES,
39
- value: index_2.constants.CLI_FN_3_TTL,
40
- },
41
- {
42
- title: index_2.constants.CLI_FN_4_TTL,
43
- description: index_2.constants.CLI_FN_4_DES,
44
- value: index_2.constants.CLI_FN_4_TTL,
45
- },
46
- {
47
- title: index_2.constants.CLI_FN_5_TTL,
48
- description: index_2.constants.CLI_FN_5_DES,
49
- value: index_2.constants.CLI_FN_5_TTL,
50
- },
51
- {
52
- title: index_2.constants.CLI_FN_6_TTL,
53
- description: index_2.constants.CLI_FN_6_DES,
54
- value: index_2.constants.CLI_FN_6_TTL,
55
- },
56
- {
57
- title: index_2.constants.CLI_FN_7_TTL,
58
- description: index_2.constants.CLI_FN_7_DES,
59
- value: index_2.constants.CLI_FN_7_TTL,
60
- },
61
- {
62
- title: index_2.constants.CLI_FN_8_TTL,
63
- description: index_2.constants.CLI_FN_8_DES,
64
- value: index_2.constants.CLI_FN_8_TTL,
65
- },
66
- {
67
- title: "Modern Keygen",
68
- description: "Generate keys (Ed25519, ML-DSA, ML-KEM, P-256, etc.)",
69
- value: "Modern Keygen",
70
- },
71
- {
72
- title: "Modern Hash",
73
- description: "Hash data (SHA-2, SHA-3, BLAKE2b, BLAKE3)",
74
- value: "Modern Hash",
75
- },
76
- {
77
- title: "Modern Encrypt",
78
- description: "Encrypt (XChaCha20, AES-GCM, AES-GCM-SIV)",
79
- value: "Modern Encrypt",
80
- },
81
- {
82
- title: "Modern Sign",
83
- description: "Sign/verify (Ed25519, ECDSA, Schnorr, ML-DSA)",
84
- value: "Modern Sign",
85
- },
86
- {
87
- title: "Password Hash",
88
- description: "Hash/verify passwords (Argon2id/i/d)",
89
- value: "Password Hash",
90
- },
91
- {
92
- title: "CBOM",
93
- description: "Generate or audit Cryptographic Bill of Materials",
94
- value: "CBOM",
95
- },
96
- {
97
- title: index_2.constants.CLI_FN_9_TTL,
98
- description: index_2.constants.CLI_FN_9_DES,
99
- value: index_2.constants.CLI_FN_9_TTL,
100
- },
101
- ],
102
- });
103
- switch (response.Selection) {
104
- case index_2.constants.CLI_FN_1_TTL: {
105
- write_utils_1.writeUtils.writeLn("");
106
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
107
- index_1.Command.handleGenerate();
108
- break;
109
- }
110
- case index_2.constants.CLI_FN_2_TTL: {
111
- write_utils_1.writeUtils.writeLn("");
112
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
113
- index_1.Command.handleEncrypt();
114
- break;
115
- }
116
- case index_2.constants.CLI_FN_3_TTL: {
117
- write_utils_1.writeUtils.writeLn("");
118
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
119
- index_1.Command.handleDecrypt();
120
- break;
121
- }
122
- case index_2.constants.CLI_FN_4_TTL: {
123
- write_utils_1.writeUtils.writeLn("");
124
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
125
- index_1.Command.handleReformat();
126
- break;
127
- }
128
- case index_2.constants.CLI_FN_5_TTL: {
129
- write_utils_1.writeUtils.writeLn("");
130
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
131
- index_1.Command.handleRevoke();
132
- break;
133
- }
134
- case index_2.constants.CLI_FN_6_TTL: {
135
- write_utils_1.writeUtils.writeLn("");
136
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
137
- index_1.Command.handleSession();
138
- break;
139
- }
140
- case index_2.constants.CLI_FN_7_TTL: {
141
- write_utils_1.writeUtils.writeLn("");
142
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
143
- index_1.Command.handleSign();
144
- break;
145
- }
146
- case index_2.constants.CLI_FN_8_TTL: {
147
- write_utils_1.writeUtils.writeLn("");
148
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_HDL_1_DES));
149
- index_1.Command.handleVerify();
150
- break;
151
- }
152
- case "Modern Keygen": {
153
- write_utils_1.writeUtils.writeLn("");
154
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Modern Key Generation"));
155
- index_1.Command.handleModernKeygen();
156
- break;
157
- }
158
- case "Modern Hash": {
159
- write_utils_1.writeUtils.writeLn("");
160
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Modern Hashing"));
161
- index_1.Command.handleModernHash();
162
- break;
163
- }
164
- case "Modern Encrypt": {
165
- write_utils_1.writeUtils.writeLn("");
166
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Modern Encryption"));
167
- index_1.Command.handleModernEncrypt();
168
- break;
169
- }
170
- case "Modern Sign": {
171
- write_utils_1.writeUtils.writeLn("");
172
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Modern Signing"));
173
- index_1.Command.handleModernSign();
174
- break;
175
- }
176
- case "Password Hash": {
177
- write_utils_1.writeUtils.writeLn("");
178
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Password Hashing (Argon2)"));
179
- index_1.Command.handlePasswordHash();
180
- break;
181
- }
182
- case "CBOM": {
183
- write_utils_1.writeUtils.writeLn("");
184
- write_utils_1.writeUtils.writeLn(kleur_1.default.green("Cryptographic Bill of Materials (CBOM)"));
185
- index_1.Command.handleModernCbom();
186
- break;
187
- }
188
- case index_2.constants.CLI_FN_9_TTL: {
189
- write_utils_1.writeUtils.writeLn("");
190
- write_utils_1.writeUtils.writeLn(kleur_1.default.green(index_2.constants.CLI_FN_9_TTL));
191
- index_1.Command.handleHelp();
192
- break;
193
- }
194
- default: {
195
- write_utils_1.writeUtils.writeLn("");
196
- write_utils_1.writeUtils.writeLn(kleur_1.default.red(index_2.constants.CLI_ERR_1));
197
- break;
198
- }
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
199
8
  }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
200
35
  })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const index_1 = require("./program/index");
38
+ (0, index_1.exitOnClosedPipe)(process.stdout, (code) => process.exit(code));
39
+ (0, index_1.main)(process.argv.slice(2), (0, index_1.processIO)(), () => Promise.resolve().then(() => __importStar(require("./menu"))).then((menu) => menu.runMenu())).then((code) => {
40
+ process.exitCode = code;
41
+ });
201
42
  //# sourceMappingURL=cli.js.map
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const decrypt_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/decrypt"));
6
+ const pgp_1 = require("@sebastienrousseau/crypto-lib/pgp");
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleDecrypt = async () => {
9
9
  const responseDecrypt = await (0, prompts_1.default)([
@@ -34,7 +34,7 @@ const handleDecrypt = async () => {
34
34
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
35
35
  }
36
36
  else {
37
- await (0, decrypt_1.default)(data);
37
+ await (0, pgp_1.decrypt)(data);
38
38
  }
39
39
  };
40
40
  exports.default = handleDecrypt;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const encrypt_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/encrypt"));
6
+ const pgp_1 = require("@sebastienrousseau/crypto-lib/pgp");
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleEncrypt = async () => {
9
9
  const responseEncrypt = await (0, prompts_1.default)([
@@ -34,7 +34,7 @@ const handleEncrypt = async () => {
34
34
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
35
35
  }
36
36
  else {
37
- await (0, encrypt_1.default)(data);
37
+ await (0, pgp_1.encrypt)(data);
38
38
  }
39
39
  };
40
40
  exports.default = handleEncrypt;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const generate_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/generate"));
6
+ const pgp_1 = require("@sebastienrousseau/crypto-lib/pgp");
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleGenerate = async () => {
9
9
  const responseGenerate = await (0, prompts_1.default)([
@@ -60,7 +60,7 @@ const handleGenerate = async () => {
60
60
  keyExpirationTime: responseGenerate.expiration,
61
61
  format: responseGenerate.format,
62
62
  };
63
- await (0, generate_1.default)(data);
63
+ await (0, pgp_1.generate)(data);
64
64
  };
65
65
  exports.default = handleGenerate;
66
66
  //# sourceMappingURL=generate.command.js.map
@@ -1,7 +1,8 @@
1
+ import { type CbomFormat } from "./cbom.core";
1
2
  export interface ModernCbomOptions {
2
3
  action?: "scan" | "audit";
3
4
  directory?: string;
4
- format?: "cyclonedx" | "spdx";
5
+ format?: CbomFormat;
5
6
  output?: string;
6
7
  filePath?: string;
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cbom.command.d.ts","sourceRoot":"","sources":["../../../src/commands/modern/cbom.command.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAWD,QAAA,MAAM,gBAAgB,GAAU,UAAU,iBAAiB,kBAuI1D,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"cbom.command.d.ts","sourceRoot":"","sources":["../../../src/commands/modern/cbom.command.ts"],"names":[],"mappings":"AASA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8HD,QAAA,MAAM,gBAAgB,GAAU,UAAS,iBAAsB,kBAO9D,CAAC;AAGF,eAAe,gBAAgB,CAAC"}