secrez 2.1.6 → 2.1.7

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 CHANGED
@@ -369,6 +369,10 @@ Secrez is not intended to compete with password managers, so do not expect it to
369
369
 
370
370
  ## History
371
371
 
372
+ **2.1.7**
373
+
374
+ - add option `--no-export` to `export --crypto-env` to display the encrypted content in the console instead of writing it to a file
375
+
372
376
  **2.1.6**
373
377
 
374
378
  - export and encrypt, with option `--crypto-env`, the entire content of an item
@@ -861,7 +865,60 @@ Thank you for any contributions! 😉
861
865
  ## Test coverage
862
866
 
863
867
  ```
864
-
868
+ 1 passing (549ms)
869
+
870
+ --------------------|---------|----------|---------|---------|--------------------------------------
871
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
872
+ --------------------|---------|----------|---------|---------|--------------------------------------
873
+ All files | 18.98 | 5.52 | 20.28 | 19.04 |
874
+ src | 30.39 | 14.49 | 21.05 | 30.69 |
875
+ Command.js | 32.2 | 21.27 | 30.76 | 32.75 | 22-35,40-97,102,108,119,122-130
876
+ PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
877
+ cliConfig.js | 100 | 100 | 100 | 100 |
878
+ src/commands | 18.27 | 4.93 | 22.16 | 18.35 |
879
+ Alias.js | 8.1 | 0 | 25 | 8.21 | 62-213
880
+ Bash.js | 62.5 | 0 | 33.33 | 62.5 | 11-19
881
+ Cat.js | 29.67 | 17.46 | 42.85 | 29.67 | 61-93,98,110,117-142,150-169,178-220
882
+ Cd.js | 17.85 | 0 | 25 | 17.85 | 28-73
883
+ Conf.js | 7.79 | 0 | 10 | 7.79 | 67-500
884
+ Contacts.js | 5.98 | 0 | 7.69 | 6.03 | 53-274
885
+ Copy.js | 10.98 | 0 | 12.5 | 11.11 | 71-268
886
+ Ds.js | 5.97 | 0 | 16.66 | 6.06 | 39-160
887
+ Edit.js | 12.34 | 0 | 20 | 12.34 | 61-214
888
+ Export.js | 50 | 26.92 | 50 | 50 | ...8,209,219-295,301,307-308,316-323
889
+ Find.js | 7.69 | 0 | 8.33 | 7.89 | 63-211
890
+ Help.js | 33.33 | 0 | 50 | 33.33 | 26-43
891
+ Import.js | 6.31 | 0 | 9.09 | 6.37 | 87-496
892
+ Lcat.js | 30 | 0 | 25 | 30 | 35-65
893
+ Lcd.js | 17.39 | 0 | 25 | 17.39 | 30-72
894
+ Lls.js | 40.9 | 9.09 | 50 | 40.9 | 49,68,74-99
895
+ Lpwd.js | 38.46 | 0 | 50 | 38.46 | 15,29-38
896
+ Ls.js | 5.79 | 0 | 10 | 6.15 | 46-183
897
+ Mkdir.js | 22.72 | 0 | 25 | 22.72 | 27-61
898
+ Mv.js | 6.52 | 0 | 16.66 | 6.66 | 46-240
899
+ Paste.js | 14.89 | 0 | 25 | 14.89 | 40-131
900
+ Pwd.js | 30.76 | 0 | 25 | 30.76 | 15-35
901
+ Quit.js | 50 | 0 | 33.33 | 50 | 19-40
902
+ Rm.js | 16 | 0 | 16.66 | 16.32 | 36-137
903
+ Shell.js | 29.41 | 0 | 25 | 29.41 | 25-57
904
+ Show.js | 16 | 0 | 14.28 | 16.32 | 45-145
905
+ Ssh.js | 22.22 | 0 | 20 | 22.22 | 49-120
906
+ Tag.js | 8.82 | 0 | 9.09 | 8.91 | 66-236
907
+ Totp.js | 14.58 | 0 | 9.09 | 14.58 | 76-312
908
+ Touch.js | 76 | 51.85 | 75 | 75.51 | 75,140,152-158,164,168,177,231-234
909
+ Use.js | 12.9 | 0 | 25 | 12.9 | 30-85
910
+ Ver.js | 50 | 0 | 33.33 | 50 | 17-28
911
+ Whoami.js | 27.77 | 0 | 20 | 27.77 | 20-50
912
+ index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
913
+ src/prompts | 100 | 100 | 33.33 | 100 |
914
+ MainPromptMock.js | 100 | 100 | 33.33 | 100 |
915
+ src/utils | 14.97 | 5.46 | 10.41 | 14.75 |
916
+ AliasManager.js | 5.88 | 0 | 0 | 5.88 | 3-48
917
+ ContactManager.js | 6.66 | 0 | 0 | 6.66 | 3-44
918
+ Fido2Client.js | 9.61 | 0 | 0 | 9.61 | 8-108
919
+ HelpProto.js | 4.2 | 0 | 16.66 | 4.27 | 11-200
920
+ Logger.js | 56.81 | 43.75 | 21.05 | 55.81 | ...16-29,37-57,65-69,74,84,88,93,105
921
+ --------------------|---------|----------|---------|---------|--------------------------------------
865
922
  ```
