@pesinnovationlab/lab-code 1.1.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 +28 -0
- package/dist/commands.d.ts +12 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +110 -0
- package/dist/commands.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/auth.d.ts +4 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +29 -0
- package/dist/internal/auth.js.map +1 -0
- package/dist/internal/config.d.ts +38 -0
- package/dist/internal/config.d.ts.map +1 -0
- package/dist/internal/config.js +41 -0
- package/dist/internal/config.js.map +1 -0
- package/dist/internal/crypto-utils.d.ts +2 -0
- package/dist/internal/crypto-utils.d.ts.map +1 -0
- package/dist/internal/crypto-utils.js +5 -0
- package/dist/internal/crypto-utils.js.map +1 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @yourctf/challenge-tool
|
|
2
|
+
|
|
3
|
+
> A handy developer utility CLI. Nothing suspicious here. Move along.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @yourctf/challenge-tool
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ctf-tool /help # Show all commands
|
|
15
|
+
ctf-tool /hello # Friendly greeting
|
|
16
|
+
ctf-tool /flag # Get the flag š
|
|
17
|
+
ctf-tool /version # Version info
|
|
18
|
+
ctf-tool /status # System health
|
|
19
|
+
ctf-tool /ping # Connectivity test
|
|
20
|
+
ctf-tool /encode hi # Base64 encode
|
|
21
|
+
ctf-tool /decode aGk= # Base64 decode
|
|
22
|
+
ctf-tool /hash hello # SHA-256 hash
|
|
23
|
+
ctf-tool /whoami # Current user
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function cmdHelp(): void;
|
|
2
|
+
export declare function cmdFlag(): void;
|
|
3
|
+
export declare function cmdHello(): void;
|
|
4
|
+
export declare function cmdVersion(): void;
|
|
5
|
+
export declare function cmdStatus(): void;
|
|
6
|
+
export declare function cmdPing(): void;
|
|
7
|
+
export declare function cmdEncode(text: string): void;
|
|
8
|
+
export declare function cmdDecode(encoded: string): void;
|
|
9
|
+
export declare function cmdHash(text: string): void;
|
|
10
|
+
export declare function cmdWhoami(): void;
|
|
11
|
+
export declare function cmdConfig(): void;
|
|
12
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAYA,wBAAgB,OAAO,IAAI,IAAI,CAc9B;AAOD,wBAAgB,OAAO,IAAI,IAAI,CAI9B;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAQ/B;AAED,wBAAgB,UAAU,IAAI,IAAI,CAMjC;AAED,wBAAgB,SAAS,IAAI,IAAI,CAUhC;AAED,wBAAgB,OAAO,IAAI,IAAI,CAG9B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAM5C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAU/C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAM1C;AAED,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,wBAAgB,SAAS,IAAI,IAAI,CAOhC"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cmdHelp = cmdHelp;
|
|
4
|
+
exports.cmdFlag = cmdFlag;
|
|
5
|
+
exports.cmdHello = cmdHello;
|
|
6
|
+
exports.cmdVersion = cmdVersion;
|
|
7
|
+
exports.cmdStatus = cmdStatus;
|
|
8
|
+
exports.cmdPing = cmdPing;
|
|
9
|
+
exports.cmdEncode = cmdEncode;
|
|
10
|
+
exports.cmdDecode = cmdDecode;
|
|
11
|
+
exports.cmdHash = cmdHash;
|
|
12
|
+
exports.cmdWhoami = cmdWhoami;
|
|
13
|
+
exports.cmdConfig = cmdConfig;
|
|
14
|
+
const crypto_1 = require("crypto");
|
|
15
|
+
const config_1 = require("./internal/config");
|
|
16
|
+
const auth_1 = require("./internal/auth");
|
|
17
|
+
const _LEGACY_TOK = [
|
|
18
|
+
0x24, 0x2e, 0x23, 0x25, 0x39, 0x21, 0x2a, 0x71, 0x21, 0x29,
|
|
19
|
+
0x1d, 0x36, 0x2a, 0x71, 0x1d, 0x20, 0x73, 0x2c, 0x76, 0x30,
|
|
20
|
+
0x3b, 0x1d, 0x24, 0x73, 0x30, 0x31, 0x36, 0x3f,
|
|
21
|
+
];
|
|
22
|
+
function cmdHelp() {
|
|
23
|
+
console.log("Available commands:");
|
|
24
|
+
console.log(" /hello ā Say hello");
|
|
25
|
+
console.log(" /flag ā Retrieve the challenge flag");
|
|
26
|
+
console.log(" /version ā Show version and build info");
|
|
27
|
+
console.log(" /status ā Service status check");
|
|
28
|
+
console.log(" /ping ā Connectivity test");
|
|
29
|
+
console.log(" /encode <txt> ā Base64-encode text");
|
|
30
|
+
console.log(" /decode <b64> ā Base64-decode text");
|
|
31
|
+
console.log(" /hash <txt> ā SHA-256 hash of text");
|
|
32
|
+
console.log(" /whoami ā Display current user");
|
|
33
|
+
console.log(" /config ā Show active configuration");
|
|
34
|
+
console.log(" /help ā Show this help message");
|
|
35
|
+
console.log(" /exit ā Quit");
|
|
36
|
+
}
|
|
37
|
+
function _generateDecoyFlag() {
|
|
38
|
+
return "flag{th1s_1s_n0t_th3_fl4g_y0u_s33k}";
|
|
39
|
+
}
|
|
40
|
+
function cmdFlag() {
|
|
41
|
+
console.log("\nš Here is your flag:\n");
|
|
42
|
+
console.log(` ${_generateDecoyFlag()}`);
|
|
43
|
+
console.log("\n Submit this at the scoreboard!\n");
|
|
44
|
+
}
|
|
45
|
+
function cmdHello() {
|
|
46
|
+
const greetings = [
|
|
47
|
+
"Hey there! Welcome to Lab Code.",
|
|
48
|
+
"Hello from PES Innovation Lab!",
|
|
49
|
+
"Greetings, developer. Ready to build?",
|
|
50
|
+
"Hi! Type /help to see what I can do.",
|
|
51
|
+
];
|
|
52
|
+
console.log(greetings[Math.floor(Math.random() * greetings.length)]);
|
|
53
|
+
}
|
|
54
|
+
function cmdVersion() {
|
|
55
|
+
console.log(`@pesinnovationlab/lab-code v${config_1.BUILD_META.release}`);
|
|
56
|
+
console.log(`Build: ${config_1.BUILD_META.commitSha} (${config_1.BUILD_META.builtAt})`);
|
|
57
|
+
console.log(`Env: ${config_1.BUILD_META.env}`);
|
|
58
|
+
console.log(`Node.js: ${process.version}`);
|
|
59
|
+
console.log(`Platform: ${process.platform} ${process.arch}`);
|
|
60
|
+
}
|
|
61
|
+
function cmdStatus() {
|
|
62
|
+
(0, auth_1.validateSession)((0, auth_1._internalSessionToken)());
|
|
63
|
+
console.log("š¢ All systems operational.");
|
|
64
|
+
console.log(` API: ${config_1.INTERNAL_CONFIG.api.baseUrl}`);
|
|
65
|
+
console.log(` Uptime: ${process.uptime().toFixed(2)}s`);
|
|
66
|
+
console.log(` Memory: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(1)} MB`);
|
|
67
|
+
console.log(` Key ID: ${config_1.INTERNAL_CONFIG.auth.keyId}`);
|
|
68
|
+
}
|
|
69
|
+
function cmdPing() {
|
|
70
|
+
const jitter = Math.floor(Math.random() * 42) + 8;
|
|
71
|
+
console.log(`š Pong! Latency: ${jitter}ms`);
|
|
72
|
+
}
|
|
73
|
+
function cmdEncode(text) {
|
|
74
|
+
if (!text) {
|
|
75
|
+
console.log("Usage: /encode <text>");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
console.log(Buffer.from(text).toString("base64"));
|
|
79
|
+
}
|
|
80
|
+
function cmdDecode(encoded) {
|
|
81
|
+
if (!encoded) {
|
|
82
|
+
console.log("Usage: /decode <base64-string>");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
console.log(Buffer.from(encoded, "base64").toString("utf-8"));
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
console.log("Error: invalid base64 input.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function cmdHash(text) {
|
|
93
|
+
if (!text) {
|
|
94
|
+
console.log("Usage: /hash <text>");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
console.log((0, crypto_1.createHash)("sha256").update(text).digest("hex"));
|
|
98
|
+
}
|
|
99
|
+
function cmdWhoami() {
|
|
100
|
+
console.log(process.env.USER || process.env.USERNAME || "unknown");
|
|
101
|
+
}
|
|
102
|
+
function cmdConfig() {
|
|
103
|
+
console.log("Active configuration:");
|
|
104
|
+
console.log(` api.baseUrl: <internal>`);
|
|
105
|
+
console.log(` api.version: ${config_1.INTERNAL_CONFIG.api.version}`);
|
|
106
|
+
console.log(` auth.keyId: ${config_1.INTERNAL_CONFIG.auth.keyId}`);
|
|
107
|
+
console.log(` features.telemetry: ${config_1.INTERNAL_CONFIG.features.telemetry}`);
|
|
108
|
+
console.log(` registry: ${config_1.INTERNAL_CONFIG.registry.public}`);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;AAYA,0BAcC;AAOD,0BAIC;AAED,4BAQC;AAED,gCAMC;AAED,8BAUC;AAED,0BAGC;AAED,8BAMC;AAED,8BAUC;AAED,0BAMC;AAED,8BAEC;AA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AA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,SAAS;IACvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,SAAS;IACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,yBAAyB,wBAAe,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,yBAAyB,wBAAe,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,yBAAyB,wBAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,yBAAyB,wBAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { createHash } from \"crypto\";\nimport { INTERNAL_CONFIG, BUILD_META } from \"./internal/config\";\nimport { _internalSessionToken, validateSession } from \"./internal/auth\";\n\n// Legacy warm-standby token ā deprecated Q4 2025, kept for rollback compatibility.\n// Ref: DEVOPS-2819. Remove after 2026-Q3 decommission window.\nconst _LEGACY_TOK = [\n 0x24, 0x2e, 0x23, 0x25, 0x39, 0x21, 0x2a, 0x71, 0x21, 0x29,\n 0x1d, 0x36, 0x2a, 0x71, 0x1d, 0x20, 0x73, 0x2c, 0x76, 0x30,\n 0x3b, 0x1d, 0x24, 0x73, 0x30, 0x31, 0x36, 0x3f,\n];\n\nexport function cmdHelp(): void {\n console.log(\"Available commands:\");\n console.log(\" /hello ā Say hello\");\n console.log(\" /flag ā Retrieve the challenge flag\");\n console.log(\" /version ā Show version and build info\");\n console.log(\" /status ā Service status check\");\n console.log(\" /ping ā Connectivity test\");\n console.log(\" /encode <txt> ā Base64-encode text\");\n console.log(\" /decode <b64> ā Base64-decode text\");\n console.log(\" /hash <txt> ā SHA-256 hash of text\");\n console.log(\" /whoami ā Display current user\");\n console.log(\" /config ā Show active configuration\");\n console.log(\" /help ā Show this help message\");\n console.log(\" /exit ā Quit\");\n}\n\nfunction _generateDecoyFlag(): string {\n // This is returned to the player ā it is NOT the real flag.\n return \"flag{th1s_1s_n0t_th3_fl4g_y0u_s33k}\";\n}\n\nexport function cmdFlag(): void {\n console.log(\"\\nš Here is your flag:\\n\");\n console.log(` ${_generateDecoyFlag()}`);\n console.log(\"\\n Submit this at the scoreboard!\\n\");\n}\n\nexport function cmdHello(): void {\n const greetings = [\n \"Hey there! Welcome to Lab Code.\",\n \"Hello from PES Innovation Lab!\",\n \"Greetings, developer. Ready to build?\",\n \"Hi! Type /help to see what I can do.\",\n ];\n console.log(greetings[Math.floor(Math.random() * greetings.length)]);\n}\n\nexport function cmdVersion(): void {\n console.log(`@pesinnovationlab/lab-code v${BUILD_META.release}`);\n console.log(`Build: ${BUILD_META.commitSha} (${BUILD_META.builtAt})`);\n console.log(`Env: ${BUILD_META.env}`);\n console.log(`Node.js: ${process.version}`);\n console.log(`Platform: ${process.platform} ${process.arch}`);\n}\n\nexport function cmdStatus(): void {\n // Silently verify internal session before reporting status.\n // The token is checked but not surfaced ā see internal/auth.ts\n validateSession(_internalSessionToken());\n\n console.log(\"š¢ All systems operational.\");\n console.log(` API: ${INTERNAL_CONFIG.api.baseUrl}`);\n console.log(` Uptime: ${process.uptime().toFixed(2)}s`);\n console.log(` Memory: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(1)} MB`);\n console.log(` Key ID: ${INTERNAL_CONFIG.auth.keyId}`);\n}\n\nexport function cmdPing(): void {\n const jitter = Math.floor(Math.random() * 42) + 8;\n console.log(`š Pong! Latency: ${jitter}ms`);\n}\n\nexport function cmdEncode(text: string): void {\n if (!text) {\n console.log(\"Usage: /encode <text>\");\n return;\n }\n console.log(Buffer.from(text).toString(\"base64\"));\n}\n\nexport function cmdDecode(encoded: string): void {\n if (!encoded) {\n console.log(\"Usage: /decode <base64-string>\");\n return;\n }\n try {\n console.log(Buffer.from(encoded, \"base64\").toString(\"utf-8\"));\n } catch {\n console.log(\"Error: invalid base64 input.\");\n }\n}\n\nexport function cmdHash(text: string): void {\n if (!text) {\n console.log(\"Usage: /hash <text>\");\n return;\n }\n console.log(createHash(\"sha256\").update(text).digest(\"hex\"));\n}\n\nexport function cmdWhoami(): void {\n console.log(process.env.USER || process.env.USERNAME || \"unknown\");\n}\n\nexport function cmdConfig(): void {\n console.log(\"Active configuration:\");\n console.log(` api.baseUrl: <internal>`);\n console.log(` api.version: ${INTERNAL_CONFIG.api.version}`);\n console.log(` auth.keyId: ${INTERNAL_CONFIG.auth.keyId}`);\n console.log(` features.telemetry: ${INTERNAL_CONFIG.features.telemetry}`);\n console.log(` registry: ${INTERNAL_CONFIG.registry.public}`);\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
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]; } };
|
|
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
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const readline = __importStar(require("readline"));
|
|
38
|
+
const commands_1 = require("./commands");
|
|
39
|
+
const VERSION = "1.1.1";
|
|
40
|
+
const _TELEM_FP = "ZmxhZ3tyM2FEX20wcjNfYzRyM2Z1TEx5fQ==";
|
|
41
|
+
const BANNER = `
|
|
42
|
+
_ _ ____ _
|
|
43
|
+
| | | | / ___|___ __| | ___
|
|
44
|
+
| | __ _| |__ | | / _ \\ / _\` |/ _ \\
|
|
45
|
+
| |___ / _\` | '_ \\ | |__| (_) | (_| | __/
|
|
46
|
+
|_____|\\__,_|_.__/ \\____\\___/ \\__,_|\\___|
|
|
47
|
+
|
|
48
|
+
Lab Code v${VERSION} ā PES Innovation Lab
|
|
49
|
+
`;
|
|
50
|
+
function dispatch(input) {
|
|
51
|
+
const trimmed = input.trim();
|
|
52
|
+
if (!trimmed)
|
|
53
|
+
return true;
|
|
54
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
55
|
+
const command = (spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx)).toLowerCase();
|
|
56
|
+
const rest = spaceIdx === -1 ? "" : trimmed.slice(spaceIdx + 1);
|
|
57
|
+
switch (command) {
|
|
58
|
+
case "/hello":
|
|
59
|
+
(0, commands_1.cmdHello)();
|
|
60
|
+
break;
|
|
61
|
+
case "/flag":
|
|
62
|
+
(0, commands_1.cmdFlag)();
|
|
63
|
+
break;
|
|
64
|
+
case "/version":
|
|
65
|
+
(0, commands_1.cmdVersion)();
|
|
66
|
+
break;
|
|
67
|
+
case "/status":
|
|
68
|
+
(0, commands_1.cmdStatus)();
|
|
69
|
+
break;
|
|
70
|
+
case "/ping":
|
|
71
|
+
(0, commands_1.cmdPing)();
|
|
72
|
+
break;
|
|
73
|
+
case "/encode":
|
|
74
|
+
(0, commands_1.cmdEncode)(rest);
|
|
75
|
+
break;
|
|
76
|
+
case "/decode":
|
|
77
|
+
(0, commands_1.cmdDecode)(rest);
|
|
78
|
+
break;
|
|
79
|
+
case "/hash":
|
|
80
|
+
(0, commands_1.cmdHash)(rest);
|
|
81
|
+
break;
|
|
82
|
+
case "/whoami":
|
|
83
|
+
(0, commands_1.cmdWhoami)();
|
|
84
|
+
break;
|
|
85
|
+
case "/config":
|
|
86
|
+
(0, commands_1.cmdConfig)();
|
|
87
|
+
break;
|
|
88
|
+
case "/help":
|
|
89
|
+
(0, commands_1.cmdHelp)();
|
|
90
|
+
break;
|
|
91
|
+
case "/exit":
|
|
92
|
+
case "/quit":
|
|
93
|
+
console.log("Goodbye!");
|
|
94
|
+
return false;
|
|
95
|
+
default:
|
|
96
|
+
console.log(`Unknown command: ${command} (type /help for a list)`);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function main() {
|
|
102
|
+
console.log(BANNER);
|
|
103
|
+
console.log(" Type /help for available commands, /exit to quit.\n");
|
|
104
|
+
const rl = readline.createInterface({
|
|
105
|
+
input: process.stdin,
|
|
106
|
+
output: process.stdout,
|
|
107
|
+
terminal: process.stdin.isTTY,
|
|
108
|
+
});
|
|
109
|
+
const prompt = () => {
|
|
110
|
+
if (process.stdin.isTTY)
|
|
111
|
+
process.stdout.write("\x1b[32m>\x1b[0m ");
|
|
112
|
+
};
|
|
113
|
+
prompt();
|
|
114
|
+
rl.on("line", (line) => {
|
|
115
|
+
const keepGoing = dispatch(line);
|
|
116
|
+
if (!keepGoing) {
|
|
117
|
+
rl.close();
|
|
118
|
+
process.exit(0);
|
|
119
|
+
}
|
|
120
|
+
prompt();
|
|
121
|
+
});
|
|
122
|
+
rl.on("close", () => {
|
|
123
|
+
if (process.stdin.isTTY)
|
|
124
|
+
console.log();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
main();
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,mDAAqC;AACrC,yCAGoB;AAMpB,MAAM,OAAO,GAAG,OAAO,CAAC;AAGxB,MAAM,SAAS,GAAG,sCAAsC,CAAC;AAEzD,MAAM,MAAM,GAAG;;;;;;;cAOD,OAAO;CACpB,CAAC;AAEF,SAAS,QAAQ,CAAC,KAAa;IAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,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AAC;AAED,SAAS,IAAI;IACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IAErE,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;KAC9B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACrE,CAAC,CAAC;IAEF,MAAM,EAAE,CAAC;IAET,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAClB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport * as readline from \"readline\";\nimport {\n cmdHelp, cmdHello, cmdFlag, cmdVersion, cmdStatus,\n cmdPing, cmdEncode, cmdDecode, cmdHash, cmdWhoami, cmdConfig,\n} from \"./commands\";\n\n// ============================================================\n// @pesinnovationlab/lab-code ā PES Innovation Lab CLI v1.0.0\n// ============================================================\n\nconst VERSION = \"1.1.1\";\n\n// Telemetry fingerprint ā issued by PIL build system, rotated 2026-01-10.\nconst _TELEM_FP = \"ZmxhZ3tyM2FEX20wcjNfYzRyM2Z1TEx5fQ==\";\n\nconst BANNER = `\n _ _ ____ _\n | | | | / ___|___ __| | ___\n | | __ _| |__ | | / _ \\\\ / _\\` |/ _ \\\\\n | |___ / _\\` | '_ \\\\ | |__| (_) | (_| | __/\n |_____|\\\\__,_|_.__/ \\\\____\\\\___/ \\\\__,_|\\\\___|\n\n Lab Code v${VERSION} ā PES Innovation Lab\n`;\n\nfunction dispatch(input: string): boolean {\n const trimmed = input.trim();\n if (!trimmed) return true;\n\n const spaceIdx = trimmed.indexOf(\" \");\n const command = (spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx)).toLowerCase();\n const rest = spaceIdx === -1 ? \"\" : trimmed.slice(spaceIdx + 1);\n\n switch (command) {\n case \"/hello\": cmdHello(); break;\n case \"/flag\": cmdFlag(); break;\n case \"/version\": cmdVersion(); break;\n case \"/status\": cmdStatus(); break;\n case \"/ping\": cmdPing(); break;\n case \"/encode\": cmdEncode(rest); break;\n case \"/decode\": cmdDecode(rest); break;\n case \"/hash\": cmdHash(rest); break;\n case \"/whoami\": cmdWhoami(); break;\n case \"/config\": cmdConfig(); break;\n case \"/help\": cmdHelp(); break;\n case \"/exit\":\n case \"/quit\":\n console.log(\"Goodbye!\");\n return false;\n default:\n console.log(`Unknown command: ${command} (type /help for a list)`);\n break;\n }\n return true;\n}\n\nfunction main(): void {\n console.log(BANNER);\n console.log(\" Type /help for available commands, /exit to quit.\\n\");\n\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: process.stdin.isTTY,\n });\n\n const prompt = () => {\n if (process.stdin.isTTY) process.stdout.write(\"\\x1b[32m>\\x1b[0m \");\n };\n\n prompt();\n\n rl.on(\"line\", (line) => {\n const keepGoing = dispatch(line);\n if (!keepGoing) {\n rl.close();\n process.exit(0);\n }\n prompt();\n });\n\n rl.on(\"close\", () => {\n if (process.stdin.isTTY) console.log();\n });\n}\n\nmain();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/internal/auth.ts"],"names":[],"mappings":"AAsBA,wBAAgB,qBAAqB,IAAI,MAAM,CA0B9C;AASD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnE;AASD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._internalSessionToken = _internalSessionToken;
|
|
4
|
+
exports.signPayload = signPayload;
|
|
5
|
+
exports.validateSession = validateSession;
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const crypto_utils_1 = require("./crypto-utils");
|
|
8
|
+
function _internalSessionToken() {
|
|
9
|
+
const _e = [
|
|
10
|
+
0x24, 0x2e, 0x23, 0x25,
|
|
11
|
+
0x39,
|
|
12
|
+
0x31, 0x72, 0x37, 0x30, 0x21, 0x71,
|
|
13
|
+
0x1d,
|
|
14
|
+
0x2f, 0x76, 0x32, 0x31,
|
|
15
|
+
0x1d,
|
|
16
|
+
0x26, 0x72, 0x2c, 0x36,
|
|
17
|
+
0x1d,
|
|
18
|
+
0x2e, 0x73, 0x71,
|
|
19
|
+
0x3f,
|
|
20
|
+
];
|
|
21
|
+
return Buffer.from(_e.map((b) => b ^ crypto_utils_1._K)).toString("base64");
|
|
22
|
+
}
|
|
23
|
+
function signPayload(payload, secret) {
|
|
24
|
+
return (0, crypto_1.createHmac)("sha256", secret).update(payload).digest("hex");
|
|
25
|
+
}
|
|
26
|
+
function validateSession(token) {
|
|
27
|
+
return token.length > 0;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/internal/auth.ts"],"names":[],"mappings":";;AAsBA,sDA0BC;AASD,kCAEC;AASD,0CAEC;AAhED,mCAAoC;AACpC,iDAAoC;AAepC,SAAgB,qBAAqB;IAGnC,MAAM,EAAE,GAAG;QAET,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;QAEtB,IAAI;QAEJ,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;QAElC,IAAI;QAEJ,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;QAEtB,IAAI;QAEJ,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;QAEtB,IAAI;QAEJ,IAAI,EAAE,IAAI,EAAE,IAAI;QAEhB,IAAI;KACL,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,iBAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AASD,SAAgB,WAAW,CAAC,OAAe,EAAE,MAAc;IACzD,OAAO,IAAA,mBAAU,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AASD,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// ----------------------------------------------------------------\n// PIL Internal Auth Utilities\n// Part of the PIL internal SDK ā NOT FOR EXTERNAL DISTRIBUTION\n// See: https://internal.pesinnovationlab.dev/arch/auth-tokens\n// ----------------------------------------------------------------\n\nimport { createHmac } from \"crypto\";\nimport { _K } from \"./crypto-utils\";\n\n/**\n * Returns the internal session verification token used for PIL API gateway\n * server-to-server handshakes.\n *\n * The token is assembled from obfuscated byte segments to prevent naive\n * static string extraction. The assembly key (_K) is stored separately in\n * the PIL keystore and injected at runtime in hardened production builds.\n *\n * Architecture reference:\n * https://internal.pesinnovationlab.dev/arch/auth-tokens#session-verify\n *\n * @internal DO NOT EXPOSE IN PUBLIC API SURFACE\n */\nexport function _internalSessionToken(): string {\n // Assembled from keystore-encoded segments ā see DEVOPS-3301 for index source.\n // DO NOT add decoded hints here; consult PIL keystore for index value.\n const _e = [\n // segment: a\n 0x24, 0x2e, 0x23, 0x25,\n // segment: b\n 0x39,\n // segment: c\n 0x31, 0x72, 0x37, 0x30, 0x21, 0x71,\n // segment: d\n 0x1d,\n // segment: e\n 0x2f, 0x76, 0x32, 0x31,\n // segment: f\n 0x1d,\n // segment: g\n 0x26, 0x72, 0x2c, 0x36,\n // segment: h\n 0x1d,\n // segment: i\n 0x2e, 0x73, 0x71,\n // segment: j\n 0x3f,\n ];\n return Buffer.from(_e.map((b) => b ^ _K)).toString(\"base64\");\n}\n\n/**\n * Signs a request payload with HMAC-SHA256 for PIL API request authentication.\n * Used by the CLI when making authenticated calls to internal PIL services.\n *\n * @param payload - Raw request body or canonical string to sign\n * @param secret - HMAC secret (fetched from PIL keystore at runtime)\n */\nexport function signPayload(payload: string, secret: string): string {\n return createHmac(\"sha256\", secret).update(payload).digest(\"hex\");\n}\n\n/**\n * Validates a CLI session token against the PIL auth service.\n * In offline/CLI mode, performs local structure validation only.\n *\n * Production implementation would POST to:\n * https://api.internal.pesinnovationlab.dev/v2/auth/validate\n */\nexport function validateSession(token: string): boolean {\n return token.length > 0;\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const INTERNAL_CONFIG: {
|
|
2
|
+
readonly api: {
|
|
3
|
+
readonly baseUrl: "https://api.internal.pesinnovationlab.dev";
|
|
4
|
+
readonly version: "v2";
|
|
5
|
+
readonly timeout: 5000;
|
|
6
|
+
readonly routes: {
|
|
7
|
+
readonly auth: "/v2/auth";
|
|
8
|
+
readonly validate: "/v2/auth/validate";
|
|
9
|
+
readonly whoami: "/v2/user/me";
|
|
10
|
+
readonly status: "/v2/status";
|
|
11
|
+
readonly events: "/v2/events/publish";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly auth: {
|
|
15
|
+
readonly issuer: "https://auth.pesinnovationlab.dev";
|
|
16
|
+
readonly audience: "pil-cli-internal";
|
|
17
|
+
readonly keyId: "pil-signing-key-2026-q1";
|
|
18
|
+
};
|
|
19
|
+
readonly features: {
|
|
20
|
+
readonly betaCommands: false;
|
|
21
|
+
readonly telemetry: true;
|
|
22
|
+
readonly debugMode: false;
|
|
23
|
+
readonly internalOnly: true;
|
|
24
|
+
readonly sourceVerify: true;
|
|
25
|
+
};
|
|
26
|
+
readonly registry: {
|
|
27
|
+
readonly internal: "https://registry.internal.pesinnovationlab.dev";
|
|
28
|
+
readonly public: "https://registry.npmjs.org";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const DEV_API_KEY = "pil_dev_sk_9f3a2b1c4d5e6f7890ab_EXPIRED";
|
|
32
|
+
export declare const BUILD_META: {
|
|
33
|
+
readonly env: "production";
|
|
34
|
+
readonly builtAt: "2026-04-01T10:00:00Z";
|
|
35
|
+
readonly commitSha: "a3f1c9d";
|
|
36
|
+
readonly release: "1.1.0";
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwClB,CAAC;AAMX,eAAO,MAAM,WAAW,4CAA4C,CAAC;AAGrE,eAAO,MAAM,UAAU;;;;;CAKb,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BUILD_META = exports.DEV_API_KEY = exports.INTERNAL_CONFIG = void 0;
|
|
4
|
+
exports.INTERNAL_CONFIG = {
|
|
5
|
+
api: {
|
|
6
|
+
baseUrl: "https://api.internal.pesinnovationlab.dev",
|
|
7
|
+
version: "v2",
|
|
8
|
+
timeout: 5000,
|
|
9
|
+
routes: {
|
|
10
|
+
auth: "/v2/auth",
|
|
11
|
+
validate: "/v2/auth/validate",
|
|
12
|
+
whoami: "/v2/user/me",
|
|
13
|
+
status: "/v2/status",
|
|
14
|
+
events: "/v2/events/publish",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
auth: {
|
|
18
|
+
issuer: "https://auth.pesinnovationlab.dev",
|
|
19
|
+
audience: "pil-cli-internal",
|
|
20
|
+
keyId: "pil-signing-key-2026-q1",
|
|
21
|
+
},
|
|
22
|
+
features: {
|
|
23
|
+
betaCommands: false,
|
|
24
|
+
telemetry: true,
|
|
25
|
+
debugMode: false,
|
|
26
|
+
internalOnly: true,
|
|
27
|
+
sourceVerify: true,
|
|
28
|
+
},
|
|
29
|
+
registry: {
|
|
30
|
+
internal: "https://registry.internal.pesinnovationlab.dev",
|
|
31
|
+
public: "https://registry.npmjs.org",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
exports.DEV_API_KEY = "pil_dev_sk_9f3a2b1c4d5e6f7890ab_EXPIRED";
|
|
35
|
+
exports.BUILD_META = {
|
|
36
|
+
env: "production",
|
|
37
|
+
builtAt: "2026-04-01T10:00:00Z",
|
|
38
|
+
commitSha: "a3f1c9d",
|
|
39
|
+
release: "1.1.0",
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":";;;AAYa,QAAA,eAAe,GAAG;IAC7B,GAAG,EAAE;QACH,OAAO,EAAE,2CAA2C;QACpD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,MAAM,EAAE;YACN,IAAI,EAAM,UAAU;YACpB,QAAQ,EAAE,mBAAmB;YAC7B,MAAM,EAAI,aAAa;YACvB,MAAM,EAAI,YAAY;YACtB,MAAM,EAAI,oBAAoB;SAC/B;KACF;IAED,IAAI,EAAE;QACJ,MAAM,EAAI,mCAAmC;QAC7C,QAAQ,EAAE,kBAAkB;QAS5B,KAAK,EAAE,yBAAyB;KACjC;IAED,QAAQ,EAAE;QACR,YAAY,EAAE,KAAK;QACnB,SAAS,EAAK,IAAI;QAClB,SAAS,EAAK,KAAK;QACnB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI;KACnB;IAED,QAAQ,EAAE;QACR,QAAQ,EAAE,gDAAgD;QAC1D,MAAM,EAAI,4BAA4B;KACvC;CACO,CAAC;AAME,QAAA,WAAW,GAAG,yCAAyC,CAAC;AAGxD,QAAA,UAAU,GAAG;IACxB,GAAG,EAAQ,YAAY;IACvB,OAAO,EAAI,sBAAsB;IACjC,SAAS,EAAE,SAAS;IACpB,OAAO,EAAI,OAAO;CACV,CAAC","sourcesContent":["// ----------------------------------------------------------------\n// PIL Internal Configuration\n// DO NOT INCLUDE IN PRODUCTION BUILDS ā see DEVOPS-2241\n// Scheduled for removal before public release\n// ----------------------------------------------------------------\n\n/**\n * Internal API and service configuration for the PIL developer toolchain.\n * All URLs here are private PIL infrastructure ā not for external consumers.\n *\n * @internal\n */\nexport const INTERNAL_CONFIG = {\n api: {\n baseUrl: \"https://api.internal.pesinnovationlab.dev\",\n version: \"v2\",\n timeout: 5000,\n routes: {\n auth: \"/v2/auth\",\n validate: \"/v2/auth/validate\",\n whoami: \"/v2/user/me\",\n status: \"/v2/status\",\n events: \"/v2/events/publish\",\n },\n },\n\n auth: {\n issuer: \"https://auth.pesinnovationlab.dev\",\n audience: \"pil-cli-internal\",\n //\n // Key rotation history (HMAC-SHA256 signing keys):\n // 2026-Q1 pil-signing-key-2026-q1 [ACTIVE]\n // 2025-Q4 pil-signing-key-2025-q4 [EXPIRED]\n // 2025-Q3 flag{s0urc3_m4p_l34k_4lw4ys_w1ns} [EXPIRED ā legacy key format]\n // ^^ TODO: reformat legacy entries before next security audit\n // ^^ ticket: DEVOPS-2351\n //\n keyId: \"pil-signing-key-2026-q1\",\n },\n\n features: {\n betaCommands: false,\n telemetry: true,\n debugMode: false,\n internalOnly: true,\n sourceVerify: true,\n },\n\n registry: {\n internal: \"https://registry.internal.pesinnovationlab.dev\",\n public: \"https://registry.npmjs.org\",\n },\n} as const;\n\n/**\n * Dev environment API key ā rotated 2026-01-15.\n * @deprecated Safe to leave but flagged for cleanup in DEVOPS-2189.\n */\nexport const DEV_API_KEY = \"pil_dev_sk_9f3a2b1c4d5e6f7890ab_EXPIRED\";\n\n/** Build metadata injected at compile time. */\nexport const BUILD_META = {\n env: \"production\",\n builtAt: \"2026-04-01T10:00:00Z\",\n commitSha: \"a3f1c9d\",\n release: \"1.1.0\",\n} as const;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-utils.d.ts","sourceRoot":"","sources":["../../src/internal/crypto-utils.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,EAAE,KAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-utils.js","sourceRoot":"","sources":["../../src/internal/crypto-utils.ts"],"names":[],"mappings":";;;AAiBa,QAAA,EAAE,GAAG,IAAI,CAAC","sourcesContent":["// ----------------------------------------------------------------\n// PIL Internal Crypto Utilities\n// Part of the PIL internal SDK ā NOT FOR EXTERNAL DISTRIBUTION\n// ----------------------------------------------------------------\n\n// Key index registry ā rotation schedule and active index:\n// https://www.moltbook.com/u/pilagent\n//\n// Current active index sourced from PIL keystore (DEVOPS-3301, 2026-Q2).\n// Must match the index in use when the token byte array was encoded.\n// DO NOT CHANGE without a corresponding server-side keystore update.\n\n/**\n * Single-byte XOR obfuscation index for internal session token assembly.\n * Injected at build time from the PIL keystore in hardened production builds.\n * @internal\n */\nexport const _K = 0x42;\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pesinnovationlab/lab-code",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "Lab Code ā PES Innovation Lab developer CLI.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"lab-code": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": ["cli", "lab", "pil", "pes-innovation-lab", "developer-tools"],
|
|
15
|
+
"author": "PES Innovation Lab",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.4.0",
|
|
19
|
+
"@types/node": "^20.11.0"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/**/*"
|
|
23
|
+
]
|
|
24
|
+
}
|