envware 1.2.6 ā 1.2.8
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 +2 -0
- package/dist/app.module.js +4 -0
- package/dist/app.module.js.map +1 -1
- package/dist/commands/keys.command.d.ts +11 -0
- package/dist/commands/keys.command.js +118 -0
- package/dist/commands/keys.command.js.map +1 -0
- package/dist/commands/nuke.command.d.ts +9 -0
- package/dist/commands/nuke.command.js +75 -0
- package/dist/commands/nuke.command.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,6 +57,8 @@ npx envware pull
|
|
|
57
57
|
- `accept`: Accept a project invitation code.
|
|
58
58
|
- `backup`: Create an encrypted local JSON backup of all owned projects.
|
|
59
59
|
- `restore`: Restore secrets from a local backup file.
|
|
60
|
+
- `keys`: Manage your authorized devices and SSH keys.
|
|
61
|
+
- `nuke`: Permanently delete your account and all data.
|
|
60
62
|
- `status`: Check your plan and usage.
|
|
61
63
|
- `upgrade`: Upgrade to Premium for higher limits.
|
|
62
64
|
|
package/dist/app.module.js
CHANGED
|
@@ -22,6 +22,8 @@ const upgrade_command_1 = require("./commands/upgrade.command");
|
|
|
22
22
|
const status_command_1 = require("./commands/status.command");
|
|
23
23
|
const backup_command_1 = require("./commands/backup.command");
|
|
24
24
|
const restore_command_1 = require("./commands/restore.command");
|
|
25
|
+
const keys_command_1 = require("./commands/keys.command");
|
|
26
|
+
const nuke_command_1 = require("./commands/nuke.command");
|
|
25
27
|
const api_service_1 = require("./services/api.service");
|
|
26
28
|
const config_service_1 = require("./services/config.service");
|
|
27
29
|
const encryption_service_1 = require("./services/encryption.service");
|
|
@@ -45,6 +47,8 @@ exports.AppModule = AppModule = __decorate([
|
|
|
45
47
|
status_command_1.StatusCommand,
|
|
46
48
|
backup_command_1.BackupCommand,
|
|
47
49
|
restore_command_1.RestoreCommand,
|
|
50
|
+
keys_command_1.KeysCommand,
|
|
51
|
+
nuke_command_1.NukeCommand,
|
|
48
52
|
api_service_1.ApiService,
|
|
49
53
|
config_service_1.ConfigService,
|
|
50
54
|
encryption_service_1.EncryptionService,
|
package/dist/app.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8DAA0D;AAC1D,4DAAwD;AACxD,gEAA4D;AAC5D,0DAAsD;AACtD,0DAAsD;AACtD,4DAAwD;AACxD,8DAA0D;AAC1D,8DAA0D;AAC1D,0DAAsD;AACtD,gEAA4D;AAC5D,gEAA4D;AAC5D,8DAA0D;AAC1D,8DAA0D;AAC1D,gEAA4D;AAC5D,wDAAoD;AACpD,8DAA0D;AAC1D,sEAAkE;
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8DAA0D;AAC1D,4DAAwD;AACxD,gEAA4D;AAC5D,0DAAsD;AACtD,0DAAsD;AACtD,4DAAwD;AACxD,8DAA0D;AAC1D,8DAA0D;AAC1D,0DAAsD;AACtD,gEAA4D;AAC5D,gEAA4D;AAC5D,8DAA0D;AAC1D,8DAA0D;AAC1D,gEAA4D;AAC5D,0DAAsD;AACtD,0DAAsD;AACtD,wDAAoD;AACpD,8DAA0D;AAC1D,sEAAkE;AAyB3D,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAvBrB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,8BAAa;YACb,4BAAY;YACZ,gCAAc;YACd,0BAAW;YACX,0BAAW;YACX,4BAAY;YACZ,8BAAa;YACb,8BAAa;YACb,0BAAW;YACX,gCAAc;YACd,gCAAc;YACd,8BAAa;YACb,8BAAa;YACb,gCAAc;YACd,0BAAW;YACX,0BAAW;YACX,wBAAU;YACV,8BAAa;YACb,sCAAiB;SAClB;KACF,CAAC;GACW,SAAS,CAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
import { ApiService } from '../services/api.service';
|
|
3
|
+
import { EncryptionService } from '../services/encryption.service';
|
|
4
|
+
export declare class KeysCommand extends CommandRunner {
|
|
5
|
+
private apiService;
|
|
6
|
+
private encryptionService;
|
|
7
|
+
constructor(apiService: ApiService, encryptionService: EncryptionService);
|
|
8
|
+
run(passedParams: string[]): Promise<void>;
|
|
9
|
+
private listKeys;
|
|
10
|
+
private removeKey;
|
|
11
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.KeysCommand = void 0;
|
|
16
|
+
const nest_commander_1 = require("nest-commander");
|
|
17
|
+
const api_service_1 = require("../services/api.service");
|
|
18
|
+
const encryption_service_1 = require("../services/encryption.service");
|
|
19
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
21
|
+
let KeysCommand = class KeysCommand extends nest_commander_1.CommandRunner {
|
|
22
|
+
apiService;
|
|
23
|
+
encryptionService;
|
|
24
|
+
constructor(apiService, encryptionService) {
|
|
25
|
+
super();
|
|
26
|
+
this.apiService = apiService;
|
|
27
|
+
this.encryptionService = encryptionService;
|
|
28
|
+
}
|
|
29
|
+
async run(passedParams) {
|
|
30
|
+
const [action, id] = passedParams;
|
|
31
|
+
if (action === 'list' || !action) {
|
|
32
|
+
await this.listKeys();
|
|
33
|
+
}
|
|
34
|
+
else if (action === 'remove') {
|
|
35
|
+
await this.removeKey(id);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(chalk_1.default.yellow('Usage: keys [list] | remove <keyId>'));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async listKeys() {
|
|
42
|
+
try {
|
|
43
|
+
console.log(chalk_1.default.blue('Fetching authorized keys... šø'));
|
|
44
|
+
const { data: keys } = await this.apiService.instance.get('/auth/keys');
|
|
45
|
+
const currentPublicKey = this.encryptionService.getPublicKey();
|
|
46
|
+
if (keys.length === 0) {
|
|
47
|
+
console.log(chalk_1.default.yellow('No keys authorized yet.'));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
console.log(chalk_1.default.bold('\nš Authorized SSH Keys / Devices:'));
|
|
51
|
+
console.log('-----------------------------------');
|
|
52
|
+
keys.forEach((k) => {
|
|
53
|
+
const isCurrent = k.publicKey === currentPublicKey;
|
|
54
|
+
const status = k.isVerified ? chalk_1.default.green('Verified') : chalk_1.default.yellow('Pending');
|
|
55
|
+
const prefix = isCurrent ? chalk_1.default.magenta('ā ') : ' ';
|
|
56
|
+
const label = isCurrent ? chalk_1.default.magenta(' (Current Device)') : '';
|
|
57
|
+
console.log(`${prefix}${chalk_1.default.cyan(k.id)}${label}`);
|
|
58
|
+
console.log(` Status: ${status}`);
|
|
59
|
+
console.log(` Key: ${k.publicKey.substring(0, 40)}...`);
|
|
60
|
+
console.log(` Added: ${new Date(k.createdAt).toLocaleDateString()}\n`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.log(chalk_1.default.red('Failed to list keys: ' + (error.response?.data?.error || error.message)));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async removeKey(keyId) {
|
|
68
|
+
try {
|
|
69
|
+
let idToDelete = keyId;
|
|
70
|
+
if (!idToDelete) {
|
|
71
|
+
const { data: keys } = await this.apiService.instance.get('/auth/keys');
|
|
72
|
+
const currentPublicKey = this.encryptionService.getPublicKey();
|
|
73
|
+
if (keys.length === 0) {
|
|
74
|
+
console.log(chalk_1.default.yellow('No keys to remove.'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const choices = keys.map((k) => ({
|
|
78
|
+
name: `${k.id} [${k.isVerified ? 'Verified' : 'Pending'}]${k.publicKey === currentPublicKey ? ' (Current Device)' : ''}`,
|
|
79
|
+
value: k.id,
|
|
80
|
+
}));
|
|
81
|
+
const answer = await inquirer_1.default.prompt([
|
|
82
|
+
{
|
|
83
|
+
type: 'list',
|
|
84
|
+
name: 'selectedId',
|
|
85
|
+
message: 'Select a key to REVOKE access:',
|
|
86
|
+
choices,
|
|
87
|
+
},
|
|
88
|
+
]);
|
|
89
|
+
idToDelete = answer.selectedId;
|
|
90
|
+
}
|
|
91
|
+
const { confirm } = await inquirer_1.default.prompt([
|
|
92
|
+
{
|
|
93
|
+
type: 'confirm',
|
|
94
|
+
name: 'confirm',
|
|
95
|
+
message: chalk_1.default.red(`Are you sure you want to REVOKE access for key ${idToDelete}? This device will no longer be able to push/pull secrets.`),
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
]);
|
|
99
|
+
if (!confirm) {
|
|
100
|
+
console.log(chalk_1.default.yellow('Operation cancelled.'));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
await this.apiService.instance.delete(`/auth/keys`, { params: { id: idToDelete } });
|
|
104
|
+
console.log(chalk_1.default.green(`\nā Access revoked successfully for key ${idToDelete}!`));
|
|
105
|
+
console.log(chalk_1.default.blue('If this was the current device, you will need to re-verify next time you push/pull. šø'));
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.log(chalk_1.default.red('Failed to remove key: ' + (error.response?.data?.error || error.message)));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
exports.KeysCommand = KeysCommand;
|
|
113
|
+
exports.KeysCommand = KeysCommand = __decorate([
|
|
114
|
+
(0, nest_commander_1.Command)({ name: 'keys', description: 'Manage your authorized devices and SSH keys' }),
|
|
115
|
+
__metadata("design:paramtypes", [api_service_1.ApiService,
|
|
116
|
+
encryption_service_1.EncryptionService])
|
|
117
|
+
], KeysCommand);
|
|
118
|
+
//# sourceMappingURL=keys.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.command.js","sourceRoot":"","sources":["../../src/commands/keys.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAwD;AACxD,yDAAqD;AACrD,uEAAmE;AACnE,kDAA0B;AAC1B,wDAAgC;AAGzB,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,8BAAa;IAElC;IACA;IAFV,YACU,UAAsB,EACtB,iBAAoC;QAE5C,KAAK,EAAE,CAAC;QAHA,eAAU,GAAV,UAAU,CAAY;QACtB,sBAAiB,GAAjB,iBAAiB,CAAmB;IAG9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,YAAsB;QAC9B,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,YAAY,CAAC;QAElC,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;YACjC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;aAAM,IAAI,MAAM,KAAK,QA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AAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,wFAAwF,CAAC,CAAC,CAAC;QAEpH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,wBAAwB,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;CACF,CAAA;AArGY,kCAAW;sBAAX,WAAW;IADvB,IAAA,wBAAO,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;qCAG9D,wBAAU;QACH,sCAAiB;GAHnC,WAAW,CAqGvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
import { ApiService } from '../services/api.service';
|
|
3
|
+
import { ConfigService } from '../services/config.service';
|
|
4
|
+
export declare class NukeCommand extends CommandRunner {
|
|
5
|
+
private apiService;
|
|
6
|
+
private configService;
|
|
7
|
+
constructor(apiService: ApiService, configService: ConfigService);
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.NukeCommand = void 0;
|
|
16
|
+
const nest_commander_1 = require("nest-commander");
|
|
17
|
+
const api_service_1 = require("../services/api.service");
|
|
18
|
+
const config_service_1 = require("../services/config.service");
|
|
19
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
21
|
+
let NukeCommand = class NukeCommand extends nest_commander_1.CommandRunner {
|
|
22
|
+
apiService;
|
|
23
|
+
configService;
|
|
24
|
+
constructor(apiService, configService) {
|
|
25
|
+
super();
|
|
26
|
+
this.apiService = apiService;
|
|
27
|
+
this.configService = configService;
|
|
28
|
+
}
|
|
29
|
+
async run() {
|
|
30
|
+
console.log(chalk_1.default.red.bold('\nā ļø DANGER ZONE ā ļø'));
|
|
31
|
+
console.log(chalk_1.default.red('This action is irreversible. All your projects, secrets, and authorized keys will be deleted forever.\n'));
|
|
32
|
+
const { confirmEmail } = await inquirer_1.default.prompt([
|
|
33
|
+
{
|
|
34
|
+
type: 'input',
|
|
35
|
+
name: 'confirmEmail',
|
|
36
|
+
message: 'To confirm, please type your email address:',
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
const { data: me } = await this.apiService.instance.get('/auth/me');
|
|
40
|
+
if (confirmEmail !== me.email) {
|
|
41
|
+
console.log(chalk_1.default.yellow('\nVerification failed. The email provided does not match your account. Action cancelled. šø'));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const { finalConsent } = await inquirer_1.default.prompt([
|
|
45
|
+
{
|
|
46
|
+
type: 'confirm',
|
|
47
|
+
name: 'finalConsent',
|
|
48
|
+
message: chalk_1.default.red.bold('Are you ABSOLUTELY sure? There is no "undo" button.'),
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
if (!finalConsent) {
|
|
53
|
+
console.log(chalk_1.default.yellow('\nPhew! That was close. Account is safe. šø'));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
console.log(chalk_1.default.gray('\nNuking account from orbit... šš„'));
|
|
58
|
+
await this.apiService.instance.delete('/auth/me');
|
|
59
|
+
this.configService.delete('token');
|
|
60
|
+
console.log(chalk_1.default.green('\nā Your account and all data have been deleted. We are sorry to see you go. šø'));
|
|
61
|
+
console.log(chalk_1.default.gray('Goodbye, traveler.\n'));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error.response?.data?.error || error.message;
|
|
65
|
+
console.log(chalk_1.default.red('\nFailed to delete account: ' + message));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.NukeCommand = NukeCommand;
|
|
70
|
+
exports.NukeCommand = NukeCommand = __decorate([
|
|
71
|
+
(0, nest_commander_1.Command)({ name: 'nuke', description: 'Permanently delete your account and all associated data' }),
|
|
72
|
+
__metadata("design:paramtypes", [api_service_1.ApiService,
|
|
73
|
+
config_service_1.ConfigService])
|
|
74
|
+
], NukeCommand);
|
|
75
|
+
//# sourceMappingURL=nuke.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuke.command.js","sourceRoot":"","sources":["../../src/commands/nuke.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAwD;AACxD,yDAAqD;AACrD,+DAA2D;AAC3D,kDAA0B;AAC1B,wDAAgC;AAGzB,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,8BAAa;IAElC;IACA;IAFV,YACU,UAAsB,EACtB,aAA4B;QAEpC,KAAK,EAAE,CAAC;QAHA,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GA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