866
923
 
867
924
  ## Copyright
package/coverage.report CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- > secrez@2.1.6 test /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
2
+ > secrez@2.1.7 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 (1012ms)
32
+ ✓ should show either one or all the versions of a file (1013ms)
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 (1018ms)
35
+ ✓ should show the content of a Yaml file (1017ms)
36
36
 
37
37
  #Cd
38
38
  ✓ should return the help
@@ -51,10 +51,10 @@
51
51
 
52
52
  #Copy
53
53
  ✓ should return the help
54
- ✓ should copy a file to the clipboard (416ms)
55
- ✓ should copy a string to the clipboard (321ms)
56
- ✓ should copy a card to the clipboard (943ms)
57
- ✓ should return an error if the file does not exist or is a folder (50ms)
54
+ ✓ should copy a file to the clipboard (402ms)
55
+ ✓ should copy a string to the clipboard (266ms)
56
+ ✓ should copy a card to the clipboard (960ms)
57
+ ✓ should return an error if the file does not exist or is a folder (48ms)
58
58
  ✓ should throw if copying to clipboard a binary files
59
59
 
60
60
  #Ds
@@ -70,17 +70,18 @@
70
70
  ✓ should export a file encrypted only for the user itself
71
71
  ✓ should export a binary file to the current local folder
72
72
  ✓ should export an encrypted file to the current local folder
73
- ✓ should export a file and delete it after 1 second (1204ms)
73
+ ✓ should export a file and delete it after 1 second (1205ms)
74
74
  ✓ should return an error if the file does not exist or is a folder
75
- ✓ should export a keystore json file if a private_key exists in the entry (753ms)
75
+ ✓ should export a keystore json file if a private_key exists in the entry (922ms)
76
76
  ✓ should export a cryptoenv file if a private_key exists in the entry
77
77
  ✓ should export a cryptoenv file with entire content when no private_key fields exist and user confirms
78
78
  ✓ should throw error when no private_key fields exist and user declines
79
79
  ✓ should throw error when no private_key fields exist and keystore option is used
80
+ ✓ should display encrypted content in console when using crypto-env with no-export
80
81
 
81
82
  #Find
82
83
  ✓ should return the help
83
- ✓ should show find a string in the tree (1033ms)
84
+ ✓ should show find a string in the tree (1022ms)
84
85
  ✓ should find no result without parameters
85
86
  ✓ should skip binary files from search
86
87
 
@@ -145,7 +146,7 @@
145
146
 
146
147
  #Mv
147
148
  ✓ should return the help
148
- ✓ should rename a file (1011ms)
149
+ ✓ should rename a file (1010ms)
149
150
  ✓ should move a file to another folder
150
151
  ✓ should move many files to another folder
151
152
  ✓ should move a file to another subfolder
@@ -154,14 +155,14 @@
154
155
  ✓ should move file to another dataset using wildcards
155
156
  ✓ should move file managing duplicates
156
157
  ✓ should throw if parameters are missed or wrong
157
- ✓ should move files from and to other datasets (1018ms)
158
+ ✓ should move files from and to other datasets (1014ms)
158
159
  ✓ should move the results of a find
159
160
 
160
161
  #Paste
161
162
  ✓ should return the help
162
- ✓ should paste the clipboard content to a new file (46ms)
163
- ✓ should paste the clipboard content to an existent file (79ms)
164
- ✓ should paste a single field to a yml card (38ms)
163
+ ✓ should paste the clipboard content to a new file (61ms)
164
+ ✓ should paste the clipboard content to an existent file (86ms)
165
+ ✓ should paste a single field to a yml card
165
166
 
166
167
  #Pwd
167
168
  ✓ should return the help
@@ -175,7 +176,7 @@
175
176
  ✓ should delete a file with one version
176
177
  ✓ should delete many files usign wildcards
177
178
  ✓ should return errors if wrong parameters
178
- ✓ should delete some versions of a file (1010ms)
179
+ ✓ should delete some versions of a file (1009ms)
179
180
 
180
181
  #Shell
181
182
  ✓ should return the help
@@ -195,13 +196,13 @@
195
196
 
196
197
  #Totp
197
198
  ✓ should return the help
198
- ✓ should totp a file to the clipboard (395ms)
199
- ✓ should read a totp secret from an image and add the totp field to the card (46ms)
199
+ ✓ should totp a file to the clipboard (394ms)
200
+ ✓ should read a totp secret from an image and add the totp field to the card (44ms)
200
201
  ✓ should read a totp secret from an image and return the secret
