secrez 2.1.2 β†’ 2.1.3

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,11 @@ 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.3**
373
+
374
+ - uses clipboard only on macOS
375
+ - fixes `copy` return message when clipboard is not available
376
+
372
377
  **2.1.2**
373
378
 
374
379
  - disable `copy` command when in headless shells
@@ -848,65 +853,6 @@ Thank you for any contributions! πŸ˜‰
848
853
  ## Test coverage
849
854
 
850
855
  ```
851
- 148 passing (16s)
852
- 1 pending
853
-
854
- --------------------|---------|----------|---------|---------|--------------------------------------
855
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
856
- --------------------|---------|----------|---------|---------|--------------------------------------
857
- All files | 81.09 | 67.71 | 81.15 | 80.99 |
858
- src | 57.84 | 53.62 | 52.63 | 58.41 |
859
- Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
860
- PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
861
- cliConfig.js | 100 | 100 | 100 | 100 |
862
- src/commands | 83.73 | 69.2 | 90.64 | 83.61 |
863
- Alias.js | 90.54 | 77.35 | 100 | 90.41 | 101,112,139,169,173,180,190
864
- Bash.js | 75 | 0 | 66.66 | 75 | 18-19
865
- Cat.js | 98.9 | 88.88 | 100 | 98.9 | 152
866
- Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
867
- Conf.js | 9.09 | 0 | 20 | 9.09 | 98-500
868
- Contacts.js | 87.17 | 74.32 | 100 | 87.06 | ...5-141,145,165,172,184,237,250,260
869
- Copy.js | 92.94 | 74.54 | 100 | 92.85 | 114,165,182,200,216-217
870
- Ds.js | 92.53 | 82.05 | 100 | 92.42 | 99,108-113,125
871
- Edit.js | 13.58 | 0 | 40 | 13.58 | 88-214
872
- Export.js | 88.11 | 70.58 | 100 | 88.11 | ...0-175,185,197-201,206,218,227,230
873
- Find.js | 93.58 | 86.66 | 100 | 93.42 | 101,164,200-203,209
874
- Help.js | 100 | 80 | 100 | 100 | 29
875
- Import.js | 93.2 | 85.48 | 100 | 93.13 | ...5,365,367,387,393,441,456-463,490
876
- Lcat.js | 100 | 85.71 | 100 | 100 | 54
877
- Lcd.js | 95.65 | 81.81 | 100 | 95.65 | 50
878
- Lls.js | 95.45 | 72.72 | 100 | 95.45 | 97
879
- Lpwd.js | 92.3 | 100 | 100 | 92.3 | 36
880
- Ls.js | 91.3 | 75 | 100 | 90.76 | 103,114-116,130,181
881
- Mkdir.js | 100 | 66.66 | 100 | 100 | 38-44
882
- Mv.js | 88.04 | 73.21 | 100 | 87.77 | 93-99,133,155,165-172
883
- Paste.js | 87.23 | 75 | 100 | 87.23 | 72,78,81,89,113,129
884
- Pwd.js | 92.3 | 100 | 100 | 92.3 | 33
885
- Quit.js | 90 | 50 | 100 | 90 | 27
886
- Rm.js | 94 | 80.95 | 100 | 93.87 | 63,126,134
887
- Shell.js | 88.23 | 60 | 100 | 88.23 | 38,55
888
- Show.js | 72 | 45.45 | 57.14 | 73.46 | ...8,100,106-114,117,123-126,132,143
889
- Ssh.js | 25 | 0 | 40 | 25 | 72-120
890
- Tag.js | 98.03 | 92.3 | 100 | 98.01 | 122,171
891
- Totp.js | 94.56 | 73.58 | 100 | 94.56 | 188-189,229,239,277
892
- Touch.js | 95.91 | 81.48 | 100 | 95.83 | 152,202
893
- Use.js | 96.77 | 89.47 | 100 | 96.77 | 68
894
- Ver.js | 90 | 66.66 | 100 | 90 | 25
895
- Whoami.js | 83.33 | 60 | 80 | 83.33 | 27,35,48
896
- index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
897
- src/prompts | 100 | 100 | 50 | 100 |
898
- MainPromptMock.js | 100 | 100 | 50 | 100 |
899
- src/utils | 70.04 | 63.28 | 56.25 | 69.67 |
900
- AliasManager.js | 100 | 91.66 | 100 | 100 | 47
901
- ContactManager.js | 73.33 | 60 | 85.71 | 73.33 | 12,34-36
902
- Fido2Client.js | 15.38 | 0 | 11.11 | 15.38 | 14-108
903
- HelpProto.js | 91.59 | 84.05 | 100 | 91.45 | 49,153-154,171-176,195
904
- Logger.js | 63.63 | 56.25 | 36.84 | 62.79 | ...25,37-49,57,65-69,74,84,88,93,105
905
- --------------------|---------|----------|---------|---------|--------------------------------------
906
-
907
- > secrez@2.1.2 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
908
- > nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65
909
-
910
856
 
911
857
  ```
