@alessiofrittoli/crypto-cipher 2.0.0 → 2.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 +41 -38
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/types.d.mts +5 -2
- package/dist/types.d.ts +5 -2
- package/package.json +35 -15
package/README.md
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
# Crypto Cipher 🔐
|
|
2
2
|
|
|
3
|
-
[![NPM Latest Version][version-badge]][npm-url] [![Coverage Status][coverage-badge]][coverage-url] [![NPM Monthly Downloads][downloads-badge]][npm-url] [![Dependencies][deps-badge]][deps-url]
|
|
3
|
+
[![NPM Latest Version][version-badge]][npm-url] [![Coverage Status][coverage-badge]][coverage-url] [![Socket Status][socket-badge]][socket-url] [![NPM Monthly Downloads][downloads-badge]][npm-url] [![Dependencies][deps-badge]][deps-url]
|
|
4
|
+
|
|
5
|
+
[![GitHub Sponsor][sponsor-badge]][sponsor-url]
|
|
4
6
|
|
|
5
7
|
[version-badge]: https://img.shields.io/npm/v/%40alessiofrittoli%2Fcrypto-cipher
|
|
6
8
|
[npm-url]: https://npmjs.org/package/%40alessiofrittoli%2Fcrypto-cipher
|
|
7
9
|
[coverage-badge]: https://coveralls.io/repos/github/alessiofrittoli/crypto-cipher/badge.svg
|
|
8
10
|
[coverage-url]: https://coveralls.io/github/alessiofrittoli/crypto-cipher
|
|
11
|
+
[socket-badge]: https://socket.dev/api/badge/npm/package/@alessiofrittoli/crypto-cipher
|
|
12
|
+
[socket-url]: https://socket.dev/npm/package/@alessiofrittoli/crypto-cipher/overview
|
|
9
13
|
[downloads-badge]: https://img.shields.io/npm/dm/%40alessiofrittoli%2Fcrypto-cipher.svg
|
|
10
14
|
[deps-badge]: https://img.shields.io/librariesio/release/npm/%40alessiofrittoli%2Fcrypto-cipher
|
|
11
15
|
[deps-url]: https://libraries.io/npm/%40alessiofrittoli%2Fcrypto-cipher
|
|
12
16
|
|
|
17
|
+
[sponsor-badge]: https://img.shields.io/static/v1?label=Fund%20this%20package&message=%E2%9D%A4&logo=GitHub&color=%23DB61A2
|
|
18
|
+
[sponsor-url]: https://github.com/sponsors/alessiofrittoli
|
|
19
|
+
|
|
13
20
|
## Node.js Cipher cryptograph utility library
|
|
14
21
|
|
|
15
22
|
### Table of Contents
|
|
@@ -994,16 +1001,7 @@ pnpm test:watch
|
|
|
994
1001
|
pnpm test:ci
|
|
995
1002
|
```
|
|
996
1003
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
```bash
|
|
1000
|
-
pnpm test:buffer-in-memory
|
|
1001
|
-
pnpm test:file-symmetric
|
|
1002
|
-
pnpm test:file-hybrid
|
|
1003
|
-
pnpm test:stream-symmetric
|
|
1004
|
-
pnpm test:stream-hybrid
|
|
1005
|
-
pnpm test:misc
|
|
1006
|
-
```
|
|
1004
|
+
- See [`package.json`](./package.json) file scripts for more info.
|
|
1007
1005
|
|
|
1008
1006
|
Run tests with coverage.
|
|
1009
1007
|
|
|
@@ -1019,9 +1017,14 @@ test:coverage:serve
|
|
|
1019
1017
|
|
|
1020
1018
|
### Contributing
|
|
1021
1019
|
|
|
1022
|
-
Contributions are truly welcome
|
|
1020
|
+
Contributions are truly welcome!
|
|
1021
|
+
|
|
1023
1022
|
Please refer to the [Contributing Doc](./CONTRIBUTING.md) for more information on how to start contributing to this project.
|
|
1024
1023
|
|
|
1024
|
+
Help keep this project up to date with [GitHub Sponsor][sponsor-url].
|
|
1025
|
+
|
|
1026
|
+
[![GitHub Sponsor][sponsor-badge]][sponsor-url]
|
|
1027
|
+
|
|
1025
1028
|
---
|
|
1026
1029
|
|
|
1027
1030
|
### Security
|
|
@@ -1031,30 +1034,30 @@ If you believe you have found a security vulnerability, we encourage you to **_r
|
|
|
1031
1034
|
### Made with ☕
|
|
1032
1035
|
|
|
1033
1036
|
<table style='display:flex;gap:20px;'>
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1037
|
+
<tbody>
|
|
1038
|
+
<tr>
|
|
1039
|
+
<td>
|
|
1040
|
+
<img alt="avatar" src='https://avatars.githubusercontent.com/u/35973186' style='width:60px;border-radius:50%;object-fit:contain;'>
|
|
1041
|
+
</td>
|
|
1042
|
+
<td>
|
|
1043
|
+
<table style='display:flex;gap:2px;flex-direction:column;'>
|
|
1044
|
+
<tbody>
|
|
1045
|
+
<tr>
|
|
1046
|
+
<td>
|
|
1047
|
+
<a href='https://github.com/alessiofrittoli' target='_blank' rel='noopener'>Alessio Frittoli</a>
|
|
1048
|
+
</td>
|
|
1049
|
+
</tr>
|
|
1050
|
+
<tr>
|
|
1051
|
+
<td>
|
|
1052
|
+
<small>
|
|
1053
|
+
<a href='https://alessiofrittoli.it' target='_blank' rel='noopener'>https://alessiofrittoli.it</a> |
|
|
1054
|
+
<a href='mailto:info@alessiofrittoli.it' target='_blank' rel='noopener'>info@alessiofrittoli.it</a>
|
|
1055
|
+
</small>
|
|
1056
|
+
</td>
|
|
1057
|
+
</tr>
|
|
1058
|
+
</tbody>
|
|
1059
|
+
</table>
|
|
1060
|
+
</td>
|
|
1061
|
+
</tr>
|
|
1062
|
+
</tbody>
|
|
1060
1063
|
</table>
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer/coercion';
|
|
3
3
|
import { Cph } from './types.mjs';
|
|
4
|
-
import '@alessiofrittoli/crypto-buffer';
|
|
5
4
|
import 'stream';
|
|
5
|
+
import '@alessiofrittoli/crypto-buffer';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Utility class for AES encryption and decryption following [NIST SP 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf) standard reccomendations.
|
|
@@ -156,7 +156,7 @@ declare class Cipher {
|
|
|
156
156
|
options: T;
|
|
157
157
|
Key: Buffer<ArrayBufferLike>;
|
|
158
158
|
IV: Buffer<ArrayBufferLike>;
|
|
159
|
-
AAD:
|
|
159
|
+
AAD: Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>;
|
|
160
160
|
salt: Buffer<ArrayBufferLike>;
|
|
161
161
|
};
|
|
162
162
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer/coercion';
|
|
3
3
|
import { Cph } from './types.js';
|
|
4
|
-
import '@alessiofrittoli/crypto-buffer';
|
|
5
4
|
import 'stream';
|
|
5
|
+
import '@alessiofrittoli/crypto-buffer';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Utility class for AES encryption and decryption following [NIST SP 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf) standard reccomendations.
|
|
@@ -156,7 +156,7 @@ declare class Cipher {
|
|
|
156
156
|
options: T;
|
|
157
157
|
Key: Buffer<ArrayBufferLike>;
|
|
158
158
|
IV: Buffer<ArrayBufferLike>;
|
|
159
|
-
AAD:
|
|
159
|
+
AAD: Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>;
|
|
160
160
|
salt: Buffer<ArrayBufferLike>;
|
|
161
161
|
};
|
|
162
162
|
/**
|
package/dist/types.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer';
|
|
2
1
|
import crypto from 'crypto';
|
|
3
2
|
import { Readable, Writable } from 'stream';
|
|
3
|
+
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Cipher types.
|
|
7
|
+
*/
|
|
5
8
|
declare namespace Cph {
|
|
6
9
|
/** Cipher CBC algorithm types. */
|
|
7
10
|
type CBCTypes = 'aes-128-cbc' | 'aes-192-cbc' | 'aes-256-cbc';
|
|
8
11
|
/** Cipher supported algorithm types. */
|
|
9
|
-
type AesAlgorithm = (crypto.CipherCCMTypes | crypto.CipherGCMTypes | crypto.CipherOCBTypes | Cph.CBCTypes);
|
|
12
|
+
type AesAlgorithm = (crypto.CipherCCMTypes | crypto.CipherGCMTypes | crypto.CipherOCBTypes | Cph.CBCTypes | crypto.CipherChaCha20Poly1305Types);
|
|
10
13
|
/**
|
|
11
14
|
* Common Cipher options.
|
|
12
15
|
* @template T The AES algorithm type.
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer';
|
|
2
1
|
import crypto from 'crypto';
|
|
3
2
|
import { Readable, Writable } from 'stream';
|
|
3
|
+
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Cipher types.
|
|
7
|
+
*/
|
|
5
8
|
declare namespace Cph {
|
|
6
9
|
/** Cipher CBC algorithm types. */
|
|
7
10
|
type CBCTypes = 'aes-128-cbc' | 'aes-192-cbc' | 'aes-256-cbc';
|
|
8
11
|
/** Cipher supported algorithm types. */
|
|
9
|
-
type AesAlgorithm = (crypto.CipherCCMTypes | crypto.CipherGCMTypes | crypto.CipherOCBTypes | Cph.CBCTypes);
|
|
12
|
+
type AesAlgorithm = (crypto.CipherCCMTypes | crypto.CipherGCMTypes | crypto.CipherOCBTypes | Cph.CBCTypes | crypto.CipherChaCha20Poly1305Types);
|
|
10
13
|
/**
|
|
11
14
|
* Common Cipher options.
|
|
12
15
|
* @template T The AES algorithm type.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alessiofrittoli/crypto-cipher",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Node.js Cipher cryptograph utility library",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Alessio Frittoli",
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
"url": "https://alessiofrittoli.it"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"funding": [
|
|
12
|
+
{
|
|
13
|
+
"type": "github",
|
|
14
|
+
"url": "https://github.com/sponsors/alessiofrittoli"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
11
17
|
"keywords": [
|
|
12
18
|
"nodejs-crypto",
|
|
13
19
|
"cryptography",
|
|
@@ -46,19 +52,29 @@
|
|
|
46
52
|
},
|
|
47
53
|
"sideEffects": false,
|
|
48
54
|
"scripts": {
|
|
55
|
+
"//1a": "*********************************************************************",
|
|
56
|
+
"//1b": "*********************** BUILD - LINT - RELEASE **********************",
|
|
57
|
+
"//1c": "*********************************************************************",
|
|
49
58
|
"build": "pnpm lint && pnpm test:ci && tsup",
|
|
50
59
|
"build:watch": "tsup --watch",
|
|
51
60
|
"lint": "eslint",
|
|
52
61
|
"release": "node scripts/publish.js --verbose --npm",
|
|
53
|
-
"
|
|
62
|
+
"//2a": "*********************************************************************",
|
|
63
|
+
"//2b": "***************************** UNIT TESTS ****************************",
|
|
64
|
+
"//2c": "*********************************************************************",
|
|
65
|
+
"test": "jest --verbose",
|
|
54
66
|
"test:watch": "jest --watchAll --verbose",
|
|
55
67
|
"test:ci": "jest --ci --verbose",
|
|
68
|
+
"//3a": "*********************************************************************",
|
|
69
|
+
"//3b": "************************ UNIT TESTS COVERAGE ************************",
|
|
70
|
+
"//3c": "*********************************************************************",
|
|
56
71
|
"test:coverage": "pnpm test:watch --coverage",
|
|
57
72
|
"test:ci:coverage": "pnpm test:ci --coverage",
|
|
58
73
|
"test:serve-coverage": "http-server ./coverage/lcov-report --gzip true -p 0 -o --silent",
|
|
59
74
|
"test:coverage:serve": "concurrently --prefix none --kill-others \"pnpm test:coverage\" \"pnpm test:serve-coverage\"",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
75
|
+
"//4a": "*********************************************************************",
|
|
76
|
+
"//4b": "************************ TARGETED UNIT TESTS ************************",
|
|
77
|
+
"//4c": "*********************************************************************",
|
|
62
78
|
"test:buffer-in-memory": "pnpm test:watch buffer-in-memory.test.ts",
|
|
63
79
|
"test:file-symmetric": "pnpm test:watch file-symmetric.test.ts",
|
|
64
80
|
"test:file-hybrid": "pnpm test:watch file-hybrid.test.ts",
|
|
@@ -67,25 +83,29 @@
|
|
|
67
83
|
"test:misc": "pnpm test:watch misc.test.ts"
|
|
68
84
|
},
|
|
69
85
|
"devDependencies": {
|
|
70
|
-
"@alessiofrittoli/node-scripts": "^2.
|
|
71
|
-
"@eslint/js": "^9.
|
|
86
|
+
"@alessiofrittoli/node-scripts": "^2.4.0",
|
|
87
|
+
"@eslint/js": "^9.23.0",
|
|
72
88
|
"@jest/globals": "^29.7.0",
|
|
73
89
|
"@types/jest": "^29.5.14",
|
|
74
|
-
"@types/node": "^22.
|
|
90
|
+
"@types/node": "^22.13.11",
|
|
75
91
|
"concurrently": "^9.1.2",
|
|
76
92
|
"dotenv": "^16.4.7",
|
|
77
|
-
"eslint": "^9.
|
|
78
|
-
"globals": "^
|
|
93
|
+
"eslint": "^9.23.0",
|
|
94
|
+
"globals": "^16.0.0",
|
|
79
95
|
"http-server": "^14.1.1",
|
|
80
96
|
"jest": "^29.7.0",
|
|
81
|
-
"jest
|
|
82
|
-
"ts-jest": "^29.2.5",
|
|
97
|
+
"ts-jest": "^29.2.6",
|
|
83
98
|
"ts-node": "^10.9.2",
|
|
84
|
-
"tsup": "^8.
|
|
85
|
-
"typescript": "^5.
|
|
86
|
-
"typescript-eslint": "^8.
|
|
99
|
+
"tsup": "^8.4.0",
|
|
100
|
+
"typescript": "^5.8.2",
|
|
101
|
+
"typescript-eslint": "^8.27.0"
|
|
87
102
|
},
|
|
88
103
|
"dependencies": {
|
|
89
|
-
"@alessiofrittoli/crypto-buffer": "^3.
|
|
104
|
+
"@alessiofrittoli/crypto-buffer": "^3.5.0"
|
|
105
|
+
},
|
|
106
|
+
"pnpm": {
|
|
107
|
+
"onlyBuiltDependencies": [
|
|
108
|
+
"esbuild"
|
|
109
|
+
]
|
|
90
110
|
}
|
|
91
111
|
}
|