201
202
  ✓ should throw if bad image
202
203
  ✓ should throw if missing parameters
203
204
  ✓ should throw if the yaml is malformed
204
- ✓ should read a totp secret from the clipboard (269ms)
205
+ ✓ should read a totp secret from the clipboard (242ms)
205
206
 
206
207
  #Touch
207
208
  ✓ should return the help
@@ -230,7 +231,7 @@ New file "/folder2/file1" created.
230
231
  ✓ should see who am I
231
232
 
232
233
 
233
- 154 passing (16s)
234
+ 155 passing (14s)
234
235
  1 pending
235
236
  1 failing
236
237
 
@@ -251,12 +252,12 @@ New file "/folder2/file1" created.
251
252
  --------------------|---------|----------|---------|---------|--------------------------------------
252
253
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
253
254
  --------------------|---------|----------|---------|---------|--------------------------------------
254
- All files | 81.01 | 67.81 | 81.15 | 80.91 |
255
+ All files | 81.06 | 67.92 | 81.15 | 80.95 |
255
256
  src | 57.84 | 53.62 | 52.63 | 58.41 |
256
257
  Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
257
258
  PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
258
259
  cliConfig.js | 100 | 100 | 100 | 100 |
259
- src/commands | 83.77 | 69.39 | 90.64 | 83.66 |
260
+ src/commands | 83.81 | 69.51 | 90.64 | 83.7 |
260
261
  Alias.js | 90.54 | 77.35 | 100 | 90.41 | 101,112,139,169,173,180,190
261
262
  Bash.js | 75 | 0 | 66.66 | 75 | 18-19
262
263
  Cat.js | 98.9 | 88.88 | 100 | 98.9 | 152
@@ -266,7 +267,7 @@ All files | 81.01 | 67.81 | 81.15 | 80.91 |
266
267
  Copy.js | 91.2 | 71.92 | 100 | 91.11 | 115,166,183,205-210,225-226,253
267
268
  Ds.js | 92.53 | 82.05 | 100 | 92.42 | 99,108-113,125
268
269
  Edit.js | 13.58 | 0 | 40 | 13.58 | 88-214
269
- Export.js | 89.71 | 75.67 | 100 | 89.71 | ...5-190,201,213-217,222,234,243,246
270
+ Export.js | 90.17 | 76.92 | 100 | 90.17 | ...3-198,209,227-231,236,248,257,260
270
271
  Find.js | 93.58 | 86.66 | 100 | 93.42 | 101,164,200-203,209
271
272
  Help.js | 100 | 80 | 100 | 100 | 29
272
273
  Import.js | 93.2 | 85.48 | 100 | 93.13 | ...5,365,367,387,393,441,456-463,490
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secrez",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "license": "MIT",
5
5
  "nyc": {
6
6
  "include": "src",
@@ -71,6 +71,10 @@ class Export extends require("../Command") {
71
71
  alias: "C",
72
72
  type: Boolean,
73
73
  },
74
+ {
75
+ name: "no-export",
76
+ type: Boolean,
77
+ },
74
78
  ];
75
79
  }
76
80
 
@@ -115,6 +119,10 @@ class Export extends require("../Command") {
115
119
  "export my-wallet.yml --crypto-env",
116
120
  "it works like with keystore files, but it will export to file with .crypto.env extension ready to be used with @secrez/cryptoenv. Notice that the option -k has priority over -C.",
117
121
  ],
122
+ [
123
+ "export my-wallet.yml --crypto-env --no-export",
124
+ "encrypts the private key but displays it in console instead of exporting to file.",
125
+ ],
118
126
  ],
119
127
  };
120
128
  }
@@ -202,6 +210,12 @@ class Export extends require("../Command") {
202
210
  }
203
211
  if (options.cryptoEnv) {
204
212
  content = await Crypto.encrypt(privateKey, Crypto.SHA3(pwd));
213
+ if (options.noExport) {
214
+ // Display encrypted content in console instead of exporting
215
+ this.Logger.grey("Encrypted content:");
216
+ this.Logger.reset(content);
217
+ return null; // Return null to indicate no file was created
218
+ }
205
219
  name = name.replace(/\.[^.]+$/, ".crypto.env");
206
220
  } else {
207
221
  content = await encryptPrivateKeyAsKeystoreJson(privateKey, pwd);
@@ -289,8 +303,10 @@ class Export extends require("../Command") {
289
303
  try {
290
304
  this.validate(options);
291
305
  let name = await this.export(options);
292
- this.Logger.grey("Exported file:");
293
- this.Logger.reset(name);
306
+ if (name) {
307
+ this.Logger.grey("Exported file:");
308
+ this.Logger.reset(name);
309
+ }
294
310
  if (
295
311
  options.encrypt &&
296
312
  !options.password &&