912
858
 
package/coverage.report CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- > secrez@2.1.2 test /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
2
+ > secrez@2.1.3 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,7 +29,7 @@
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 (1017ms)
32
+ βœ“ should show either one or all the versions of a file (1020ms)
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
35
  βœ“ should show the content of a Yaml file (1031ms)
@@ -51,197 +51,22 @@
51
51
 
52
52
  #Copy
53
53
  βœ“ should return the help
54
- βœ“ should copy a file to the clipboard (488ms)
55
- βœ“ should copy a string to the clipboard (271ms)
56
- βœ“ should copy a card to the clipboard (1040ms)
57
- βœ“ should return an error if the file does not exist or is a folder (60ms)
58
- βœ“ should throw if copying to clipboard a binary files
59
-
60
- #Ds
61
- βœ“ should return the help
62
- βœ“ should list all datasets
63
- βœ“ should create a new dataset
64
- βœ“ should rename a dataset
65
- βœ“ should delete a dataset
66
-
67
- #Export
68
- βœ“ should return the help
69
- βœ“ should export a file to the current local folder
70
- βœ“ should export a binary file to the current local folder
71
- βœ“ should export an encrypted file to the current local folder
72
- βœ“ should export a file and delete it after 1 second (1205ms)
73
- βœ“ should return an error if the file does not exist or is a folder
74
- βœ“ should export a keystore json file if a private_key exists in the entry (685ms)
75
- βœ“ should export a cryptoenv file if a private_key exists in the entry
76
-
77
- #Find
78
- βœ“ should return the help
79
- βœ“ should show find a string in the tree (1020ms)
80
- βœ“ should find no result without parameters
81
- βœ“ should skip binary files from search
82
-
83
- #Help
84
- βœ“ should return the help
85
- βœ“ #execAsync and format
86
- βœ“ should throw if wrong command
87
- βœ“ -- to complete coverage
88
-
89
- #Import
90
- βœ“ should return the help
91
- βœ“ should import a file in the current folder
92
- βœ“ should import an encrypted file
93
- βœ“ should import an encrypted file encrypted for myself
94
- βœ“ should import an encrypted binary file and export it again verifying it is fine
95
- βœ“ should import files recursively
96
- βœ“ should read a folder and import the only text file
97
- βœ“ should read a folder and import text and binary files
98
- βœ“ should simulate the import of two files
99
- βœ“ should move the imported file
100
- βœ“ should import a backup from another software spanning the data among folders and files
101
- βœ“ should import a backup from another software but saving the tags as tags
102
- βœ“ should import a backup from another software using tags to prefix the paths
103
- βœ“ should import using tags to prefix the paths, ignoring the tags
104
- βœ“ should import from a LastPass-like csv setting the path from "grouping" and "name"
105
- βœ“ should import from a json
106
- βœ“ should throw importing a malformed backup
107
- βœ“ should throw importing a CSV indicating wrong fields to generate the path
108
-
109
- #Lcat
110
- βœ“ should return the help
111
- βœ“ cat a file
112
- βœ“ return en error if trying to cat a binary file
113
-
114
- #Lcd
115
- βœ“ should return the help
116
- βœ“ change to a folder
117
- βœ“ return en error if changing to a file
118
-
119
- #Lls
120
- βœ“ should return the help
121
- βœ“ should list a folder
122
- βœ“ return en error if lls-ing a not existing path
123
- βœ“ return a message if no files are found
124
-
125
- #Lpwd
126
- βœ“ should return the help
127
- βœ“ change to a folder
128
-
129
- #Ls
130
- βœ“ should return the help
131
- βœ“ should return all the datasets
132
- βœ“ should list folders and files
133
- βœ“ should list folders and files using wildcards
134
-
135
- #Mkdir
136
- βœ“ should return the help
137
- βœ“ should create a folder
138
- βœ“ should create a nested folder
139
- βœ“ should throw if trying to create a child of a file
140
- βœ“ should throw if wrong parameters
141
-
142
- #Mv
143
- βœ“ should return the help
144
- βœ“ should rename a file (1014ms)
145
- βœ“ should move a file to another folder
146
- βœ“ should move many files to another folder
147
- βœ“ should move a file to another subfolder
148
- βœ“ should move and rename file to another folder
149
- βœ“ should move file to another folder using wildcards
150
- βœ“ should move file to another dataset using wildcards
151
- βœ“ should move file managing duplicates
152
- βœ“ should throw if parameters are missed or wrong
153
- βœ“ should move files from and to other datasets (1033ms)
154
- βœ“ should move the results of a find
155
-
156
- #Paste
157
- βœ“ should return the help
158
- βœ“ should paste the clipboard content to a new file (52ms)
159
- βœ“ should paste the clipboard content to an existent file (76ms)
160
- βœ“ should paste a single field to a yml card (39ms)
161
-
162
- #Pwd
163
- βœ“ should return the help
164
- βœ“ should show the working folder
165
-
166
- #Quit
167
- βœ“ should show the content of an external file via bash
168
-
169
- #Rm
170
- βœ“ should return the help
171
- βœ“ should delete a file with one version
172
- βœ“ should delete many files usign wildcards
173
- βœ“ should return errors if wrong parameters
174
- βœ“ should delete some versions of a file (1014ms)
175
-
176
- #Shell
177
- βœ“ should return the help
178
- βœ“ should show the content of an external file via shell
179
-
180
- #Show
181
- βœ“ should return the help
182
- βœ“ should show the field password of a card
183
-
184
- #Tag
185
- βœ“ should return the help
186
- βœ“ should tag a file
187
- βœ“ should remove a tag
188
- βœ“ should list all the tags
189
- βœ“ should show the file tagged as
190
- βœ“ should show very long file tagged as
191
-
192
- #Totp
193
- βœ“ should return the help
194
- βœ“ should totp a file to the clipboard (421ms)
195
- βœ“ should read a totp secret from an image and add the totp field to the card (40ms)
196
- βœ“ should read a totp secret from an image and return the secret
197
- βœ“ should throw if bad image
198
- βœ“ should throw if missing parameters
199
- βœ“ should throw if the yaml is malformed
200
- βœ“ should read a totp secret from the clipboard (215ms)
201
-
202
- #Touch
203
- βœ“ should return the help
204
- βœ“ should create a file
205
- βœ“ should create a file with content
206
- βœ“ should throw if trying to create a child of a file
207
- βœ“ should throw if wrong parameters
208
- βœ“ should create a file and generate a wallet
209
- New file "/folder2/file1" created.
210
- βœ“ should generate 5 prefixed wallet (65ms)
211
- New file "/folder2/file1" created.
212
- βœ“ should generate a wallet with mnemonic and 2 keys
213
-
214
- #Use
215
- βœ“ should return the help
216
- βœ“ should use a new dataset, creating it if does not exist
217
-
218
- #Ver
219
- βœ“ should show the current version
220
-
221
- #Whoami
222
- βœ“ should return the help
223
- βœ“ should see who am I
224
-
225
-
226
- 148 passing (16s)
227
- 1 pending
228
-
229
54
  --------------------|---------|----------|---------|---------|--------------------------------------
