secrez 1.1.3 → 1.1.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/README.md +15 -6
- package/bin/secrez.js +8 -2
- package/coverage.report +29 -29
- package/package.json +1 -1
- package/src/commands/Touch.js +7 -7
- 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,15 @@ 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.5**
|
375
|
+
|
376
|
+
- fix touch's help showing wrong, temporary options, changed during the development :-(
|
377
|
+
|
378
|
+
**1.1.4**
|
379
|
+
|
380
|
+
- 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 :-(
|
381
|
+
- add option `--timeout, -t` to customize the timeout when launching secrez
|
382
|
+
|
374
383
|
**1.1.3**
|
375
384
|
|
376
385
|
- 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 +828,16 @@ Thank you for any contributions! 😉
|
|
819
828
|
## Test coverage
|
820
829
|
|
821
830
|
```
|
822
|
-
166 passing (
|
831
|
+
166 passing (24s)
|
823
832
|
1 pending
|
824
833
|
|
825
834
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
826
835
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
827
836
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
828
|
-
All files | 71.
|
837
|
+
All files | 71.22 | 58.41 | 71.25 | 71.11 |
|
829
838
|
src | 59.63 | 54.79 | 55 | 60.19 |
|
830
839
|
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-
|
840
|
+
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 8-99,116
|
832
841
|
cliConfig.js | 100 | 100 | 100 | 100 |
|
833
842
|
src/commands | 81.53 | 67 | 89.95 | 81.4 |
|
834
843
|
Alias.js | 90.54 | 77.36 | 100 | 90.41 | 101,112,139,169,173,180,190
|
@@ -876,10 +885,10 @@ All files | 71.47 | 58.49 | 71.98 | 71.36 |
|
|
876
885
|
Send.js | 67.65 | 46.67 | 100 | 67.65 | 37,41,44,77,86-95
|
877
886
|
Show.js | 68.75 | 70.59 | 100 | 68.75 | 74-78,87,102-108
|
878
887
|
Whoami.js | 42.86 | 0 | 60 | 42.86 | 22,30-39
|
879
|
-
src/prompts |
|
880
|
-
ChatPrompt.js |
|
888
|
+
src/prompts | 14.72 | 0 | 13.43 | 14.85 |
|
889
|
+
ChatPrompt.js | 6.1 | 0 | 0 | 6.1 | 8-164
|
881
890
|
ChatPromptMock.js | 100 | 100 | 66.67 | 100 |
|
882
|
-
CommandPrompt.js |
|
891
|
+
CommandPrompt.js | 9.8 | 0 | 0 | 9.93 | 24-318
|
883
892
|
Completion.js | 4.41 | 0 | 0 | 4.48 | 6-103
|
884
893
|
MainPromptMock.js | 100 | 100 | 66.67 | 100 |
|
885
894
|
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.5 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 (1033ms)
|
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 (168ms)
|
45
45
|
|
46
46
|
#Contacts
|
47
47
|
✓ should return the help
|
@@ -55,9 +55,9 @@
|
|
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 (391ms)
|
59
|
+
✓ should copy a string to the clipboard (246ms)
|
60
|
+
✓ should copy a card to the clipboard (889ms)
|
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
|
|
@@ -65,7 +65,7 @@
|
|
65
65
|
✓ should return the help
|
66
66
|
✓ should check if it is ready
|
67
67
|
✓ should set up the courier (143ms)
|
68
|
-
✓ should set up the courier and get the default message when is already set up (
|
68
|
+
✓ should set up the courier and get the default message when is already set up (145ms)
|
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 (1206ms)
|
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 (716ms)
|
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 (1034ms)
|
89
89
|
✓ should find no result without parameters
|
90
90
|
✓ should skip binary files from search
|
91
91
|
|
@@ -150,7 +150,7 @@
|
|
150
150
|
|
151
151
|
#Mv
|
152
152
|
✓ should return the help
|
153
|
-
✓ should rename a file (
|
153
|
+
✓ should rename a file (1012ms)
|
154
154
|
✓ should move a file to another folder
|
155
155
|
✓ should move many files to another folder
|
156
156
|
✓ should move a file to another subfolder
|
@@ -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 (1013ms)
|
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 (82ms)
|
168
|
+
✓ should paste the clipboard content to an existent file (89ms)
|
169
|
+
✓ should paste a single field to a yml card (57ms)
|
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 (1009ms)
|
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 (359ms)
|
200
|
+
✓ should read a totp secret from an image and add the totp field to the card (49ms)
|
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 (110ms)
|
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 (49ms)
|
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 (99ms)
|
252
252
|
|
253
253
|
#Show
|
254
254
|
✓ should return the help
|
255
|
-
✓ should show history messages (
|
255
|
+
✓ should show history messages (367ms)
|
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
package/src/commands/Touch.js
CHANGED
@@ -80,31 +80,31 @@ class Touch extends require("../Command") {
|
|
80
80
|
'touch -p afile --content "Password: 1432874565"',
|
81
81
|
'touch ether -c "Private Key: eweiu34y23h4y23ih4uy23hiu4y234i23y4iuh3"',
|
82
82
|
[
|
83
|
-
"touch sample.txt -
|
84
|
-
"Prompt the user to type the content of the file. The text cannot contain newlines. It will cut at the first one, if so. If '-
|
83
|
+
"touch sample.txt -w",
|
84
|
+
"Prompt the user to type the content of the file. The text cannot contain newlines. It will cut at the first one, if so. If '-w' and '-c' are both present, '-c' will be ignored.",
|
85
85
|
],
|
86
86
|
[
|
87
87
|
"touch walletPassword -n",
|
88
|
-
"Prompt the user to type the password without showing it. Notice that '-n' has priority on '-
|
88
|
+
"Prompt the user to type the password without showing it. Notice that '-n' has priority on '-w' and '-c'",
|
89
89
|
],
|
90
90
|
[
|
91
91
|
"touch gilbert -f name -c 'Albert Goose'",
|
92
92
|
"If the file does not exists, it creates 'gilbert.yaml' with the field 'name'. If a yaml file exists, it adds the field 'name' to it if the the field does not exist.",
|
93
93
|
],
|
94
94
|
[
|
95
|
-
"touch new-wallet -
|
95
|
+
"touch new-wallet -g",
|
96
96
|
"Creates a new wallet file containing 'private_key' and `address`. Wallet has priority on other creation options.",
|
97
97
|
],
|
98
98
|
[
|
99
|
-
"touch new-wallets.yaml -
|
99
|
+
"touch new-wallets.yaml -g --amount 3",
|
100
100
|
"Creates 'new-wallets.yaml', containing 3 wallet, calling them 'private_key', `private_key2` and `private_key3`, and relative addresses.",
|
101
101
|
],
|
102
102
|
[
|
103
|
-
"touch new-wallet --wallet -x trust0",
|
103
|
+
"touch new-wallet --generate-wallet -x trust0",
|
104
104
|
"In combination con '-x', it creates a new wallet file calling the fields 'trust0_private_key' and 'trust0_address'.",
|
105
105
|
],
|
106
106
|
[
|
107
|
-
"touch new-wallets.yaml -
|
107
|
+
"touch new-wallets.yaml -gi",
|
108
108
|
"Includes the mnemonic. In this case, it will also add the fields 'mnemonic' (mnemonic phrase) and 'derived_path' (path used to generate the keys). ",
|
109
109
|
],
|
110
110
|
],
|
@@ -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
|