@sebastienrousseau/crypto-cli 0.0.1 → 0.0.8

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 (91) hide show
  1. package/README.md +228 -235
  2. package/dist/cli.js +67 -1
  3. package/dist/commands/decrypt.command.d.ts.map +1 -1
  4. package/dist/commands/decrypt.command.js +3 -4
  5. package/dist/commands/encrypt.command.d.ts.map +1 -1
  6. package/dist/commands/encrypt.command.js +2 -3
  7. package/dist/commands/generate.command.d.ts.map +1 -1
  8. package/dist/commands/generate.command.js +24 -25
  9. package/dist/commands/help.command.d.ts.map +1 -1
  10. package/dist/commands/index.d.ts +6 -0
  11. package/dist/commands/index.d.ts.map +1 -1
  12. package/dist/commands/index.js +7 -0
  13. package/dist/commands/modern/cbom.command.d.ts +10 -0
  14. package/dist/commands/modern/cbom.command.d.ts.map +1 -0
  15. package/dist/commands/modern/cbom.command.js +164 -0
  16. package/dist/commands/modern/encrypt.command.d.ts +3 -0
  17. package/dist/commands/modern/encrypt.command.d.ts.map +1 -0
  18. package/dist/commands/modern/encrypt.command.js +125 -0
  19. package/dist/commands/modern/hash.command.d.ts +3 -0
  20. package/dist/commands/modern/hash.command.d.ts.map +1 -0
  21. package/dist/commands/modern/hash.command.js +91 -0
  22. package/dist/commands/modern/index.d.ts +9 -0
  23. package/dist/commands/modern/index.d.ts.map +1 -0
  24. package/dist/commands/modern/index.js +21 -0
  25. package/dist/commands/modern/keygen.command.d.ts +3 -0
  26. package/dist/commands/modern/keygen.command.d.ts.map +1 -0
  27. package/dist/commands/modern/keygen.command.js +113 -0
  28. package/dist/commands/modern/password-hash.command.d.ts +3 -0
  29. package/dist/commands/modern/password-hash.command.d.ts.map +1 -0
  30. package/dist/commands/modern/password-hash.command.js +106 -0
  31. package/dist/commands/modern/sign.command.d.ts +3 -0
  32. package/dist/commands/modern/sign.command.d.ts.map +1 -0
  33. package/dist/commands/modern/sign.command.js +135 -0
  34. package/dist/commands/reformat.command.d.ts.map +1 -1
  35. package/dist/commands/reformat.command.js +2 -3
  36. package/dist/commands/revoke.command.d.ts.map +1 -1
  37. package/dist/commands/revoke.command.js +2 -3
  38. package/dist/commands/session.command.d.ts.map +1 -1
  39. package/dist/commands/session.command.js +2 -3
  40. package/dist/commands/sign.command.d.ts.map +1 -1
  41. package/dist/commands/sign.command.js +2 -3
  42. package/dist/commands/verify.command.d.ts.map +1 -1
  43. package/dist/commands/verify.command.js +12 -13
  44. package/dist/constants/en.d.ts.map +1 -1
  45. package/dist/constants/en.js +87 -87
  46. package/dist/constants/fr.d.ts +1 -1
  47. package/dist/constants/fr.d.ts.map +1 -1
  48. package/dist/constants/fr.js +24 -24
  49. package/dist/constants/index.d.ts +4 -2
  50. package/dist/constants/index.d.ts.map +1 -1
  51. package/dist/constants/index.js +25 -20
  52. package/dist/helpers/banner.d.ts +1 -1
  53. package/dist/helpers/banner.d.ts.map +1 -1
  54. package/dist/utils/version.utils.d.ts.map +1 -1
  55. package/dist/utils/write.utils.d.ts.map +1 -1
  56. package/dist/utils/write.utils.js +1 -1
  57. package/package.json +123 -126
  58. package/dist/.DS_Store +0 -0
  59. package/dist/COPYRIGHT +0 -15
  60. package/dist/Makefile +0 -122
  61. package/dist/Report.txt +0 -176
  62. package/dist/cli.js.map +0 -1
  63. package/dist/commands/decrypt.command.js.map +0 -1
  64. package/dist/commands/encrypt.command.js.map +0 -1
  65. package/dist/commands/generate.command.js.map +0 -1
  66. package/dist/commands/help.command.js.map +0 -1
  67. package/dist/commands/index.js.map +0 -1
  68. package/dist/commands/reformat.command.js.map +0 -1
  69. package/dist/commands/revoke.command.js.map +0 -1
  70. package/dist/commands/session.command.js.map +0 -1
  71. package/dist/commands/sign.command.js.map +0 -1
  72. package/dist/commands/verify.command.js.map +0 -1
  73. package/dist/constants/en.js.map +0 -1
  74. package/dist/constants/fr.js.map +0 -1
  75. package/dist/constants/index.js.map +0 -1
  76. package/dist/helpers/banner.js.map +0 -1
  77. package/dist/key/key.d.ts +0 -17
  78. package/dist/key/key.d.ts.map +0 -1
  79. package/dist/key/key.js +0 -19
  80. package/dist/key/key.js.map +0 -1
  81. package/dist/key/rsa-reformat.cert +0 -1
  82. package/dist/key/rsa-reformat.key +0 -1
  83. package/dist/key/rsa-reformat.pub +0 -1
  84. package/dist/key/rsa-revoke.key +0 -1
  85. package/dist/key/rsa-revoke.pub +0 -1
  86. package/dist/key/rsa.cert +0 -1
  87. package/dist/key/rsa.key +0 -1
  88. package/dist/key/rsa.pub +0 -1
  89. package/dist/package.json +0 -129
  90. package/dist/utils/version.utils.js.map +0 -1
  91. package/dist/utils/write.utils.js.map +0 -1
