@fsg-vault/agent 1.0.9 → 1.0.11

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/dist/cli.js CHANGED
@@ -1,11 +1,45 @@
1
1
  #!/usr/bin/env node
2
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
+ })();
3
36
  Object.defineProperty(exports, "__esModule", { value: true });
4
37
  const commander_1 = require("commander");
5
38
  const child_process_1 = require("child_process");
39
+ const path = __importStar(require("path"));
6
40
  const program = new commander_1.Command();
7
41
  program
8
- .version('1.0.8')
42
+ .version('1.0.11')
9
43
  .description('FSG-Vault Agent: Secure Environment Injection')
10
44
  .requiredOption('-k, --key <string>', 'Master Key to decrypt the vault')
11
45
  .requiredOption('-a, --api-key <string>', 'API Key to authenticate with the vault server')
@@ -17,7 +51,7 @@ program
17
51
  program.parse(process.argv);
18
52
  const options = program.opts();
19
53
  const [command, ...args] = program.args;
20
- const VERSION = '1.0.8';
54
+ const VERSION = '1.0.11';
21
55
  const BANNER = String.raw `
22
56
  ________ ________ ________ ___ ___ ________ ___ ___ ___ _________
23
57
  |\ _____\\ ____\|\ ____\ |\ \ / /|\ __ \|\ \|\ \|\ \ |\___ ___\
@@ -27,12 +61,29 @@ const BANNER = String.raw `
27
61
  \ \__\ ____\_\ \ \_______\ \ \__/ / \ \__\ \__\ \_______\ \_______\ \__\
28
62
  \|__| |\_________\|_______| \|__|/ \|__|\|__|\|_______|\|_______|\|__|
29
63
  \|_________|
30
- v${VERSION}
64
+ v${VERSION}
31
65
  `;
32
66
  async function run() {
33
67
  process.stdout.write('\x1Bc'); // Clear screen
34
68
  console.log('\x1b[36m%s\x1b[0m', BANNER);
35
69
  console.log('\x1b[33m[1/3]\x1b[0m Connecting to Vault Server...');
70
+ let nativeVault;
71
+ try {
72
+ nativeVault = require('bindings')('fsg_vault');
73
+ }
74
+ catch (e) {
75
+ try {
76
+ // Fallback for prebuildify scoped naming
77
+ const prebuildPath = path.join(__dirname, '..', 'prebuilds', `${process.platform}-${process.arch}`, '@fsg-vault+agent.node');
78
+ nativeVault = require(prebuildPath);
79
+ }
80
+ catch (e2) {
81
+ console.error('\n\x1b[31m[ERROR]\x1b[0m Native binary not found for your platform!');
82
+ console.error('\x1b[33m[FIX]\x1b[0m Please run this command on your server to build it locally:');
83
+ console.error('\x1b[37m cd node_modules/@fsg-vault/agent && npm run build\x1b[0m\n');
84
+ process.exit(1);
85
+ }
86
+ }
36
87
  // 1. Fetch Ciphertext from Backend API
37
88
  let ciphertext = '';
38
89
  let iv = '';
@@ -1,7 +1,40 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  const proxy_1 = require("./proxy");
4
- const path = require('path');
37
+ const path = __importStar(require("path"));
5
38
  // Using node-addon-api bindings.
6
39
  // Prebuildify may name the file '@fsg-vault+agent.node' in some environments.
7
40
  let nativeVault;
@@ -9,9 +42,17 @@ try {
9
42
  nativeVault = require('bindings')('fsg_vault');
10
43
  }
11
44
  catch (e) {
12
- // Fallback for prebuildify scoped naming
13
- const prebuildPath = path.join(__dirname, '..', 'prebuilds', `${process.platform}-${process.arch}`, '@fsg-vault+agent.node');
14
- nativeVault = require(prebuildPath);
45
+ try {
46
+ // Fallback for prebuildify scoped naming
47
+ const prebuildPath = path.join(__dirname, '..', 'prebuilds', `${process.platform}-${process.arch}`, '@fsg-vault+agent.node');
48
+ nativeVault = require(prebuildPath);
49
+ }
50
+ catch (e2) {
51
+ console.error('\n\x1b[31m[ERROR]\x1b[0m Native binary not found for your platform!');
52
+ console.error('\x1b[33m[FIX]\x1b[0m Please run this command on your server to build it locally:');
53
+ console.error('\x1b[37m cd node_modules/@fsg-vault/agent && npm run build\x1b[0m\n');
54
+ process.exit(1);
55
+ }
15
56
  }
16
57
  // Fetching args passed from CLI
17
58
  const masterKey = process.env.FSG_MASTER_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fsg-vault/agent",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "FSG Vault Agent CLI",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {