ecrypto-cli 1.0.3 → 1.0.5
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/bin/ecrypto +2 -2
- package/bin/launcher.js +16 -0
- package/package.json +33 -29
- package/postinstall.js +76 -76
package/bin/ecrypto
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
echo "ECRYPTO installing binary..."
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
echo "ECRYPTO installing binary..."
|
package/bin/launcher.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const platform = os.platform();
|
|
8
|
+
const binary = platform === "win32" ? "ecrypto.exe" : "ecrypto";
|
|
9
|
+
|
|
10
|
+
const binPath = path.join(__dirname, binary);
|
|
11
|
+
|
|
12
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
|
|
14
|
+
child.on("exit", (code) => {
|
|
15
|
+
process.exit(code);
|
|
16
|
+
});
|
package/package.json
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ecrypto-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Military-grade folder encryption tool (npm global installer)",
|
|
5
|
-
"bin": {
|
|
6
|
-
"ecrypto": "bin/
|
|
7
|
-
"ecrypto-cli": "bin/
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"postinstall": "node postinstall.js"
|
|
11
|
-
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ecrypto-cli",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Military-grade folder encryption tool (npm global installer)",
|
|
5
|
+
"bin": {
|
|
6
|
+
"ecrypto": "bin/launcher.js",
|
|
7
|
+
"ecrypto-cli": "bin/launcher.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node postinstall.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"postinstall.js"
|
|
15
|
+
],
|
|
16
|
+
"os": [
|
|
17
|
+
"darwin",
|
|
18
|
+
"linux",
|
|
19
|
+
"win32"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://github.com/pandarudra/ecrypto",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/pandarudra/ecrypto.git"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"encryption",
|
|
28
|
+
"crypto",
|
|
29
|
+
"security",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|
package/postinstall.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const os = require("os");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const https = require("https");
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
|
|
8
|
-
const version = "v1.0.6";
|
|
9
|
-
|
|
10
|
-
function getBinaryName() {
|
|
11
|
-
const platform = os.platform();
|
|
12
|
-
const arch = os.arch();
|
|
13
|
-
|
|
14
|
-
const archMap = {
|
|
15
|
-
x64: "amd64",
|
|
16
|
-
arm64: "arm64",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const platformMap = {
|
|
20
|
-
win32: "windows",
|
|
21
|
-
darwin: "darwin",
|
|
22
|
-
linux: "linux",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const goos = platformMap[platform];
|
|
26
|
-
const goarch = archMap[arch];
|
|
27
|
-
|
|
28
|
-
if (!goos || !goarch) {
|
|
29
|
-
console.error(`Unsupported platform or architecture: ${platform} ${arch}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return goos === "windows"
|
|
35
|
-
? `ecrypto-${goos}-${goarch}.exe`
|
|
36
|
-
: `ecrypto-${goos}-${goarch}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function download(url, dest, cb) {
|
|
40
|
-
https.get(url, (res) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
const outputPath = path.join(binDir,
|
|
67
|
-
|
|
68
|
-
// Ensure bin/ exists
|
|
69
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
70
|
-
|
|
71
|
-
download(downloadUrl, outputPath, () => {
|
|
72
|
-
if (os.platform() !== "win32") {
|
|
73
|
-
fs.chmodSync(outputPath, 0o755);
|
|
74
|
-
}
|
|
75
|
-
console.log("✅ ECRYPTO installed successfully.");
|
|
76
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const https = require("https");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
|
|
8
|
+
const version = "v1.0.6";
|
|
9
|
+
|
|
10
|
+
function getBinaryName() {
|
|
11
|
+
const platform = os.platform();
|
|
12
|
+
const arch = os.arch();
|
|
13
|
+
|
|
14
|
+
const archMap = {
|
|
15
|
+
x64: "amd64",
|
|
16
|
+
arm64: "arm64",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const platformMap = {
|
|
20
|
+
win32: "windows",
|
|
21
|
+
darwin: "darwin",
|
|
22
|
+
linux: "linux",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const goos = platformMap[platform];
|
|
26
|
+
const goarch = archMap[arch];
|
|
27
|
+
|
|
28
|
+
if (!goos || !goarch) {
|
|
29
|
+
console.error(`Unsupported platform or architecture: ${platform} ${arch}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return goos === "windows"
|
|
35
|
+
? `ecrypto-${goos}-${goarch}.exe`
|
|
36
|
+
: `ecrypto-${goos}-${goarch}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function download(url, dest, cb) {
|
|
40
|
+
https.get(url, (res) => {
|
|
41
|
+
// Follow redirects
|
|
42
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
43
|
+
return download(res.headers.location, dest, cb);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (res.statusCode !== 200) {
|
|
47
|
+
console.error("❌ Failed to download:", res.statusCode, url);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const file = fs.createWriteStream(dest);
|
|
52
|
+
res.pipe(file);
|
|
53
|
+
|
|
54
|
+
file.on("finish", () => file.close(cb));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const fileName = getBinaryName();
|
|
59
|
+
const downloadUrl = `https://github.com/pandarudra/ecrypto/releases/download/${version}/${fileName}`;
|
|
60
|
+
|
|
61
|
+
console.log(`⬇️ Downloading ECRYPTO binary: ${downloadUrl}`);
|
|
62
|
+
|
|
63
|
+
// bin folder should be inside npm/ folder
|
|
64
|
+
const binDir = path.join(__dirname, "bin");
|
|
65
|
+
const binaryName = os.platform() === "win32" ? "ecrypto.exe" : "ecrypto";
|
|
66
|
+
const outputPath = path.join(binDir, binaryName);
|
|
67
|
+
|
|
68
|
+
// Ensure bin/ exists
|
|
69
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
70
|
+
|
|
71
|
+
download(downloadUrl, outputPath, () => {
|
|
72
|
+
if (os.platform() !== "win32") {
|
|
73
|
+
fs.chmodSync(outputPath, 0o755);
|
|
74
|
+
}
|
|
75
|
+
console.log("✅ ECRYPTO installed successfully.");
|
|
76
|
+
});
|