secrez 1.1.3 → 1.1.4
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 +11 -6
- package/bin/secrez.js +8 -2
- package/coverage.report +29 -29
- package/package.json +1 -1
- package/src/prompts/ChatPrompt.js +1 -0
- package/src/prompts/CommandPrompt.js +22 -0
- package/src/prompts/MainPrompt.js +4 -0
package/README.md
CHANGED
@@ -371,6 +371,11 @@ Secrez is not intended to compete with password managers, so do not expect it to
|
|
371
371
|
|
372
372
|
## History
|
373
373
|
|
374
|
+
**1.1.4**
|
375
|
+
|
376
|
+
- add clear screen after 180 seconds to avoid that the user forgot its terminal open and accidentally shares it while sharing the screen during meetings — it happened to me :-(
|
377
|
+
- add option `--timeout, -t` to customize the timeout when launching secrez
|
378
|
+
|
374
379
|
**1.1.3**
|
375
380
|
|
376
381
|
- add new option `--keystore, -k` to `export`. If a file contains a private key field (i.e., a field with a name containing `private_key`), it can be exported in the keystore format. The file will have the same name with the extension replaced with `.keystore.json`.
|
@@ -819,16 +824,16 @@ Thank you for any contributions! 😉
|
|
819
824
|
## Test coverage
|
820
825
|
|
821
826
|
```
|
822
|
-
166 passing (
|
827
|
+
166 passing (24s)
|
823
828
|
1 pending
|
824
829
|
|
825
830
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
826
831
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
827
832
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
828
|
-
All files | 71.
|
833
|
+
All files | 71.22 | 58.41 | 71.25 | 71.11 |
|
829
834
|
src | 59.63 | 54.79 | 55 | 60.19 |
|
830
835
|
Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
|
831
|
-
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 8-
|
836
|
+
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 8-99,116
|
832
837
|
cliConfig.js | 100 | 100 | 100 | 100 |
|
833
838
|
src/commands | 81.53 | 67 | 89.95 | 81.4 |
|
834
839
|
Alias.js | 90.54 | 77.36 | 100 | 90.41 | 101,112,139,169,173,180,190
|
@@ -876,10 +881,10 @@ All files | 71.47 | 58.49 | 71.98 | 71.36 |
|
|
876
881
|
Send.js | 67.65 | 46.67 | 100 | 67.65 | 37,41,44,77,86-95
|
877
882
|
Show.js | 68.75 | 70.59 | 100 | 68.75 | 74-78,87,102-108
|
878
883
|
Whoami.js | 42.86 | 0 | 60 | 42.86 | 22,30-39
|
879
|
-
src/prompts |
|
880
|
-
ChatPrompt.js |
|
884
|
+
src/prompts | 14.72 | 0 | 13.43 | 14.85 |
|
885
|
+
ChatPrompt.js | 6.1 | 0 | 0 | 6.1 | 8-164
|
881
886
|
ChatPromptMock.js | 100 | 100 | 66.67 | 100 |
|
882
|
-
CommandPrompt.js |
|
887
|
+
CommandPrompt.js | 9.8 | 0 | 0 | 9.93 | 24-318
|
883
888
|
Completion.js | 4.41 | 0 | 0 | 4.48 | 6-103
|
884
889
|
MainPromptMock.js | 100 | 100 | 66.67 | 100 |
|
885
890
|
MultiEditorPrompt.js | 25 | 0 | 0 | 25 | 7-36
|
package/bin/secrez.js
CHANGED
@@ -31,6 +31,11 @@ const optionDefinitions = [
|
|
31
31
|
alias: "s",
|
32
32
|
type: Boolean,
|
33
33
|
},
|
34
|
+
{
|
35
|
+
name: "timeout",
|
36
|
+
alias: "t",
|
37
|
+
type: Number,
|
38
|
+
},
|
34
39
|
{
|
35
40
|
name: "localDir",
|
36
41
|
alias: "l",
|
@@ -100,12 +105,13 @@ Options:
|
|
100
105
|
-s, --save-iterations Saves the number of iterations in env.json (which
|
101
106
|
is git-ignored). Do it only if you computer is very safe.
|
102
107
|
-l, --localDir The local (out of the enctrypted fs) working dir. "~" by default.
|
103
|
-
|
108
|
+
-t, --timeout The timeout in seconds before the screen is cleared. By default it is 180 seconds.
|
109
|
+
|
104
110
|
Examples:
|
105
111
|
$ secrez
|
106
112
|
$ secrez -c /var/my-secrets -i 787099 -l ~/Desktop
|
107
113
|
$ secrez -si 1213672
|
108
|
-
$ secrez -c ~/.secrez-archive
|
114
|
+
$ secrez -c ~/.secrez-archive -t 60
|
109
115
|
|
110
116
|
`
|
111
117
|
);
|
package/coverage.report
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> secrez@1.1.
|
2
|
+
> secrez@1.1.4 test /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
|
3
3
|
> cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.test.js test/**/*.test.js test/**/**/*.js --exit
|
4
4
|
|
5
5
|
|
@@ -29,10 +29,10 @@
|
|
29
29
|
#Cat
|
30
30
|
✓ should return the help
|
31
31
|
✓ should show the content of a file
|
32
|
-
✓ should show either one or all the versions of a file (
|
32
|
+
✓ should show either one or all the versions of a file (1021ms)
|
33
33
|
✓ should throw if entry is not a file or file does not exist
|
34
34
|
✓ should throw if trying to cat a binary file
|
35
|
-
✓ should show the content of a Yaml file (
|
35
|
+
✓ should show the content of a Yaml file (1023ms)
|
36
36
|
|
37
37
|
#Cd
|
38
38
|
✓ should return the help
|
@@ -41,7 +41,7 @@
|
|
41
41
|
|
42
42
|
#Chat
|
43
43
|
✓ should return the help
|
44
|
-
✓ should run the chat if the courier is ready (
|
44
|
+
✓ should run the chat if the courier is ready (164ms)
|
45
45
|
|
46
46
|
#Contacts
|
47
47
|
✓ should return the help
|
@@ -55,17 +55,17 @@
|
|
55
55
|
|
56
56
|
#Copy
|
57
57
|
✓ should return the help
|
58
|
-
✓ should copy a file to the clipboard (
|
59
|
-
✓ should copy a string to the clipboard (
|
60
|
-
✓ should copy a card to the clipboard (
|
58
|
+
✓ should copy a file to the clipboard (376ms)
|
59
|
+
✓ should copy a string to the clipboard (246ms)
|
60
|
+
✓ should copy a card to the clipboard (855ms)
|
61
61
|
✓ should return an error if the file does not exist or is a folder
|
62
62
|
✓ should throw if copying to clipboard a binary files
|
63
63
|
|
64
64
|
#Courier
|
65
65
|
✓ should return the help
|
66
66
|
✓ should check if it is ready
|
67
|
-
✓ should set up the courier (
|
68
|
-
✓ should set up the courier and get the default message when is already set up (
|
67
|
+
✓ should set up the courier (140ms)
|
68
|
+
✓ should set up the courier and get the default message when is already set up (144ms)
|
69
69
|
|
70
70
|
#Ds
|
71
71
|
✓ should return the help
|
@@ -79,13 +79,13 @@
|
|
79
79
|
✓ should export a file to the current local folder
|
80
80
|
✓ should export a binary file to the current local folder
|
81
81
|
✓ should export an encrypted file to the current local folder
|
82
|
-
✓ should export a file and delete it after 1 second (
|
82
|
+
✓ should export a file and delete it after 1 second (1205ms)
|
83
83
|
✓ should return an error if the file does not exist or is a folder
|
84
|
-
✓ should export a keystore json file if a private_key exists in the entry (
|
84
|
+
✓ should export a keystore json file if a private_key exists in the entry (726ms)
|
85
85
|
|
86
86
|
#Find
|
87
87
|
✓ should return the help
|
88
|
-
✓ should show find a string in the tree (
|
88
|
+
✓ should show find a string in the tree (1031ms)
|
89
89
|
✓ should find no result without parameters
|
90
90
|
✓ should skip binary files from search
|
91
91
|
|
@@ -159,14 +159,14 @@
|
|
159
159
|
✓ should move file to another dataset using wildcards
|
160
160
|
✓ should move file managing duplicates
|
161
161
|
✓ should throw if parameters are missed or wrong
|
162
|
-
✓ should move files from and to other datasets (
|
162
|
+
✓ should move files from and to other datasets (1027ms)
|
163
163
|
✓ should move the results of a find
|
164
164
|
|
165
165
|
#Paste
|
166
166
|
✓ should return the help
|
167
|
-
✓ should paste the clipboard content to a new file (
|
168
|
-
✓ should paste the clipboard content to an existent file (
|
169
|
-
✓ should paste a single field to a yml card (
|
167
|
+
✓ should paste the clipboard content to a new file (51ms)
|
168
|
+
✓ should paste the clipboard content to an existent file (71ms)
|
169
|
+
✓ should paste a single field to a yml card (63ms)
|
170
170
|
|
171
171
|
#Pwd
|
172
172
|
✓ should return the help
|
@@ -180,7 +180,7 @@
|
|
180
180
|
✓ should delete a file with one version
|
181
181
|
✓ should delete many files usign wildcards
|
182
182
|
✓ should return errors if wrong parameters
|
183
|
-
✓ should delete some versions of a file (
|
183
|
+
✓ should delete some versions of a file (1011ms)
|
184
184
|
|
185
185
|
#Shell
|
186
186
|
✓ should return the help
|
@@ -196,13 +196,13 @@
|
|
196
196
|
|
197
197
|
#Totp
|
198
198
|
✓ should return the help
|
199
|
-
✓ should totp a file to the clipboard (
|
200
|
-
✓ should read a totp secret from an image and add the totp field to the card (
|
199
|
+
✓ should totp a file to the clipboard (365ms)
|
200
|
+
✓ should read a totp secret from an image and add the totp field to the card (50ms)
|
201
201
|
✓ should read a totp secret from an image and return the secret
|
202
202
|
✓ should throw if bad image
|
203
203
|
✓ should throw if missing parameters
|
204
204
|
✓ should throw if the yaml is malformed
|
205
|
-
✓ should read a totp secret from the clipboard (
|
205
|
+
✓ should read a totp secret from the clipboard (87ms)
|
206
206
|
|
207
207
|
#Touch
|
208
208
|
✓ should return the help
|
@@ -244,27 +244,27 @@ New file "/folder2/file1" created.
|
|
244
244
|
|
245
245
|
#Quit
|
246
246
|
✓ should return the help
|
247
|
-
✓ should quit the chat, even if inside a room (
|
247
|
+
✓ should quit the chat, even if inside a room (51ms)
|
248
248
|
|
249
249
|
#Send
|
250
250
|
✓ should return the help
|
251
|
-
✓ should send a message to user0 (
|
251
|
+
✓ should send a message to user0 (87ms)
|
252
252
|
|
253
253
|
#Show
|
254
254
|
✓ should return the help
|
255
|
-
✓ should show history messages (
|
255
|
+
✓ should show history messages (369ms)
|
256
256
|
|
257
257
|
|
258
|
-
166 passing (
|
258
|
+
166 passing (24s)
|
259
259
|
1 pending
|
260
260
|
|
261
261
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
262
262
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
263
263
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
264
|
-
All files | 71.
|
264
|
+
All files | 71.22 | 58.41 | 71.25 | 71.11 |
|
265
265
|
src | 59.63 | 54.79 | 55 | 60.19 |
|
266
266
|
Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
|
267
|
-
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 8-
|
267
|
+
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 8-99,116
|
268
268
|
cliConfig.js | 100 | 100 | 100 | 100 |
|
269
269
|
src/commands | 81.53 | 67 | 89.95 | 81.4 |
|
270
270
|
Alias.js | 90.54 | 77.36 | 100 | 90.41 | 101,112,139,169,173,180,190
|
@@ -312,10 +312,10 @@ All files | 71.47 | 58.49 | 71.98 | 71.36 |
|
|
312
312
|
Send.js | 67.65 | 46.67 | 100 | 67.65 | 37,41,44,77,86-95
|
313
313
|
Show.js | 68.75 | 70.59 | 100 | 68.75 | 74-78,87,102-108
|
314
314
|
Whoami.js | 42.86 | 0 | 60 | 42.86 | 22,30-39
|
315
|
-
src/prompts |
|
316
|
-
ChatPrompt.js |
|
315
|
+
src/prompts | 14.72 | 0 | 13.43 | 14.85 |
|
316
|
+
ChatPrompt.js | 6.1 | 0 | 0 | 6.1 | 8-164
|
317
317
|
ChatPromptMock.js | 100 | 100 | 66.67 | 100 |
|
318
|
-
CommandPrompt.js |
|
318
|
+
CommandPrompt.js | 9.8 | 0 | 0 | 9.93 | 24-318
|
319
319
|
Completion.js | 4.41 | 0 | 0 | 4.48 | 6-103
|
320
320
|
MainPromptMock.js | 100 | 100 | 66.67 | 100 |
|
321
321
|
MultiEditorPrompt.js | 25 | 0 | 0 | 25 | 7-36
|
package/package.json
CHANGED
@@ -20,6 +20,28 @@ const sigintManager = require("./SigintManager");
|
|
20
20
|
let thiz;
|
21
21
|
|
22
22
|
class CommandPrompt {
|
23
|
+
constructor() {
|
24
|
+
this.timeoutId = null;
|
25
|
+
this.clearScreenTimeout = 180;
|
26
|
+
}
|
27
|
+
|
28
|
+
clearScreen() {
|
29
|
+
process.stdout.write("\u001b[2J\u001b[0;0H");
|
30
|
+
process.stdout.write(
|
31
|
+
`Screen cleared. Press any key to reactivate the terminal`
|
32
|
+
);
|
33
|
+
}
|
34
|
+
|
35
|
+
resetTimeout() {
|
36
|
+
const s = 180000;
|
37
|
+
if (this.timeoutId) {
|
38
|
+
clearTimeout(this.timeoutId);
|
39
|
+
}
|
40
|
+
this.timeoutId = setTimeout(() => {
|
41
|
+
this.clearScreen();
|
42
|
+
}, this.clearScreenTimeout * 1000);
|
43
|
+
}
|
44
|
+
|
23
45
|
async getReady(options) {
|
24
46
|
thiz = this;
|
25
47
|
this.inquirer = inquirer;
|
@@ -27,6 +27,9 @@ class MainPrompt extends require("./CommandPrompt") {
|
|
27
27
|
commands: new Commands(this, cliConfig).getCommands(),
|
28
28
|
});
|
29
29
|
this.cache = {};
|
30
|
+
if (options.timeout) {
|
31
|
+
this.clearScreenTimeout = options.timeout;
|
32
|
+
}
|
30
33
|
}
|
31
34
|
|
32
35
|
async preRun(options = {}) {
|
@@ -73,6 +76,7 @@ class MainPrompt extends require("./CommandPrompt") {
|
|
73
76
|
}
|
74
77
|
|
75
78
|
prePromptMessage(options = {}) {
|
79
|
+
this.resetTimeout();
|
76
80
|
return chalk.reset(
|
77
81
|
`Secrez ${
|
78
82
|
this.internalFs.tree.name
|