secrez 2.1.8 → 2.1.10
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 +68 -50
- package/coverage.report +47 -56
- package/package.json +2 -2
- package/src/Command.js +17 -1
- package/src/Welcome.js +51 -2
- package/src/commands/Cat.js +2 -0
- package/src/commands/Ls.js +4 -0
- package/src/commands/Show.js +2 -0
- package/src/commands/Totp.js +5 -0
- package/src/prompts/CommandPrompt.js +4 -0
- package/src/prompts/MainPrompt.js +8 -0
- package/src/prompts/MainPromptMock.js +24 -2
package/README.md
CHANGED
@@ -370,6 +370,17 @@ Secrez is not intended to compete with password managers, so do not expect it to
|
|
370
370
|
|
371
371
|
## History
|
372
372
|
|
373
|
+
**2.1.10**
|
374
|
+
|
375
|
+
- add external git change detection to block operations when repository state changes outside of Secrez (e.g., `git pull` in another terminal)
|
376
|
+
- fix critical cache bug in git conflict detection that prevented external changes from being detected within 30 seconds
|
377
|
+
- improve git conflict detection tests with comprehensive coverage for both git and non-git repositories
|
378
|
+
|
379
|
+
**2.1.9**
|
380
|
+
|
381
|
+
- add `<` parameter to reuse the last used path in commands (e.g., `totp <` will use the last path from previous command)
|
382
|
+
- fix deprecation warning in `execSync` by properly escaping command arguments
|
383
|
+
|
373
384
|
**2.1.8**
|
374
385
|
|
375
386
|
- add `git` command to check repository status and detect remote changes
|
@@ -871,60 +882,67 @@ Thank you for any contributions! 😉
|
|
871
882
|
## Test coverage
|
872
883
|
|
873
884
|
```
|
874
|
-
|
885
|
+
162 passing (2m)
|
886
|
+
2 pending
|
875
887
|
|
876
888
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
877
|
-
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
889
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
878
890
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
879
|
-
All files |
|
880
|
-
src |
|
881
|
-
Command.js |
|
882
|
-
PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
|
883
|
-
cliConfig.js | 100 | 100 | 100 | 100 |
|
884
|
-
src/commands |
|
885
|
-
Alias.js |
|
886
|
-
Bash.js |
|
887
|
-
Cat.js |
|
888
|
-
Cd.js |
|
889
|
-
Conf.js |
|
890
|
-
Contacts.js |
|
891
|
-
Copy.js |
|
892
|
-
Ds.js |
|
893
|
-
Edit.js | 12.
|
894
|
-
Export.js |
|
895
|
-
Find.js |
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
891
|
+
All files | 80.07 | 67.69 | 80.91 | 79.96 |
|
892
|
+
src | 57.62 | 53.75 | 55 | 58.11 |
|
893
|
+
Command.js | 74.66 | 74.13 | 78.57 | 75.67 | ...5-62,73,80,93,127,164-172,179-182
|
894
|
+
PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
|
895
|
+
cliConfig.js | 100 | 100 | 100 | 100 |
|
896
|
+
src/commands | 83.06 | 69.43 | 90.82 | 82.94 |
|
897
|
+
Alias.js | 88.6 | 78.68 | 100 | 88.46 | 101,112,139,169,173,180,190,213-214
|
898
|
+
Bash.js | 75 | 0 | 66.66 | 75 | 18-19
|
899
|
+
Cat.js | 98.91 | 88.88 | 100 | 98.91 | 152
|
900
|
+
Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
|
901
|
+
Conf.js | 8.64 | 0 | 20 | 8.64 | 98-509
|
902
|
+
Contacts.js | 86.06 | 75.6 | 100 | 85.95 | ...5,165,172,184,237,250,260,268-269
|
903
|
+
Copy.js | 91.2 | 71.92 | 100 | 91.11 | 115,166,183,205-210,225-226,253
|
904
|
+
Ds.js | 90.27 | 82.6 | 100 | 90.14 | 99,108-113,125,147-148
|
905
|
+
Edit.js | 12.94 | 0 | 40 | 12.94 | 88-222
|
906
|
+
Export.js | 90.17 | 76.92 | 100 | 90.17 | ...3-198,209,227-231,236,248,257,260
|
907
|
+
Find.js | 93.58 | 86.66 | 100 | 93.42 | 101,164,200-203,209
|
908
|
+
Git.js | 96.15 | 75 | 100 | 96.15 | 61
|
909
|
+
Help.js | 100 | 80 | 100 | 100 | 29
|
910
|
+
Import.js | 92.41 | 85.38 | 100 | 92.34 | ...7,387,393,441,457-458,466-473,500
|
911
|
+
Lcat.js | 100 | 85.71 | 100 | 100 | 54
|
912
|
+
Lcd.js | 95.65 | 81.81 | 100 | 95.65 | 50
|
913
|
+
Lls.js | 95.45 | 72.72 | 100 | 95.45 | 97
|
914
|
+
Lpwd.js | 92.3 | 100 | 100 | 92.3 | 36
|
915
|
+
Ls.js | 91.54 | 76.31 | 100 | 91.04 | 103,114-116,130,185
|
916
|
+
Mkdir.js | 92.59 | 60 | 100 | 92.59 | 56-57
|
917
|
+
Mv.js | 86.59 | 71.66 | 100 | 86.31 | 93-99,133,155-156,165,175-182
|
918
|
+
Paste.js | 84.61 | 70.83 | 100 | 84.61 | 72,78,81,89,113,130-131,139
|
919
|
+
Pwd.js | 92.3 | 100 | 100 | 92.3 | 33
|
920
|
+
Quit.js | 90 | 50 | 100 | 90 | 27
|
921
|
+
Rm.js | 90.9 | 76 | 100 | 90.74 | 63,125-126,136,144
|
922
|
+
Shell.js | 88.23 | 60 | 100 | 88.23 | 38,55
|
923
|
+
Show.js | 72.54 | 45.45 | 57.14 | 74 | ...8,100,106-114,117,123-126,132,145
|
924
|
+
Ssh.js | 25 | 0 | 40 | 25 | 72-120
|
925
|
+
Tag.js | 96.26 | 91.37 | 100 | 96.22 | 122,171,204-205
|
926
|
+
Totp.js | 92.23 | 75 | 100 | 92.23 | 189-190,230,240,282-287,301-302
|
927
|
+
Touch.js | 96.36 | 80.64 | 100 | 96.29 | 164,240
|
928
|
+
Use.js | 91.66 | 86.95 | 100 | 91.66 | 68,83-84
|
929
|
+
Ver.js | 90 | 66.66 | 100 | 90 | 25
|
930
|
+
Whoami.js | 83.33 | 60 | 80 | 83.33 | 27,35,48
|
931
|
+
index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
|
932
|
+
src/prompts | 75 | 33.33 | 50 | 75 |
|
933
|
+
MainPromptMock.js | 75 | 33.33 | 50 | 75 | 29-35,44
|
934
|
+
src/utils | 67.61 | 62.5 | 54.16 | 67.21 |
|
935
|
+
AliasManager.js | 100 | 91.66 | 100 | 100 | 47
|
936
|
+
ContactManager.js | 73.33 | 60 | 85.71 | 73.33 | 12,34-36
|
937
|
+
Fido2Client.js | 9.61 | 0 | 0 | 9.61 | 8-108
|
938
|
+
HelpProto.js | 89.07 | 82.6 | 100 | 88.88 | 49,135-137,153-154,171-176,195
|
939
|
+
Logger.js | 63.63 | 56.25 | 36.84 | 62.79 | ...25,37-49,57,65-69,74,84,88,93,105
|
927
940
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
941
|
+
|
942
|
+
> secrez@2.1.10 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
|
943
|
+
> nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65
|
944
|
+
|
945
|
+
|
928
946
|
```
|
929
947
|
|
930
948
|
## Copyright
|
package/coverage.report
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> secrez@2.1.
|
2
|
+
> secrez@2.1.10 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
|
|
@@ -15,10 +15,6 @@
|
|
15
15
|
#validate
|
16
16
|
✓ should validate the options
|
17
17
|
|
18
|
-
#Fido2Client
|
19
|
-
#configuration
|
20
|
-
✓ should verify that all the scripts exist
|
21
|
-
|
22
18
|
#Alias
|
23
19
|
✓ should return the help
|
24
20
|
✓ create aliases and lists them
|
@@ -29,10 +25,10 @@
|
|
29
25
|
#Cat
|
30
26
|
✓ should return the help
|
31
27
|
✓ should show the content of a file
|
32
|
-
✓ should show either one or all the versions of a file (
|
28
|
+
✓ should show either one or all the versions of a file (1028ms)
|
33
29
|
✓ should throw if entry is not a file or file does not exist
|
34
30
|
✓ should throw if trying to cat a binary file
|
35
|
-
✓ should show the content of a Yaml file (
|
31
|
+
✓ should show the content of a Yaml file (1021ms)
|
36
32
|
|
37
33
|
#Cd
|
38
34
|
✓ should return the help
|
@@ -51,10 +47,10 @@
|
|
51
47
|
|
52
48
|
#Copy
|
53
49
|
✓ should return the help
|
54
|
-
✓ should copy a file to the clipboard (
|
55
|
-
✓ should copy a string to the clipboard (
|
56
|
-
✓ should copy a card to the clipboard (
|
57
|
-
✓ should return an error if the file does not exist or is a folder (
|
50
|
+
✓ should copy a file to the clipboard (415ms)
|
51
|
+
✓ should copy a string to the clipboard (268ms)
|
52
|
+
✓ should copy a card to the clipboard (1021ms)
|
53
|
+
✓ should return an error if the file does not exist or is a folder (125ms)
|
58
54
|
✓ should throw if copying to clipboard a binary files
|
59
55
|
|
60
56
|
#Ds
|
@@ -66,13 +62,13 @@
|
|
66
62
|
|
67
63
|
#Export
|
68
64
|
✓ should return the help
|
69
|
-
|
65
|
+
✓ should export a file to the current local folder
|
70
66
|
✓ should export a file encrypted only for the user itself
|
71
67
|
✓ should export a binary file to the current local folder
|
72
68
|
✓ should export an encrypted file to the current local folder
|
73
|
-
✓ should export a file and delete it after 1 second (
|
69
|
+
✓ should export a file and delete it after 1 second (1203ms)
|
74
70
|
✓ 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 (
|
71
|
+
✓ should export a keystore json file if a private_key exists in the entry (763ms)
|
76
72
|
✓ should export a cryptoenv file if a private_key exists in the entry
|
77
73
|
✓ should export a cryptoenv file with entire content when no private_key fields exist and user confirms
|
78
74
|
✓ should throw error when no private_key fields exist and user declines
|
@@ -81,16 +77,19 @@
|
|
81
77
|
|
82
78
|
#Find
|
83
79
|
✓ should return the help
|
84
|
-
✓ should show find a string in the tree (
|
80
|
+
✓ should show find a string in the tree (1021ms)
|
85
81
|
✓ should find no result without parameters
|
86
82
|
✓ should skip binary files from search
|
87
83
|
|
88
84
|
#Git
|
89
85
|
✓ should return the help
|
90
|
-
✓ should show git status when --status is used (
|
91
|
-
✓ should show git status by default (
|
92
|
-
✓ should handle conflict risk scenario (
|
86
|
+
✓ should show git status when --status is used (3518ms)
|
87
|
+
✓ should show git status by default (3580ms)
|
88
|
+
✓ should handle conflict risk scenario (5428ms)
|
93
89
|
✓ should handle non-git repository
|
90
|
+
✓ should allow normal operations in non-git repository
|
91
|
+
Bye bye :o)
|
92
|
+
✓ should detect external git changes and block operations (16546ms)
|
94
93
|
|
95
94
|
#Help
|
96
95
|
✓ should return the help
|
@@ -162,14 +161,14 @@
|
|
162
161
|
✓ should move file to another dataset using wildcards
|
163
162
|
✓ should move file managing duplicates
|
164
163
|
✓ should throw if parameters are missed or wrong
|
165
|
-
✓ should move files from and to other datasets (
|
164
|
+
✓ should move files from and to other datasets (1047ms)
|
166
165
|
✓ should move the results of a find
|
167
166
|
|
168
167
|
#Paste
|
169
168
|
✓ should return the help
|
170
169
|
✓ should paste the clipboard content to a new file (50ms)
|
171
|
-
✓ should paste the clipboard content to an existent file (
|
172
|
-
✓ should paste a single field to a yml card
|
170
|
+
✓ should paste the clipboard content to an existent file (94ms)
|
171
|
+
✓ should paste a single field to a yml card (71ms)
|
173
172
|
|
174
173
|
#Pwd
|
175
174
|
✓ should return the help
|
@@ -183,7 +182,7 @@
|
|
183
182
|
✓ should delete a file with one version
|
184
183
|
✓ should delete many files usign wildcards
|
185
184
|
✓ should return errors if wrong parameters
|
186
|
-
✓ should delete some versions of a file (
|
185
|
+
✓ should delete some versions of a file (1007ms)
|
187
186
|
|
188
187
|
#Shell
|
189
188
|
✓ should return the help
|
@@ -203,13 +202,13 @@
|
|
203
202
|
|
204
203
|
#Totp
|
205
204
|
✓ should return the help
|
206
|
-
✓ should totp a file to the clipboard (
|
205
|
+
✓ should totp a file to the clipboard (409ms)
|
207
206
|
✓ should read a totp secret from an image and add the totp field to the card (39ms)
|
208
207
|
✓ should read a totp secret from an image and return the secret
|
209
208
|
✓ should throw if bad image
|
210
209
|
✓ should throw if missing parameters
|
211
210
|
✓ should throw if the yaml is malformed
|
212
|
-
✓ should read a totp secret from the clipboard (
|
211
|
+
✓ should read a totp secret from the clipboard (186ms)
|
213
212
|
|
214
213
|
#Touch
|
215
214
|
✓ should return the help
|
@@ -222,7 +221,7 @@
|
|
222
221
|
✓ should throw if wrong parameters
|
223
222
|
✓ should create a file and generate a wallet
|
224
223
|
New file "/folder2/file1" created.
|
225
|
-
✓ should generate 5 prefixed wallet (
|
224
|
+
✓ should generate 5 prefixed wallet (65ms)
|
226
225
|
New file "/folder2/file1" created.
|
227
226
|
✓ should generate a wallet with mnemonic and 2 keys
|
228
227
|
|
@@ -237,37 +236,26 @@ New file "/folder2/file1" created.
|
|
237
236
|
✓ should return the help
|
238
237
|
✓ should see who am I
|
239
238
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
1 failing
|
244
|
-
|
245
|
-
1) #Export
|
246
|
-
should export a file to the current local folder:
|
247
|
-
|
248
|
-
AssertionError: expected 'file.2' to equal 'file'
|
249
|
-
+ expected - actual
|
250
|
-
|
251
|
-
-file.2
|
252
|
-
+file
|
253
|
-
|
254
|
-
at assertConsole (/Users/francescosullo/Projects/Secrez/secrez/packages/test-helpers/src/index.js:121:16)
|
255
|
-
at Context.<anonymous> (test/commands/Export.test.js:94:5)
|
239
|
+
#Fido2Client
|
240
|
+
#configuration
|
241
|
+
- should verify that all the scripts exist
|
256
242
|
|
257
243
|
|
244
|
+
162 passing (2m)
|
245
|
+
2 pending
|
258
246
|
|
259
247
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
260
248
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
261
249
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
262
|
-
All files | 80.
|
263
|
-
src |
|
264
|
-
Command.js |
|
250
|
+
All files | 80.07 | 67.69 | 80.91 | 79.96 |
|
251
|
+
src | 57.62 | 53.75 | 55 | 58.11 |
|
252
|
+
Command.js | 74.66 | 74.13 | 78.57 | 75.67 | ...5-62,73,80,93,127,164-172,179-182
|
265
253
|
PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
|
266
254
|
cliConfig.js | 100 | 100 | 100 | 100 |
|
267
|
-
src/commands |
|
255
|
+
src/commands | 83.06 | 69.43 | 90.82 | 82.94 |
|
268
256
|
Alias.js | 88.6 | 78.68 | 100 | 88.46 | 101,112,139,169,173,180,190,213-214
|
269
257
|
Bash.js | 75 | 0 | 66.66 | 75 | 18-19
|
270
|
-
Cat.js |
|
258
|
+
Cat.js | 98.91 | 88.88 | 100 | 98.91 | 152
|
271
259
|
Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
|
272
260
|
Conf.js | 8.64 | 0 | 20 | 8.64 | 98-509
|
273
261
|
Contacts.js | 86.06 | 75.6 | 100 | 85.95 | ...5,165,172,184,237,250,260,268-269
|
@@ -276,14 +264,14 @@ All files | 80.15 | 67.58 | 81.49 | 80.04 |
|
|
276
264
|
Edit.js | 12.94 | 0 | 40 | 12.94 | 88-222
|
277
265
|
Export.js | 90.17 | 76.92 | 100 | 90.17 | ...3-198,209,227-231,236,248,257,260
|
278
266
|
Find.js | 93.58 | 86.66 | 100 | 93.42 | 101,164,200-203,209
|
279
|
-
Git.js |
|
267
|
+
Git.js | 96.15 | 75 | 100 | 96.15 | 61
|
280
268
|
Help.js | 100 | 80 | 100 | 100 | 29
|
281
269
|
Import.js | 92.41 | 85.38 | 100 | 92.34 | ...7,387,393,441,457-458,466-473,500
|
282
270
|
Lcat.js | 100 | 85.71 | 100 | 100 | 54
|
283
271
|
Lcd.js | 95.65 | 81.81 | 100 | 95.65 | 50
|
284
272
|
Lls.js | 95.45 | 72.72 | 100 | 95.45 | 97
|
285
273
|
Lpwd.js | 92.3 | 100 | 100 | 92.3 | 36
|
286
|
-
Ls.js |
|
274
|
+
Ls.js | 91.54 | 76.31 | 100 | 91.04 | 103,114-116,130,185
|
287
275
|
Mkdir.js | 92.59 | 60 | 100 | 92.59 | 56-57
|
288
276
|
Mv.js | 86.59 | 71.66 | 100 | 86.31 | 93-99,133,155-156,165,175-182
|
289
277
|
Paste.js | 84.61 | 70.83 | 100 | 84.61 | 72,78,81,89,113,130-131,139
|
@@ -291,22 +279,25 @@ All files | 80.15 | 67.58 | 81.49 | 80.04 |
|
|
291
279
|
Quit.js | 90 | 50 | 100 | 90 | 27
|
292
280
|
Rm.js | 90.9 | 76 | 100 | 90.74 | 63,125-126,136,144
|
293
281
|
Shell.js | 88.23 | 60 | 100 | 88.23 | 38,55
|
294
|
-
Show.js |
|
282
|
+
Show.js | 72.54 | 45.45 | 57.14 | 74 | ...8,100,106-114,117,123-126,132,145
|
295
283
|
Ssh.js | 25 | 0 | 40 | 25 | 72-120
|
296
284
|
Tag.js | 96.26 | 91.37 | 100 | 96.22 | 122,171,204-205
|
297
|
-
Totp.js | 92.
|
298
|
-
Touch.js |
|
285
|
+
Totp.js | 92.23 | 75 | 100 | 92.23 | 189-190,230,240,282-287,301-302
|
286
|
+
Touch.js | 96.36 | 80.64 | 100 | 96.29 | 164,240
|
299
287
|
Use.js | 91.66 | 86.95 | 100 | 91.66 | 68,83-84
|
300
288
|
Ver.js | 90 | 66.66 | 100 | 90 | 25
|
301
289
|
Whoami.js | 83.33 | 60 | 80 | 83.33 | 27,35,48
|
302
290
|
index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
|
303
|
-
src/prompts |
|
304
|
-
MainPromptMock.js |
|
305
|
-
src/utils |
|
291
|
+
src/prompts | 75 | 33.33 | 50 | 75 |
|
292
|
+
MainPromptMock.js | 75 | 33.33 | 50 | 75 | 29-35,44
|
293
|
+
src/utils | 67.61 | 62.5 | 54.16 | 67.21 |
|
306
294
|
AliasManager.js | 100 | 91.66 | 100 | 100 | 47
|
307
295
|
ContactManager.js | 73.33 | 60 | 85.71 | 73.33 | 12,34-36
|
308
|
-
Fido2Client.js |
|
296
|
+
Fido2Client.js | 9.61 | 0 | 0 | 9.61 | 8-108
|
309
297
|
HelpProto.js | 89.07 | 82.6 | 100 | 88.88 | 49,135-137,153-154,171-176,195
|
310
298
|
Logger.js | 63.63 | 56.25 | 36.84 | 62.79 | ...25,37-49,57,65-69,74,84,88,93,105
|
311
299
|
--------------------|---------|----------|---------|---------|--------------------------------------
|
312
|
-
|
300
|
+
|
301
|
+
> secrez@2.1.10 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
|
302
|
+
> nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65
|
303
|
+
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "secrez",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.10",
|
4
4
|
"license": "MIT",
|
5
5
|
"nyc": {
|
6
6
|
"include": "src",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"@secrez/core": "~1.0.5",
|
11
11
|
"@secrez/crypto": "~1.0.4",
|
12
12
|
"@secrez/eth": "~0.0.4",
|
13
|
-
"@secrez/fs": "~1.0.
|
13
|
+
"@secrez/fs": "~1.0.7",
|
14
14
|
"@secrez/utils": "~1.0.4",
|
15
15
|
"case": "^1.6.3",
|
16
16
|
"chalk": "^3.0.0",
|
package/src/Command.js
CHANGED
@@ -84,6 +84,14 @@ class Command extends PreCommand {
|
|
84
84
|
][1] || undefined,
|
85
85
|
];
|
86
86
|
}
|
87
|
+
// Handle < syntax for last path
|
88
|
+
if (
|
89
|
+
self.prompt.cache &&
|
90
|
+
self.prompt.cache.lastPath &&
|
91
|
+
options.path === "<"
|
92
|
+
) {
|
93
|
+
return [options.path + self.prompt.cache.lastPath[0]];
|
94
|
+
}
|
87
95
|
return await self.prompt[
|
88
96
|
extraOptions.external ? "externalFs" : "internalFs"
|
89
97
|
].getFileList(options, true);
|
@@ -144,7 +152,15 @@ class Command extends PreCommand {
|
|
144
152
|
// Show the warning message
|
145
153
|
this.Logger.yellow(conflictCheck.message);
|
146
154
|
|
147
|
-
//
|
155
|
+
// If bypass is not allowed (e.g., external changes detected), block the operation
|
156
|
+
if (!conflictCheck.allowBypass) {
|
157
|
+
this.Logger.grey(
|
158
|
+
"Operation blocked for data integrity. Please quit and re-enter Secrez."
|
159
|
+
);
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
|
163
|
+
// Otherwise, ask user if they want to continue
|
148
164
|
const shouldContinue = await this.useInput({
|
149
165
|
type: "confirm",
|
150
166
|
message: "Do you want to continue anyway?",
|
package/src/Welcome.js
CHANGED
@@ -3,7 +3,7 @@ const inquirer = require("inquirer");
|
|
3
3
|
const fs = require("fs-extra");
|
4
4
|
const Crypto = require("@secrez/crypto");
|
5
5
|
const Logger = require("./utils/Logger");
|
6
|
-
const Fido2Client = require("./utils/Fido2Client");
|
6
|
+
// const Fido2Client = require("./utils/Fido2Client"); // FIDO2 support removed
|
7
7
|
|
8
8
|
class Welcome {
|
9
9
|
async start(secrez, options) {
|
@@ -37,7 +37,7 @@ Thanks.`);
|
|
37
37
|
if (await fs.pathExists(this.secrez.config.keysPath)) {
|
38
38
|
let errorCode = await this.login();
|
39
39
|
if (errorCode === 1) {
|
40
|
-
await this.
|
40
|
+
await this.handleDeprecatedFido2();
|
41
41
|
}
|
42
42
|
} else {
|
43
43
|
Logger.grey("Please signup to create your local account");
|
@@ -111,6 +111,8 @@ Thanks.`);
|
|
111
111
|
}
|
112
112
|
}
|
113
113
|
|
114
|
+
// sharedLogin() method removed - FIDO2 support deprecated
|
115
|
+
/*
|
114
116
|
async sharedLogin() {
|
115
117
|
let fido2Client = new Fido2Client(this.secrez);
|
116
118
|
let authenticator;
|
@@ -198,6 +200,7 @@ Thanks.`);
|
|
198
200
|
}
|
199
201
|
}
|
200
202
|
}
|
203
|
+
*/
|
201
204
|
|
202
205
|
async signup() {
|
203
206
|
for (;;) {
|
@@ -245,6 +248,52 @@ Thanks.`);
|
|
245
248
|
}
|
246
249
|
}
|
247
250
|
}
|
251
|
+
|
252
|
+
async handleDeprecatedFido2() {
|
253
|
+
Logger.yellow(
|
254
|
+
"FIDO2 second factor authentication is no longer supported in this version."
|
255
|
+
);
|
256
|
+
Logger.grey("Removing deprecated FIDO2 configuration...");
|
257
|
+
|
258
|
+
try {
|
259
|
+
const conf = await this.secrez.readConf();
|
260
|
+
const data = conf.data;
|
261
|
+
|
262
|
+
if (data.keys) {
|
263
|
+
// Remove all FIDO2 keys from the configuration
|
264
|
+
delete data.keys;
|
265
|
+
|
266
|
+
// Save the cleaned configuration
|
267
|
+
await this.secrez.saveConf(conf);
|
268
|
+
|
269
|
+
Logger.green("FIDO2 configuration has been removed successfully.");
|
270
|
+
Logger.grey("You can now login with your master password only.");
|
271
|
+
|
272
|
+
// Try to login again with the cleaned configuration
|
273
|
+
let errorCode = await this.login();
|
274
|
+
if (errorCode === 1) {
|
275
|
+
Logger.red(
|
276
|
+
"Login still failed. Please check your password or create a new account."
|
277
|
+
);
|
278
|
+
// eslint-disable-next-line no-process-exit
|
279
|
+
process.exit(1);
|
280
|
+
}
|
281
|
+
} else {
|
282
|
+
Logger.red(
|
283
|
+
"No FIDO2 keys found, but login still requires second factor. This may indicate a corrupted configuration."
|
284
|
+
);
|
285
|
+
// eslint-disable-next-line no-process-exit
|
286
|
+
process.exit(1);
|
287
|
+
}
|
288
|
+
} catch (e) {
|
289
|
+
Logger.red(`Failed to clean FIDO2 configuration: ${e.message}`);
|
290
|
+
Logger.grey(
|
291
|
+
"You may need to manually remove the keys.json file and create a new account."
|
292
|
+
);
|
293
|
+
// eslint-disable-next-line no-process-exit
|
294
|
+
process.exit(1);
|
295
|
+
}
|
296
|
+
}
|
248
297
|
}
|
249
298
|
|
250
299
|
module.exports = new Welcome();
|
package/src/commands/Cat.js
CHANGED
@@ -187,6 +187,8 @@ class Cat extends require("../Command") {
|
|
187
187
|
this.validate(options, {
|
188
188
|
path: true,
|
189
189
|
});
|
190
|
+
// Track the last path used
|
191
|
+
this.prompt.setLastPath(options.path);
|
190
192
|
let fn = path.basename(options.path);
|
191
193
|
let data = await this.cat(options);
|
192
194
|
let extra = options.all || options.metadata || options.versions;
|
package/src/commands/Ls.js
CHANGED
@@ -163,6 +163,10 @@ class Ls extends require("../Command") {
|
|
163
163
|
}
|
164
164
|
try {
|
165
165
|
this.validate(options);
|
166
|
+
// Track the last path used if a path was specified
|
167
|
+
if (options.path) {
|
168
|
+
this.prompt.setLastPath(options.path);
|
169
|
+
}
|
166
170
|
let list = await this.ls(options);
|
167
171
|
list = list.filter((e) => !/^\./.test(e) || options.all).sort();
|
168
172
|
if (list.length) {
|
package/src/commands/Show.js
CHANGED
@@ -135,6 +135,8 @@ class Show extends require("../Command") {
|
|
135
135
|
this.validate(options, {
|
136
136
|
path: true,
|
137
137
|
});
|
138
|
+
// Track the last path used
|
139
|
+
this.prompt.setLastPath(options.path);
|
138
140
|
const content = await this.show(options);
|
139
141
|
if (content) {
|
140
142
|
this.Logger.reset(content);
|
package/src/commands/Totp.js
CHANGED
@@ -303,6 +303,11 @@ class Totp extends require("../Command") {
|
|
303
303
|
}
|
304
304
|
}
|
305
305
|
|
306
|
+
// Track the last path used if a path was specified
|
307
|
+
if (options.path) {
|
308
|
+
this.prompt.setLastPath(options.path);
|
309
|
+
}
|
310
|
+
|
306
311
|
let token = await this.totp(options);
|
307
312
|
if (options.fromImage || options.fromClipboard) {
|
308
313
|
this.Logger.grey(token);
|
@@ -243,6 +243,10 @@ class CommandPrompt {
|
|
243
243
|
if (/ (#|£)\d+(\w+:|)\/[\w/]+/.test(line)) {
|
244
244
|
line = line.replace(/ (#|£)\d+((\w+:|)\/[\w/]+)/, " $2");
|
245
245
|
}
|
246
|
+
// Handle < syntax for last path
|
247
|
+
if (/ </.test(line)) {
|
248
|
+
line = line.replace(/</, "");
|
249
|
+
}
|
246
250
|
return line;
|
247
251
|
}
|
248
252
|
|
@@ -75,6 +75,14 @@ class MainPrompt extends require("./CommandPrompt") {
|
|
75
75
|
}
|
76
76
|
}
|
77
77
|
|
78
|
+
setLastPath(path) {
|
79
|
+
this.setCache("lastPath", 0, path);
|
80
|
+
}
|
81
|
+
|
82
|
+
getLastPath() {
|
83
|
+
return this.getCache("lastPath", 0);
|
84
|
+
}
|
85
|
+
|
78
86
|
prePromptMessage(options = {}) {
|
79
87
|
this.resetTimeout();
|
80
88
|
return chalk.reset(
|
@@ -18,9 +18,31 @@ class MainPromptMock {
|
|
18
18
|
this.cache = {};
|
19
19
|
}
|
20
20
|
|
21
|
-
setCache() {
|
21
|
+
setCache(name, index, content) {
|
22
|
+
if (!this.cache[name]) {
|
23
|
+
this.cache[name] = {};
|
24
|
+
}
|
25
|
+
this.cache[name][index] = content;
|
26
|
+
}
|
27
|
+
|
28
|
+
getCache(name, index) {
|
29
|
+
if (!this.cache[name]) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
if (typeof index !== "undefined") {
|
33
|
+
return this.cache[name][index];
|
34
|
+
} else {
|
35
|
+
return this.cache[name];
|
36
|
+
}
|
37
|
+
}
|
22
38
|
|
23
|
-
|
39
|
+
setLastPath(path) {
|
40
|
+
this.setCache("lastPath", 0, path);
|
41
|
+
}
|
42
|
+
|
43
|
+
getLastPath() {
|
44
|
+
return this.getCache("lastPath", 0);
|
45
|
+
}
|
24
46
|
|
25
47
|
async run(options) {}
|
26
48
|
|