230
55
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
231
56
  --------------------|---------|----------|---------|---------|--------------------------------------
232
- All files | 81.09 | 67.71 | 81.15 | 80.99 |
57
+ All files | 77.54 | 63.7 | 79.71 | 77.44 |
233
58
  src | 57.84 | 53.62 | 52.63 | 58.41 |
234
59
  Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
235
60
  PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
236
61
  cliConfig.js | 100 | 100 | 100 | 100 |
237
- src/commands | 83.73 | 69.2 | 90.64 | 83.61 |
62
+ src/commands | 79.46 | 64.42 | 88.66 | 79.36 |
238
63
  Alias.js | 90.54 | 77.35 | 100 | 90.41 | 101,112,139,169,173,180,190
239
64
  Bash.js | 75 | 0 | 66.66 | 75 | 18-19
240
65
  Cat.js | 98.9 | 88.88 | 100 | 98.9 | 152
241
66
  Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
242
67
  Conf.js | 9.09 | 0 | 20 | 9.09 | 98-500
243
68
  Contacts.js | 87.17 | 74.32 | 100 | 87.06 | ...5-141,145,165,172,184,237,250,260
244
- Copy.js | 92.94 | 74.54 | 100 | 92.85 | 114,165,182,200,216-217
69
+ Copy.js | 15.55 | 3.5 | 50 | 15.73 | 108-191,198-241,252-267
245
70
  Ds.js | 92.53 | 82.05 | 100 | 92.42 | 99,108-113,125
246
71
  Edit.js | 13.58 | 0 | 40 | 13.58 | 88-214
247
72
  Export.js | 88.11 | 70.58 | 100 | 88.11 | ...0-175,185,197-201,206,218,227,230
@@ -263,7 +88,7 @@ All files | 81.09 | 67.71 | 81.15 | 80.99 |
263
88
  Show.js | 72 | 45.45 | 57.14 | 73.46 | ...8,100,106-114,117,123-126,132,143
264
89
  Ssh.js | 25 | 0 | 40 | 25 | 72-120
265
90
  Tag.js | 98.03 | 92.3 | 100 | 98.01 | 122,171
266
- Totp.js | 94.56 | 73.58 | 100 | 94.56 | 188-189,229,239,277
91
+ Totp.js | 84.21 | 56.36 | 100 | 84.21 | ...9,229,239,257-263,275-286,299-301
267
92
  Touch.js | 95.91 | 81.48 | 100 | 95.83 | 152,202
268
93
  Use.js | 96.77 | 89.47 | 100 | 96.77 | 68
269
94
  Ver.js | 90 | 66.66 | 100 | 90 | 25
@@ -278,7 +103,4 @@ All files | 81.09 | 67.71 | 81.15 | 80.99 |
278
103
  HelpProto.js | 91.59 | 84.05 | 100 | 91.45 | 49,153-154,171-176,195
279
104
  Logger.js | 63.63 | 56.25 | 36.84 | 62.79 | ...25,37-49,57,65-69,74,84,88,93,105
280
105
  --------------------|---------|----------|---------|---------|--------------------------------------
281
-
282
- > secrez@2.1.2 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
283
- > nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65
284
-
106
+  ELIFECYCLE  Test failed. See above for more details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secrez",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "license": "MIT",
5
5
  "nyc": {
6
6
  "include": "src",
@@ -193,12 +193,20 @@ class Copy extends require("../Command") {
193
193
  }
194
194
 
195
195
  isMacGuiSession() {
196
- try {
197
- execSync("echo test | pbcopy", { stdio: "ignore" });
198
- return true;
199
- } catch {
200
- return false;
196
+ const platform = os.platform(); // 'darwin', 'linux', 'win32', etc.
197
+
198
+ if (platform === "darwin") {
199
+ // macOS only
200
+ try {
201
+ execSync("echo test | pbcopy", { stdio: "ignore" });
202
+ return true;
203
+ } catch {
204
+ return false;
205
+ }
201
206
  }
207
+
208
+ // On Linux and Windows, pbcopy doesn't exist, so we assume false
209
+ return false;
202
210
  }
203
211
 
204
212
  async write(content, options, counter) {
@@ -240,17 +248,21 @@ class Copy extends require("../Command") {
240
248
  if (options.help) {
241
249
  return this.showHelp();
242
250
  }
243
- try {
244
- /* istanbul ignore if */
245
- if (this.isMacGuiSession() && !this.clipboardyVerified) {
246
- await clipboardy.read();
251
+ if (!this.isMacGuiSession()) {
252
+ this.Logger.red("Clipboard is not available in this shell");
253
+ } else {
254
+ try {
255
+ /* istanbul ignore if */
256
+ if (!this.clipboardyVerified) {
257
+ await clipboardy.read();
258
+ }
259
+ this.validate(options);
260
+ let name = await this.copy(options);
261
+ this.Logger.grey("Copied to clipboard:");
262
+ this.Logger.reset(name);
263
+ } catch (e) {
264
+ this.Logger.red(e.message);
247
265
  }
248
- this.validate(options);
249
- let name = await this.copy(options);
250
- this.Logger.grey("Copied to clipboard:");
251
- this.Logger.reset(name);
252
- } catch (e) {
253
- this.Logger.red(e.message);
254
266
  }
255
267
  await this.prompt.run();
256
268
  }
@@ -270,12 +270,20 @@ class Totp extends require("../Command") {
270
270
  }
271
271
 
272
272
  isMacGuiSession() {
273
- try {
274
- execSync("echo test | pbcopy", { stdio: "ignore" });
275
- return true;
276
- } catch {
277
- return false;
273
+ const platform = os.platform(); // 'darwin', 'linux', 'win32', etc.
274
+
275
+ if (platform === "darwin") {
276
+ // macOS only
277
+ try {
278
+ execSync("echo test | pbcopy", { stdio: "ignore" });
279
+ return true;
280
+ } catch {
281
+ return false;
282
+ }
278
283
  }
284
+
285
+ // On Linux and Windows, pbcopy doesn't exist, so we assume false
286
+ return false;
279
287
  }
280
288
 
281
289
  async exec(options = {}) {