@secrez/core 1.1.0 → 1.1.1

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
@@ -25,7 +25,7 @@ API documentation
25
25
  - clear cryptographic secrets from memory on `signout` via `clearSecrets()` (best-effort buffer zeroing)
26
26
  - guard crypto APIs with `assertLoggedIn()` after signout
27
27
  - replace deprecated `homedir` package with `os.homedir()`
28
- - require Node.js 20 or later (`engines.node >=20.0.0`)
28
+ - require Node.js 22.23.4 or later (`engines.node >=22.23.4`)
29
29
  - fix `decryptEntry` content-only path: set `ts` from `e.t` instead of `e.i` (SIG-4)
30
30
  - vault permissions (FS-1): `VaultPermissions` — files `0o600`, dirs `0o700` on create; `secureVaultIfNeeded()` at login (probe `keys/default.json` or `keys/`)
31
31
 
@@ -41,7 +41,7 @@ API documentation
41
41
  ## Test coverage
42
42
 
43
43
  ```
44
- 63 passing (502ms)
44
+ 63 passing (469ms)
45
45
 
46
46
  ----------------------|---------|----------|---------|---------|----------------------
47
47
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
package/coverage.report CHANGED
@@ -1,117 +1,112 @@
1
1
 
2
- > @secrez/core@1.1.0 test /Users/francescosullo/Projects/Secrez/secrez/packages/core
2
+ > @secrez/core@1.0.5 test /Users/francescosullo/Projects/Secrez/secrez/packages/core
3
3
  > cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.test.js test/**/*.test.js --exit
4
4
 
5
5
 
6
6
 
7
7
  #Entry
8
8
  #constructor
9
- ✔ should instantiate the Entry
10
- ✔ should ignore wrong parameters
9
+ ✓ should instantiate the Entry
10
+ ✓ should ignore wrong parameters
11
11
  #set
12
- ✔ should set some options for the Entry
13
- ✔ should skip invalid options
12
+ ✓ should set some options for the Entry
13
+ ✓ should skip invalid options
14
14
  #unset
15
- ✔ should unset some options
16
- ✔ should skip invalid or undefined options
15
+ ✓ should unset some options
16
+ ✓ should skip invalid or undefined options
17
17
  #sanitizeName
18
- ✔ should sanitize names
18
+ ✓ should sanitize names
19
19
  #sanitizePath
20
- ✔ should sanitize path
20
+ ✓ should sanitize path
21
21
 
22
22
  #Secrez
23
23
  default secrez dir
24
- ✔ should throw trying to test in the default ~/.secrez folder
24
+ ✓ should throw trying to test in the default ~/.secrez folder
25
25
  custom (testing) secrez dir
26
26
  derivePassword
27
- ✔ should derive a password and obtain a predeterminded hash
27
+ ✓ should derive a password and obtain a predeterminded hash
28
28
  signup and signin
29
- ✔ should signup the user and signin without saving the iterations
30
- ✔ should signup in two instances without conflicts
31
- ✔ should signup the user and signin saved the iterations
32
- ✔ should signup with version one, and signin and upgrade to version two
33
- ✔ should signup the user, change password and signin
34
- ✔ should signup the user, change iterations and signin
35
- ✔ should signup the user, change password and iterations and signin
36
- ✔ should clear secrets from memory on signout
29
+ ✓ should signup the user and signin without saving the iterations (73ms)
30
+ ✓ should signup in two instances without conflicts (50ms)
31
+ ✓ should signup the user and signin saved the iterations (45ms)
32
+ ✓ should signup with version one, and signin and upgrade to version two (66ms)
33
+ ✓ should signup the user, change password and signin (63ms)
34
+ ✓ should signup the user, change iterations and signin (63ms)
35
+ ✓ should signup the user, change password and iterations and signin (81ms)
37
36
  should throw an error
38
- ✔ trying to signup if Secrez has not been initiated
39
- ✔ trying to signin if Secrez has not been initiated
40
- ✔ trying to signup if account already exists
41
- ✔ trying to signin if account is not set yet
42
- ✔ trying to signin with missed iterations
43
- ✔ trying to signin with the wrong password
44
- ✔ trying to signin with the right password but wrong number of iterations
45
- ✔ trying to signin with the right password but using a wrong hash on file
46
- ✔ trying to sign out if never signed-in
37
+ ✓ trying to signup if Secrez has not been initiated
38
+ ✓ trying to signin if Secrez has not been initiated
39
+ ✓ trying to signup if account already exists
40
+ ✓ trying to signin if account is not set yet
41
+ ✓ trying to signin with missed iterations
42
+ ✓ trying to signin with the wrong password (40ms)
43
+ ✓ trying to signin with the right password but wrong number of iterations (41ms)
44
+ ✓ trying to signin with the right password but using a wrong hash on file (41ms)
45
+ ✓ trying to sign out if never signed-in
47
46
  encryptEntry and decryptEntry
48
- ✔ should encrypt a name and decrypt it
49
- ✔ should encrypt a very long name and decrypt it
50
- ✔ should encrypt name and content and decrypt it
51
- ✔ should encrypt only the content and decrypt it
52
- ✔ should decrypt content-only entry with the bound timestamp
53
- ✔ should re-encrypt the content and decrypt it
54
- ✔ should throw if the user is not logged in
55
- ✔ should throw if wrong type
56
- ✔ should throw if no entry is passed
57
- ✔ should throw if encrypted data are corrupted
58
- ✔ should throw if content has not the same id of the name
59
- ✔ should throw if parameters are missed
47
+ ✓ should encrypt a name and decrypt it
48
+ ✓ should encrypt a very long name and decrypt it
49
+ ✓ should encrypt name and content and decrypt it
50
+ ✓ should encrypt only the content and decrypt it
51
+ ✓ should re-encrypt the content and decrypt it
52
+ ✓ should throw if the user is not logged in
53
+ ✓ should throw if wrong type
54
+ ✓ should throw if no entry is passed
55
+ ✓ should throw if encrypted data are corrupted
56
+ ✓ should throw if content has not the same id of the name
57
+ ✓ should throw if parameters are missed
60
58
  encryptData and decryptData
61
- ✔ should encrypt some data and decrypt it
62
- ✔ should throw trying to get box and sign secret keys
59
+ ✓ should encrypt some data and decrypt it
60
+ ✓ should throw trying to get box and sign secret keys
63
61
  preEncryptData and preDecryptData
64
- ✔ should encrypt some data with the derivedPassword and decrypt it
65
- ✔ should throw trying to get the master key
62
+ ✓ should encrypt some data with the derivedPassword and decrypt it
63
+ ✓ should throw trying to get the master key
64
+ generateSharedSecrets && recoverSharedSecrets
65
+ ✓ should set up a second factor (72ms)
66
+ ✓ should set up a second factor and then upgrade from derivationVersion 1 to 2 (46ms)
67
+ ✓ should set up a second factor and a recovery code and remove them (70ms)
68
+ ✓ should set up a second factor and a recovery code and remove the recovery code (69ms)
69
+ ✓ should throw if wrong secret (42ms)
70
+ ✓ should throw if wrong authenticator (43ms)
66
71
  #readConf
67
- ✔ should encrypt some data with the derivedPassword and decrypt it
68
- ✔ should throw trying to get the master key
69
- ✔ should throw trying to get the master key
72
+ ✓ should encrypt some data with the derivedPassword and decrypt it
73
+ ✓ should throw trying to get the master key
74
+ ✓ should throw trying to get the master key
70
75
  #signMessage
71
- ✔ should sign a message and verify it
76
+ ✓ should sign a message and verify it (47ms)
72
77
  #getPublicKey
73
- ✔ should sign a message and verify it
78
+ ✓ should sign a message and verify it (44ms)
74
79
  #encrypt and decrypt shared data
75
- ✔ should get a shared ket
80
+ ✓ should get a shared ket (52ms)
76
81
 
77
82
  #config
78
- ✔ all field should be correctly configured
83
+ ✓ all field should be correctly configured
79
84
 
80
85
  #ConfigUtils
81
- ✔ should check if a type is valid
82
- ✔ #setSecrez should configure a secrez environment
83
- ✔ #setAndGetDataset should set and get a secondary db
84
- ✔ #deleteDataset should delete a dataset path
85
- ✔ #getDatasetPath should get a dataset path
86
- ✔ #getEnv should return the environment
86
+ ✓ should check if a type is valid
87
+ ✓ #setSecrez should configure a secrez environment
88
+ ✓ #setAndGetDataset should set and get a secondary db
89
+ ✓ #deleteDataset should delete a dataset path
90
+ ✓ #getDatasetPath should get a dataset path
91
+ ✓ #getEnv should return the environment
87
92
 
88
- #VaultPermissions
89
- ✔ should create directories with mode 0o700
90
- ✔ should chmod directories synchronously
91
- ✔ should probe the keys directory before an account exists
92
- ✔ should create files with mode 0o600
93
- ✔ should detect secure vault permissions via probe
94
- ✔ should secure legacy permissions on login
95
- ✔ should skip securing when probe is already secure
96
93
 
94
+ 60 passing (2s)
97
95
 
98
- 63 passing (502ms)
96
+ -----------------|---------|----------|---------|---------|-------------------
97
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
98
+ -----------------|---------|----------|---------|---------|-------------------
99
+ All files | 99.75 | 94.31 | 100 | 99.75 |
100
+ src | 100 | 96.06 | 100 | 100 |
101
+ Entry.js | 100 | 95.65 | 100 | 100 | 39
102
+ Secrez.js | 100 | 96.94 | 100 | 100 | 154,319,442
103
+ _Secrez.js | 100 | 91.66 | 100 | 100 | 14,226
104
+ src/config | 98.57 | 84.84 | 100 | 98.57 |
105
+ ConfigUtils.js | 98.48 | 84.84 | 100 | 98.48 | 137
106
+ booleans.js | 100 | 100 | 100 | 100 |
107
+ index.js | 100 | 100 | 100 | 100 |
108
+ -----------------|---------|----------|---------|---------|-------------------
99
109
 
100
- ----------------------|---------|----------|---------|---------|----------------------
101
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
102
- ----------------------|---------|----------|---------|---------|----------------------
103
- All files | 98.3 | 91.57 | 98.76 | 98.3 |
104
- src | 97.92 | 94.28 | 98.33 | 97.92 |
105
- Entry.js | 100 | 95.65 | 100 | 100 | 39
106
- Secrez.js | 100 | 97.72 | 100 | 100 | 226
107
- _Secrez.js | 94.54 | 82.75 | 96 | 94.54 | 11,14-15,114,249-250
108
- src/config | 99.19 | 84 | 100 | 99.19 |
109
- ConfigUtils.js | 98.57 | 84.84 | 100 | 98.57 | 143
110
- VaultPermissions.js | 100 | 82.35 | 100 | 100 | 53,79,102
111
- booleans.js | 100 | 100 | 100 | 100 |
112
- index.js | 100 | 100 | 100 | 100 |
113
- ----------------------|---------|----------|---------|---------|----------------------
114
-
115
- > @secrez/core@1.1.0 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/core
116
- > nyc check-coverage --statements 98 --branches 91 --functions 98 --lines 98
110
+ > @secrez/core@1.0.5 posttest /Users/francescosullo/Projects/Secrez/secrez/packages/core
111
+ > nyc check-coverage --statements 99 --branches 94 --functions 99 --lines 99
117
112
 
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@secrez/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
- "@secrez/crypto": "~1.1.0",
10
- "@secrez/utils": "~1.1.0",
9
+ "@secrez/crypto": "~1.1.1",
10
+ "@secrez/utils": "~1.1.1",
11
11
  "fs-extra": "^9.1.0",
12
12
  "lodash": "^4.17.21"
13
13
  },
14
14
  "devDependencies": {
15
- "@secrez/test-helpers": "~2.0.3",
15
+ "@secrez/test-helpers": "~2.0.4",
16
16
  "chai": "^4.5.0",
17
17
  "cross-env": "^7.0.3",
18
18
  "mocha": "^10.8.2",
@@ -29,7 +29,7 @@
29
29
  "email": "francesco@sullo.co"
30
30
  },
31
31
  "engines": {
32
- "node": ">=20.0.0"
32
+ "node": ">=22.23.4"
33
33
  },
34
34
  "scripts": {
35
35
  "all-tests": "find test/** -name '*.test.js' | xargs ./node_modules/.bin/mocha -R spec",