@@ -0,0 +1,113 @@
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
+ const prompts_1 = __importDefault(require("prompts"));
40
+ const write_utils_1 = require("../../utils/write.utils");
41
+ const kleur_1 = __importDefault(require("kleur"));
42
+ const ALGORITHMS = [
43
+ "ed25519",
44
+ "x25519",
45
+ "ed448",
46
+ "x448",
47
+ "p256",
48
+ "p384",
49
+ "ml-kem-512",
50
+ "ml-kem-768",
51
+ "ml-kem-1024",
52
+ "ml-dsa-44",
53
+ "ml-dsa-65",
54
+ "ml-dsa-87",
55
+ ];
56
+ const handleModernKeygen = async () => {
57
+ const response = await (0, prompts_1.default)([
58
+ {
59
+ type: "select",
60
+ name: "algorithm",
61
+ message: "Select algorithm",
62
+ choices: ALGORITHMS.map((a) => ({ title: a, value: a })),
63
+ },
64
+ {
65
+ type: "text",
66
+ name: "kid",
67
+ message: "Key ID (leave empty for auto-generated)",
68
+ },
69
+ {
70
+ type: "select",
71
+ name: "use",
72
+ message: "Key usage",
73
+ choices: [
74
+ { title: "Signing (sig)", value: "sig" },
75
+ { title: "Encryption (enc)", value: "enc" },
76
+ ],
77
+ },
78
+ {
79
+ type: "select",
80
+ name: "outputFormat",
81
+ message: "Output format",
82
+ choices: [
83
+ { title: "JSON", value: "json" },
84
+ { title: "Hex", value: "hex" },
85
+ ],
86
+ },
87
+ ]);
88
+ if (!response.algorithm)
89
+ return;
90
+ try {
91
+ const { generateKeyPair } = await Promise.resolve().then(() => __importStar(require("@sebastienrousseau/crypto-lib/dist/keys/keygen")));
92
+ const metadata = {};
93
+ if (response.kid)
94
+ metadata.kid = response.kid;
95
+ if (response.use)
96
+ metadata.use = response.use;
97
+ const result = generateKeyPair(response.algorithm, metadata);
98
+ if (response.outputFormat === "json") {
99
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify(result, null, 2)));
100
+ }
101
+ else {
102
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(`Algorithm: ${result.algorithm}`));
103
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(`Key ID: ${result.kid}`));
104
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(`Public: ${result.publicKey}`));
105
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(`Private: ${result.privateKey}`));
106
+ }
107
+ }
108
+ catch (err) {
109
+ write_utils_1.writeUtils.writeLn(kleur_1.default.red(`Key generation failed: ${err.message}`));
110
+ }
111
+ };
112
+ exports.default = handleModernKeygen;
113
+ //# sourceMappingURL=keygen.command.js.map
@@ -0,0 +1,3 @@
1
+ declare const handlePasswordHash: () => Promise<void>;
2
+ export default handlePasswordHash;
3
+ //# sourceMappingURL=password-hash.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-hash.command.d.ts","sourceRoot":"","sources":["../../../src/commands/modern/password-hash.command.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,kBAAkB,qBA0EvB,CAAC;AAGF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,106 @@
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
+ const prompts_1 = __importDefault(require("prompts"));
40
+ const write_utils_1 = require("../../utils/write.utils");
41
+ const kleur_1 = __importDefault(require("kleur"));
42
+ const handlePasswordHash = async () => {
43
+ const response = await (0, prompts_1.default)([
44
+ {
45
+ type: "select",
46
+ name: "action",
47
+ message: "Action",
48
+ choices: [
49
+ { title: "Hash password", value: "hash" },
50
+ { title: "Verify password", value: "verify" },
51
+ ],
52
+ },
53
+ {
54
+ type: "password",
55
+ name: "password",
56
+ message: "Password",
57
+ },
58
+ {
59
+ type: "select",
60
+ name: "variant",
61
+ message: "Argon2 variant",
62
+ choices: [
63
+ { title: "argon2id (recommended)", value: "argon2id" },
64
+ { title: "argon2i (side-channel resistant)", value: "argon2i" },
65
+ { title: "argon2d (GPU resistant)", value: "argon2d" },
66
+ ],
67
+ },
68
+ ]);
69
+ if (!response.action || !response.password)
70
+ return;
71
+ try {
72
+ const { hashPassword, verifyPasswordPhc } = await Promise.resolve().then(() => __importStar(require("@sebastienrousseau/crypto-lib/dist/modern/password")));
73
+ if (response.action === "hash") {
74
+ const result = hashPassword({
75
+ password: response.password,
76
+ variant: response.variant,
77
+ });
78
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({
79
+ phc: result.phc,
80
+ hash: result.hash,
81
+ salt: result.salt,
82
+ params: result.params,
83
+ algorithm: result.algorithm,
84
+ }, null, 2)));
85
+ }
86
+ else {
87
+ const phcResp = await (0, prompts_1.default)({
88
+ type: "text",
89
+ name: "phc",
90
+ message: "PHC hash string ($argon2id$v=19$...)",
91
+ });
92
+ if (!phcResp.phc)
93
+ return;
94
+ const result = verifyPasswordPhc({
95
+ password: response.password,
96
+ phc: phcResp.phc,
97
+ });
98
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({ valid: result.valid }, null, 2)));
99
+ }
100
+ }
101
+ catch (err) {
102
+ write_utils_1.writeUtils.writeLn(kleur_1.default.red(`Password hashing failed: ${err.message}`));
103
+ }
104
+ };
105
+ exports.default = handlePasswordHash;
106
+ //# sourceMappingURL=password-hash.command.js.map
@@ -0,0 +1,3 @@
1
+ declare const handleModernSign: () => Promise<void>;
2
+ export default handleModernSign;
3
+ //# sourceMappingURL=sign.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.command.d.ts","sourceRoot":"","sources":["../../../src/commands/modern/sign.command.ts"],"names":[],"mappings":"AA8BA,QAAA,MAAM,gBAAgB,qBA8HrB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,135 @@
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
+ const prompts_1 = __importDefault(require("prompts"));
40
+ const write_utils_1 = require("../../utils/write.utils");
41
+ const kleur_1 = __importDefault(require("kleur"));
42
+ const ALGORITHMS = [
43
+ "ed25519",
44
+ "ed448",
45
+ "ecdsa-p256",
46
+ "ecdsa-p384",
47
+ "schnorr",
48
+ "ml-dsa-44",
49
+ "ml-dsa-65",
50
+ "ml-dsa-87",
51
+ ];
52
+ const handleModernSign = async () => {
53
+ const response = await (0, prompts_1.default)([
54
+ {
55
+ type: "select",
56
+ name: "algorithm",
57
+ message: "Select signing algorithm",
58
+ choices: ALGORITHMS.map((a) => ({ title: a, value: a })),
59
+ },
60
+ {
61
+ type: "select",
62
+ name: "action",
63
+ message: "Action",
64
+ choices: [
65
+ { title: "Generate key pair + sign", value: "keygen-sign" },
66
+ { title: "Sign with existing key", value: "sign" },
67
+ { title: "Verify signature", value: "verify" },
68
+ ],
69
+ },
70
+ {
71
+ type: "text",
72
+ name: "message",
73
+ message: "Message to sign/verify",
74
+ },
75
+ ]);
76
+ if (!response.algorithm || !response.action || !response.message)
77
+ return;
78
+ try {
79
+ const { crypto } = await Promise.resolve().then(() => __importStar(require("@sebastienrousseau/crypto-lib/dist/crypto")));
80
+ if (response.action === "keygen-sign") {
81
+ const { generateKeyPair } = await Promise.resolve().then(() => __importStar(require("@sebastienrousseau/crypto-lib/dist/keys/keygen")));
82
+ let keyAlgo = response.algorithm;
83
+ if (keyAlgo === "ecdsa-p256")
84
+ keyAlgo = "p256";
85
+ if (keyAlgo === "ecdsa-p384")
86
+ keyAlgo = "p384";
87
+ if (keyAlgo === "schnorr") {
88
+ const { generateSchnorrKeyPair } = await Promise.resolve().then(() => __importStar(require("@sebastienrousseau/crypto-lib/dist/modern/curves")));
89
+ const kp = generateSchnorrKeyPair();
90
+ const sig = crypto.sign("schnorr", kp.privateKey, response.message);
91
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({
92
+ publicKey: kp.publicKey,
93
+ privateKey: kp.privateKey,
94
+ signature: sig,
95
+ algorithm: "schnorr",
96
+ }, null, 2)));
97
+ return;
98
+ }
99
+ const kp = generateKeyPair(keyAlgo);
100
+ const sig = crypto.sign(response.algorithm, kp.privateKey, response.message);
101
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({
102
+ publicKey: kp.publicKey,
103
+ privateKey: kp.privateKey,
104
+ signature: sig,
105
+ algorithm: response.algorithm,
106
+ }, null, 2)));
107
+ }
108
+ else if (response.action === "sign") {
109
+ const keyResp = await (0, prompts_1.default)({
110
+ type: "password",
111
+ name: "privateKey",
112
+ message: "Private key (hex)",
113
+ });
114
+ if (!keyResp.privateKey)
115
+ return;
116
+ const sig = crypto.sign(response.algorithm, keyResp.privateKey, response.message);
117
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({ signature: sig, algorithm: response.algorithm }, null, 2)));
118
+ }
119
+ else {
120
+ const verifyResp = await (0, prompts_1.default)([
121
+ { type: "text", name: "publicKey", message: "Public key (hex)" },
122
+ { type: "text", name: "signature", message: "Signature (hex)" },
123
+ ]);
124
+ if (!verifyResp.publicKey || !verifyResp.signature)
125
+ return;
126
+ const valid = crypto.verify(response.algorithm, verifyResp.publicKey, response.message, verifyResp.signature);
127
+ write_utils_1.writeUtils.writeLn(kleur_1.default.green(JSON.stringify({ valid, algorithm: response.algorithm }, null, 2)));
128
+ }
129
+ }
130
+ catch (err) {
131
+ write_utils_1.writeUtils.writeLn(kleur_1.default.red(`Operation failed: ${err.message}`));
132
+ }
133
+ };
134
+ exports.default = handleModernSign;
135
+ //# sourceMappingURL=sign.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reformat.command.d.ts","sourceRoot":"","sources":["../../src/commands/reformat.command.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,cAAc,qBAqDnB,CAAC;AACF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"reformat.command.d.ts","sourceRoot":"","sources":["../../src/commands/reformat.command.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,cAAc,qBAsDnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -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 crypto_lib_1 = __importDefault(require("@sebastienrousseau/crypto-lib"));
6
+ const reformat_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/reformat"));
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleReformat = async () => {
9
9
  const responseReformat = await (0, prompts_1.default)([
@@ -33,7 +33,6 @@ const handleReformat = async () => {
33
33
  message: "Provide a public key in base64 format",
34
34
  },
35
35
  ]);
36
- console.log(responseReformat);
37
36
  const data = {
38
37
  date: new Date(),
39
38
  email: responseReformat.email,
@@ -50,7 +49,7 @@ const handleReformat = async () => {
50
49
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
51
50
  }
52
51
  else {
53
- await crypto_lib_1.default.reformat(data);
52
+ await (0, reformat_1.default)(data);
54
53
  }
55
54
  };
56
55
  exports.default = handleReformat;
@@ -1 +1 @@
1
- {"version":3,"file":"revoke.command.d.ts","sourceRoot":"","sources":["../../src/commands/revoke.command.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,qBAmCjB,CAAC;AACF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"revoke.command.d.ts","sourceRoot":"","sources":["../../src/commands/revoke.command.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,YAAY,qBAoCjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -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 crypto_lib_1 = __importDefault(require("@sebastienrousseau/crypto-lib"));
6
+ const revoke_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/revoke"));
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleRevoke = async () => {
9
9
  const responseRevoke = await (0, prompts_1.default)([
@@ -23,7 +23,6 @@ const handleRevoke = async () => {
23
23
  message: "Provide a reason for revocation (optional)",
24
24
  },
25
25
  ]);
26
- console.log(responseRevoke);
27
26
  const data = {
28
27
  date: new Date(),
29
28
  passphrase: responseRevoke.passphrase,
@@ -34,7 +33,7 @@ const handleRevoke = async () => {
34
33
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
35
34
  }
36
35
  else {
37
- await crypto_lib_1.default.revoke(data);
36
+ await (0, revoke_1.default)(data);
38
37
  }
39
38
  };
40
39
  exports.default = handleRevoke;
@@ -1 +1 @@
1
- {"version":3,"file":"session.command.d.ts","sourceRoot":"","sources":["../../src/commands/session.command.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa,qBAsClB,CAAC;AACF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"session.command.d.ts","sourceRoot":"","sources":["../../src/commands/session.command.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,aAAa,qBAuClB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -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 crypto_lib_1 = __importDefault(require("@sebastienrousseau/crypto-lib"));
6
+ const session_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/session"));
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleSession = async () => {
9
9
  const responseSession = await (0, prompts_1.default)([
@@ -23,7 +23,6 @@ const handleSession = async () => {
23
23
  message: "Provide a public key in base64 format",
24
24
  },
25
25
  ]);
26
- console.log(responseSession);
27
26
  const data = {
28
27
  email: responseSession.email,
29
28
  name: responseSession.name,
@@ -36,7 +35,7 @@ const handleSession = async () => {
36
35
  }
37
36
  else {
38
37
  console.log(data);
39
- await crypto_lib_1.default.session(data);
38
+ await (0, session_1.default)(data);
40
39
  }
41
40
  };
42
41
  exports.default = handleSession;
@@ -1 +1 @@
1
- {"version":3,"file":"sign.command.d.ts","sourceRoot":"","sources":["../../src/commands/sign.command.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,UAAU,qBA+Cf,CAAC;AACF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"sign.command.d.ts","sourceRoot":"","sources":["../../src/commands/sign.command.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,UAAU,qBAgDf,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -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 crypto_lib_1 = __importDefault(require("@sebastienrousseau/crypto-lib"));
6
+ const sign_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/sign"));
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleSign = async () => {
9
9
  const responseSign = await (0, prompts_1.default)([
@@ -28,7 +28,6 @@ const handleSign = async () => {
28
28
  message: "Provide a public key in base64 format",
29
29
  },
30
30
  ]);
31
- console.log(responseSign);
32
31
  const data = {
33
32
  date: new Date(),
34
33
  passphrase: responseSign.passphrase,
@@ -43,7 +42,7 @@ const handleSign = async () => {
43
42
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
44
43
  }
45
44
  else {
46
- await crypto_lib_1.default.sign(data);
45
+ await (0, sign_1.default)(data);
47
46
  }
48
47
  };
49
48
  exports.default = handleSign;
@@ -1 +1 @@
1
- {"version":3,"file":"verify.command.d.ts","sourceRoot":"","sources":["../../src/commands/verify.command.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,qBAuCjB,CAAC;AACF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"verify.command.d.ts","sourceRoot":"","sources":["../../src/commands/verify.command.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,YAAY,qBA0CjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -3,40 +3,39 @@ 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 crypto_lib_1 = __importDefault(require("@sebastienrousseau/crypto-lib"));
6
+ const verify_1 = __importDefault(require("@sebastienrousseau/crypto-lib/dist/lib/verify"));
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const handleVerify = async () => {
9
9
  const responseVerify = await (0, prompts_1.default)([
10
10
  {
11
11
  type: "text",
12
12
  name: "message",
13
- message: "Provide a message to encrypt",
13
+ message: "Provide a message to be verified.",
14
14
  },
15
15
  {
16
- type: "confirm",
17
- name: "detached",
18
- message: "Provide true or false",
16
+ type: "text",
17
+ name: "verificationKeys",
18
+ message: "Provide an array of publicKeys or single key, to verify signatures in base64 format",
19
19
  },
20
20
  {
21
21
  type: "text",
22
- name: "publicKey",
23
- message: "Provide a public key in base64 format",
22
+ name: "date",
23
+ message: "Provide an ISO Date string formatted date to verify message. If not provided, current date will be used. (YYYY-MM-DDTHH:mm:ss.sssZ)",
24
24
  },
25
25
  ]);
26
- console.log(responseVerify);
27
26
  const data = {
28
27
  message: responseVerify.message,
29
- detached: responseVerify.detached,
30
- publicKey: responseVerify.publicKey,
28
+ verificationKeys: responseVerify.verificationKeys,
29
+ date: new Date(),
31
30
  };
32
31
  if (responseVerify.message === "" ||
33
- responseVerify.detached === "" ||
34
- responseVerify.publicKey === "") {
32
+ responseVerify.verificationKeys === "" ||
33
+ responseVerify.date === "") {
35
34
  console.error("\nšŸ”” You must provide a value for each of the properties.\n");
36
35
  }
37
36
  else {
38
37
  console.log(data);
39
- await crypto_lib_1.default.verify(data);
38
+ await (0, verify_1.default)(data);
40
39
  }
41
40
  };
42
41
  exports.default = handleVerify;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/constants/en.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFf,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/constants/en.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwMf,CAAC"}