s-bit-agent
Version:
s.BitAgent is a simple Bitwarden CLI wrapper which provides a SSH2 Key Agent solution for Bitwarden.
60 lines • 2.85 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusCommand = void 0;
const nest_commander_1 = require("nest-commander");
const log_service_1 = require("../shared/log.service");
const Colors = require("colors");
const agent_service_1 = require("../icp/agent.service");
const fs_1 = require("fs");
const child_process_1 = require("child_process");
let StatusCommand = class StatusCommand extends nest_commander_1.CommandRunner {
constructor(logService, agentService) {
super();
this.logService = logService;
this.agentService = agentService;
}
async run() {
this.logService.info(`s.BitAgent - Version: 0.0.6`);
this.logService.info('Copyright 2024 - Joschua Becker EDV');
this.logService.log('-----------------------------------');
const status = [
{ name: 'Description', status: 'Status' },
{ name: 'Daemon Service', status: (0, fs_1.existsSync)(this.agentService.file) },
];
for (const service of status) {
const name = service.name.padEnd(20, ' ');
const color = service.status ? Colors.green : Colors.red;
this.logService.raw(name, typeof service.status === 'string'
? service.status
: color(service.status ? 'Yes' : 'No'));
}
this.logService.log('-----------------------------------');
this.logService.log('modulus signature name (type)');
(0, child_process_1.spawnSync)('ssh-add', ['-l'], {
stdio: 'inherit',
env: {
...process.env,
SSH_AUTH_SOCK: this.agentService.file,
},
});
}
};
exports.StatusCommand = StatusCommand;
exports.StatusCommand = StatusCommand = __decorate([
(0, nest_commander_1.Command)({
name: 'status',
description: 'Get the current status of s.BitAgent',
}),
__metadata("design:paramtypes", [log_service_1.LogService,
agent_service_1.AgentService])
], StatusCommand);
//# sourceMappingURL=status.command.js.map