secrez 1.0.3 → 1.1.0
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 +17 -53
- package/package.json +71 -71
- package/src/commands/Import.js +2 -2
- package/src/commands/Totp.js +20 -3
- package/src/utils/HelpProto.js +2 -2
- package/LICENSE +0 -21
- package/coverage.report +0 -328
- package/pnpm-lock.yaml +0 -3381
- package/src/commands/Git.js +0 -184
package/README.md
CHANGED
@@ -181,48 +181,6 @@ Running Secrez in different containers (with the `-c` option), you can set up mu
|
|
181
181
|
secrez -c ~/data/secrez
|
182
182
|
```
|
183
183
|
|
184
|
-
## How to set up a Git repo for the data
|
185
|
-
|
186
|
-
The best way to go is to set up a repo on your own server. If you can't do that, using a private repo on a service like GitHub is not a bad option. Let's see how you can configure it in this second case.
|
187
|
-
|
188
|
-
First, you go to GitHub and create a new private repo. Don't add anything like README, Licence, etc. In the next page, GitHub will show you the command you must run to set up it locally. Here is an example, imagining that your data are in the default folder
|
189
|
-
|
190
|
-
```
|
191
|
-
git --init --main-branch main
|
192
|
-
git --remote-url git@github.com:sullof/jarrabish.git
|
193
|
-
```
|
194
|
-
|
195
|
-
To push any change run
|
196
|
-
```
|
197
|
-
git -p
|
198
|
-
```
|
199
|
-
and, if you pushed changes to the repo on some other computer, to pull and merge, run
|
200
|
-
```
|
201
|
-
git -P
|
202
|
-
```
|
203
|
-
Notice that the lowercase `p` is an alias for `push` and the uppercase `P` for `pull`.
|
204
|
-
|
205
|
-
### What if I have a private remote repo?
|
206
|
-
|
207
|
-
You should use Git anyway, to have a safe backup of your data. In this case, just run
|
208
|
-
```
|
209
|
-
git --init
|
210
|
-
```
|
211
|
-
to set the repo up. After, use `git -p` to commit your changes. It will allow you to reverse the data in case some critical error occurs. When you have a private repo, you can just add the remote url (see example above).
|
212
|
-
|
213
|
-
If you need more, you can run commands using Shell, like
|
214
|
-
```
|
215
|
-
shell "cd ~/.secrez && git log"
|
216
|
-
```
|
217
|
-
However, if you like to do some reset, you should quit and run the commands directly in the shell.
|
218
|
-
|
219
|
-
**Be careful when you do anything inside your container, you can irreversibly damage your data.**
|
220
|
-
|
221
|
-
### What about Mercurial or Subversion?
|
222
|
-
|
223
|
-
You can use a different version control system.
|
224
|
-
If you do so, though, be careful to correctly set up in the directory the equivalent of `.gitignore` to avoid pushing to the repo also data that must exist only locally.
|
225
|
-
|
226
184
|
## The commands
|
227
185
|
|
228
186
|
```
|
@@ -451,6 +409,17 @@ Secrez does not want to compete with password managers. So, don't expect in the
|
|
451
409
|
|
452
410
|
## History
|
453
411
|
|
412
|
+
__1.1.0__
|
413
|
+
* Remove `git`. If used carefully, the command was helpful, but still it is at risk of creating conflicts. After long thoughts, I disapproved my own proposal at: https://github.com/secrez/secrez/pull/163
|
414
|
+
|
415
|
+
__1.0.4__
|
416
|
+
* Fix wrong example in `import`
|
417
|
+
|
418
|
+
__1.0.3__
|
419
|
+
* `git` asks to quit Secrez and merge manually if there are remote changes
|
420
|
+
* `totp` allows to add a totp code to an existing yaml file using the option `--set` (see the examples)
|
421
|
+
* Default duration before clipboard reverse for `totp` is now 8 seconds
|
422
|
+
|
454
423
|
__1.0.2__
|
455
424
|
* Export and Import can encrypt/decrypt files using shared keys generated from a specified public key
|
456
425
|
* Can export ecrypted file for the user itself, files that can be decrypted only from inside the secrez account that exported them
|
@@ -790,18 +759,18 @@ Thanks a lot for any contribution 😉
|
|
790
759
|
## Test coverage
|
791
760
|
|
792
761
|
```
|
793
|
-
162 passing (
|
762
|
+
162 passing (28s)
|
794
763
|
1 pending
|
795
764
|
|
796
765
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
797
766
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
798
767
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
799
|
-
All files |
|
768
|
+
All files | 71.33 | 58.19 | 71.98 | 71.28 |
|
800
769
|
src | 59.63 | 54.79 | 55 | 61.32 |
|
801
770
|
Command.js | 79.66 | 78.72 | 76.92 | 83.93 | 35,54-59,68,71,95
|
802
771
|
PreCommand.js | 21.95 | 11.54 | 14.29 | 21.95 | 9-95,108
|
803
772
|
cliConfig.js | 100 | 100 | 100 | 100 |
|
804
|
-
src/commands |
|
773
|
+
src/commands | 81.58 | 66.85 | 89.95 | 81.4 |
|
805
774
|
Alias.js | 90.54 | 77.36 | 100 | 90.41 | 85,96,118,145,149,154,164
|
806
775
|
Bash.js | 75 | 0 | 66.67 | 75 | 20-21
|
807
776
|
Cat.js | 98.9 | 88.89 | 100 | 98.9 | 144
|
@@ -815,7 +784,6 @@ All files | 69.9 | 56.05 | 71.76 | 69.84 |
|
|
815
784
|
Edit.js | 13.58 | 0 | 40 | 13.58 | 78-193
|
816
785
|
Export.js | 90.91 | 68 | 100 | 90.91 | 109,114-115,120,130,137,140
|
817
786
|
Find.js | 93.59 | 86.67 | 100 | 93.42 | 90,153,192-196,202
|
818
|
-
Git.js | 15.07 | 0 | 50 | 15.07 | 74-178
|
819
787
|
Help.js | 100 | 80 | 100 | 100 | 30
|
820
788
|
Import.js | 93.2 | 85.48 | 100 | 93.1 | ...06,308,321,327,369,384-390,417
|
821
789
|
Lcat.js | 100 | 85.71 | 100 | 100 | 55
|
@@ -832,7 +800,7 @@ All files | 69.9 | 56.05 | 71.76 | 69.84 |
|
|
832
800
|
Shell.js | 88.24 | 60 | 100 | 88.24 | 39,54
|
833
801
|
Ssh.js | 25 | 0 | 40 | 25 | 64-104
|
834
802
|
Tag.js | 98.04 | 92.31 | 100 | 97.94 | 123,164
|
835
|
-
Totp.js |
|
803
|
+
Totp.js | 96.47 | 74.47 | 100 | 96.47 | 164-165,209
|
836
804
|
Touch.js | 100 | 71.43 | 100 | 100 | 57,68
|
837
805
|
Use.js | 96.77 | 89.47 | 100 | 96.77 | 65
|
838
806
|
Ver.js | 90 | 66.67 | 100 | 90 | 27
|
@@ -856,18 +824,14 @@ All files | 69.9 | 56.05 | 71.76 | 69.84 |
|
|
856
824
|
MainPromptMock.js | 100 | 100 | 66.67 | 100 |
|
857
825
|
MultiEditorPrompt.js | 25 | 0 | 0 | 25 | 8-35
|
858
826
|
SigintManager.js | 25 | 0 | 20 | 25 | 11-37
|
859
|
-
src/utils | 69.92 |
|
827
|
+
src/utils | 69.92 | 63.28 | 56.25 | 69.55 |
|
860
828
|
AliasManager.js | 100 | 91.67 | 100 | 100 | 48
|
861
829
|
ContactManager.js | 71.43 | 60 | 85.71 | 71.43 | 13,36-38
|
862
830
|
Fido2Client.js | 15.38 | 0 | 11.11 | 15.38 | 15-101
|
863
|
-
HelpProto.js | 91.6 |
|
831
|
+
HelpProto.js | 91.6 | 84.06 | 100 | 91.45 | 44,137-138,155-160,179
|
864
832
|
Logger.js | 63.64 | 56.25 | 36.84 | 62.79 | ...38-50,58,66-70,75,85,89,94,107
|
865
833
|
-----------------------|---------|----------|---------|---------|-----------------------------------
|
866
834
|
|
867
|
-
> secrez@1.0.3 posttest /Users/sullof/Projects/Personal/secrez/packages/secrez
|
868
|
-
> nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65
|
869
|
-
|
870
|
-
|
871
835
|
```
|
872
836
|
|
873
837
|
|
package/package.json
CHANGED
@@ -1,73 +1,73 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
2
|
+
"name": "secrez",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"license": "MIT",
|
5
|
+
"scripts": {
|
6
|
+
"dev": "cross-env NODE_ENV=dev bin/secrez.js -c `pwd`/tmp/secrez-dev -i 1e3 -l `pwd`/tmp",
|
7
|
+
"lint": "eslint -c .eslintrc 'src/**/*.js' 'bin/*.js' 'test/*.test.js' 'test/**/*.js' 'test/**/**/*.js'",
|
8
|
+
"test-only": "cross-env NODE_ENV=test ./node_modules/.bin/mocha test/*.test.js test/**/*.test.js test/**/**/*.js --exit",
|
9
|
+
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ./node_modules/.bin/_mocha test/*.test.js test/**/*.test.js test/**/**/*.js --exit",
|
10
|
+
"posttest": "nyc check-coverage --statements 65 --branches 50 --functions 65 --lines 65",
|
11
|
+
"build-helpers": "cd test/helpers/os && ./build.sh"
|
12
|
+
},
|
13
|
+
"nyc": {
|
14
|
+
"include": "src",
|
15
|
+
"exclude": []
|
16
|
+
},
|
17
|
+
"dependencies": {
|
18
|
+
"@secrez/core": "workspace:~1.0.3",
|
19
|
+
"@secrez/crypto": "workspace:~1.0.1",
|
20
|
+
"@secrez/fs": "workspace:~1.0.3",
|
21
|
+
"@secrez/hub": "workspace:~0.2.1",
|
22
|
+
"@secrez/utils": "workspace:~1.0.2",
|
23
|
+
"case": "^1.6.3",
|
24
|
+
"chalk": "^3.0.0",
|
25
|
+
"clipboardy": "^2.3.0",
|
26
|
+
"command-line-args": "^5.1.1",
|
27
|
+
"external-editor": "^3.1.0",
|
28
|
+
"fs-extra": "^9.1.0",
|
29
|
+
"homedir": "^0.6.0",
|
30
|
+
"inquirer": "^7.1.0",
|
31
|
+
"inquirer-command-prompt": "^0.1.0",
|
32
|
+
"jimp": "^0.13.0",
|
33
|
+
"lodash": "^4.17.15",
|
34
|
+
"otplib": "^12.0.1",
|
35
|
+
"qrcode-reader": "^1.0.4",
|
36
|
+
"superagent": "^5.3.1",
|
37
|
+
"tiny-cli-editor": "^0.1.1"
|
38
|
+
},
|
39
|
+
"devDependencies": {
|
40
|
+
"@secrez/courier": "workspace:~0.2.2",
|
41
|
+
"@secrez/test-helpers": "workspace:~1.0.2",
|
42
|
+
"chai": "^4.2.0",
|
43
|
+
"chalk": "^3.0.0",
|
44
|
+
"cross-env": "^7.0.2",
|
45
|
+
"eslint": "^6.8.0",
|
46
|
+
"eslint-plugin-node": "^11.0.0",
|
47
|
+
"mocha": "^7.1.1",
|
48
|
+
"nyc": "^15.1.0",
|
49
|
+
"test-console": "^1.1.0"
|
50
|
+
},
|
51
|
+
"bin": {
|
52
|
+
"secrez": "bin/secrez.js"
|
53
|
+
},
|
54
|
+
"preferGlobal": true,
|
55
|
+
"description": "A secrets manager in times of crypto coins.",
|
56
|
+
"main": "src/index.js",
|
57
|
+
"repository": {
|
58
|
+
"type": "git",
|
59
|
+
"url": "git+https://github.com/secrez/secrez.git"
|
60
|
+
},
|
61
|
+
"author": {
|
62
|
+
"name": "Francesco Sullo",
|
63
|
+
"email": "francesco@sullo.co"
|
64
|
+
},
|
65
|
+
"bugs": {
|
66
|
+
"url": "https://github.com/secrez/secrez/issues"
|
67
|
+
},
|
68
|
+
"homepage": "https://github.com/secrez/secrez#readme",
|
69
|
+
"engines": {
|
70
|
+
"node": ">=10.0.0"
|
71
|
+
},
|
72
|
+
"gitHead": "42cbc519dd2802a1e03c6203bb724c726c2bfb79"
|
73
73
|
}
|
package/src/commands/Import.js
CHANGED
@@ -99,8 +99,8 @@ class Import extends require('../Command') {
|
|
99
99
|
examples: [
|
100
100
|
['import seed.json', 'copies seed.json from the disk into the current directory'],
|
101
101
|
['import seed.json.secrez --password s8eeuhwy36534', 'imports seed.json and decrypts it using the specified password'],
|
102
|
-
['import seed.json.secrez
|
103
|
-
['import seed.json.secrez
|
102
|
+
['import seed.json.secrez', 'imports seed.json trying to decrypt it using the key shared with the contact who encrypted the data'],
|
103
|
+
['import seed.json.secrez--public-key Tush76/u+..... ', 'imports seed.json trying to decrypt it using a shared key generated using the specified public key'],
|
104
104
|
['import -m ethKeys', 'copies ethKeys and remove it from the disk'],
|
105
105
|
['import -p ~/passwords', 'imports all the text files in the folder passwords'],
|
106
106
|
['import -b -p ~/passwords', 'imports all the files, included binaries'],
|
package/src/commands/Totp.js
CHANGED
@@ -47,11 +47,23 @@ class Totp extends require('../Command') {
|
|
47
47
|
alias: 'i',
|
48
48
|
type: String
|
49
49
|
},
|
50
|
+
{
|
51
|
+
name: 'set',
|
52
|
+
alias: 's',
|
53
|
+
type: String
|
54
|
+
},
|
55
|
+
{
|
56
|
+
name: 'force',
|
57
|
+
type: Boolean
|
58
|
+
},
|
50
59
|
{
|
51
60
|
name: 'test',
|
52
61
|
type: String
|
53
62
|
}
|
54
63
|
]
|
64
|
+
this.defaults = {
|
65
|
+
duration: 8
|
66
|
+
}
|
55
67
|
}
|
56
68
|
|
57
69
|
help() {
|
@@ -61,6 +73,8 @@ class Totp extends require('../Command') {
|
|
61
73
|
],
|
62
74
|
examples: [
|
63
75
|
['totp coinbase.yml', 'prints a totp code and copies it to the clipboard for 5 seconds'],
|
76
|
+
['totp coinbase.yml -s "9syh 34rd ge6s hey3 u874"', 'set up a totp code, if not set yet'],
|
77
|
+
['totp github.com.yml -s USyehAA35TSE --force', 'update an existing totp code'],
|
64
78
|
['totp coinbase.yml -d 2', 'keeps it in the clipboard for 2 seconds'],
|
65
79
|
['totp github.yml --from-clipboard', 'get a secret from a qr code copied in the clipboard and add a field "totp" with the secret in "github.yml"'],
|
66
80
|
['totp github.yml --from-image qrcode.png', 'get a secret from the image'],
|
@@ -144,7 +158,7 @@ class Totp extends require('../Command') {
|
|
144
158
|
}
|
145
159
|
|
146
160
|
async totp(options = {}) {
|
147
|
-
let secret
|
161
|
+
let secret = options.set
|
148
162
|
let originalPath = options.path
|
149
163
|
if (options.test) {
|
150
164
|
const token = authenticator.generate(options.test.replace(/\s/g, ''))
|
@@ -191,6 +205,9 @@ class Totp extends require('../Command') {
|
|
191
205
|
throw new Error('The yml is malformed')
|
192
206
|
}
|
193
207
|
if (secret) {
|
208
|
+
if (parsed.totp && !options.force) {
|
209
|
+
throw new Error('A totp already set. Use the "--force" option to override it')
|
210
|
+
}
|
194
211
|
parsed.totp = secret
|
195
212
|
let entry = node.getEntry()
|
196
213
|
entry.set('content', yamlStringify(parsed))
|
@@ -206,7 +223,7 @@ class Totp extends require('../Command') {
|
|
206
223
|
const token = authenticator.generate(totp)
|
207
224
|
this.prompt.commands.copy.copy({
|
208
225
|
thisString: token,
|
209
|
-
duration: [options.duration ||
|
226
|
+
duration: [options.duration || this.defaults.duration],
|
210
227
|
noBeep: options.noBeep
|
211
228
|
})
|
212
229
|
return token
|
@@ -230,7 +247,7 @@ class Totp extends require('../Command') {
|
|
230
247
|
} else {
|
231
248
|
this.Logger.grey('TOTP token: ' + this.chalk.bold.black(token))
|
232
249
|
if (!options.test) {
|
233
|
-
this.Logger.grey(`It will stay in the clipboard for ${options.duration ||
|
250
|
+
this.Logger.grey(`It will stay in the clipboard for ${options.duration || this.defaults.duration} seconds`)
|
234
251
|
}
|
235
252
|
}
|
236
253
|
} catch (e) {
|
package/src/utils/HelpProto.js
CHANGED
@@ -108,7 +108,7 @@ class HelpProto {
|
|
108
108
|
let m = max - x
|
109
109
|
if (example.length <= m) {
|
110
110
|
elem = spacer + ' '.repeat(x) + example
|
111
|
-
str.push(elem + ' '.repeat(tot - elem.length))
|
111
|
+
str.push(elem + ' '.repeat(tot > elem.length ? tot - elem.length : 3))
|
112
112
|
break
|
113
113
|
} else {
|
114
114
|
j = -1
|
@@ -125,7 +125,7 @@ class HelpProto {
|
|
125
125
|
}
|
126
126
|
let good = example.substring(0, li)
|
127
127
|
elem = spacer + ' '.repeat(x) + good
|
128
|
-
str.push(elem + ' '.repeat(tot - elem.length))
|
128
|
+
str.push(elem + ' '.repeat(tot > elem.length ? tot - elem.length : 3))
|
129
129
|
example = example.substring(li + 1)
|
130
130
|
i++
|
131
131
|
// console.log(i, example)
|
package/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2017-present, Francesco Sullo <francesco@sullo.co>
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|