@edirect/encrypt-modules 11.0.64 → 11.0.66
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/package.json +9 -27
- package/dist/README.md +0 -149
- package/dist/package.json +0 -35
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.interface.d.ts +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.interface.d.ts.map +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.interface.js +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.module.d.ts +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.module.d.ts.map +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.module.js +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.service.d.ts +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.service.d.ts.map +0 -0
- /package/{dist/src → src}/aes-encrypt/aes-encrypt.service.js +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts.map +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.interface.js +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts.map +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.module.js +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.service.d.ts +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.service.d.ts.map +0 -0
- /package/{dist/src → src}/bin-pgp-encrypt/bin-pgp-encrypt.service.js +0 -0
- /package/{dist/src → src}/index.d.ts +0 -0
- /package/{dist/src → src}/index.d.ts.map +0 -0
- /package/{dist/src → src}/index.js +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.interface.d.ts +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.interface.d.ts.map +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.interface.js +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.module.d.ts +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.module.d.ts.map +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.module.js +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.service.d.ts +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.service.d.ts.map +0 -0
- /package/{dist/src → src}/pgp-encrypt/pgp-encrypt.service.js +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.interface.d.ts +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.interface.d.ts.map +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.interface.js +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.module.d.ts +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.module.d.ts.map +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.module.js +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.service.d.ts +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.service.d.ts.map +0 -0
- /package/{dist/src → src}/rsa-encrypt/rsa-encrypt.service.js +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.interface.d.ts +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.interface.d.ts.map +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.interface.js +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.module.d.ts +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.module.d.ts.map +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.module.js +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.service.d.ts +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.service.d.ts.map +0 -0
- /package/{dist/src → src}/zip-encrypt/zipencrypt.service.js +0 -0
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/encrypt-modules",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.66",
|
|
4
4
|
"description": "Encrypt Modules",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"types": "./dist/src/index.d.ts",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
|
10
|
-
"import": "./
|
|
11
|
-
"default": "./
|
|
12
|
-
"require": "./
|
|
13
|
-
"types": "./
|
|
9
|
+
"import": "./src/index.js",
|
|
10
|
+
"default": "./src/index.js",
|
|
11
|
+
"require": "./src/index.js",
|
|
12
|
+
"types": "./src/index.d.ts"
|
|
14
13
|
},
|
|
15
14
|
"./package.json": "./package.json"
|
|
16
15
|
},
|
|
17
16
|
"files": [
|
|
18
|
-
"
|
|
17
|
+
"src"
|
|
19
18
|
],
|
|
20
19
|
"dependencies": {
|
|
21
20
|
"@nestjs/common": "^11.2.1",
|
|
@@ -27,27 +26,10 @@
|
|
|
27
26
|
"tslib": "^2.8.1"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@nestjs/cli": "^11.0.24",
|
|
31
29
|
"@types/archiver": "7.0.0",
|
|
32
30
|
"@types/node": "^26.2.0",
|
|
33
31
|
"@types/node-rsa": "^1.1.4",
|
|
34
32
|
"@types/stream-buffers": "^3.0.8"
|
|
35
33
|
},
|
|
36
|
-
"
|
|
37
|
-
"name": "@edirect/encrypt-modules",
|
|
38
|
-
"targets": {
|
|
39
|
-
"build": {
|
|
40
|
-
"executor": "@nx/js:tsc",
|
|
41
|
-
"options": {
|
|
42
|
-
"main": "{workspaceRoot}/packages/edirect-encrypt-modules/src/index.ts",
|
|
43
|
-
"tsConfig": "{workspaceRoot}/packages/edirect-encrypt-modules/tsconfig.lib.json",
|
|
44
|
-
"outputPath": "{workspaceRoot}/packages/edirect-encrypt-modules/dist",
|
|
45
|
-
"assets": [
|
|
46
|
-
"{workspaceRoot}/packages/edirect-encrypt-modules/package.json",
|
|
47
|
-
"{workspaceRoot}/packages/edirect-encrypt-modules/README.md"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
34
|
+
"type": "commonjs"
|
|
53
35
|
}
|
package/dist/README.md
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# @edirect/encrypt-modules
|
|
2
|
-
|
|
3
|
-
Encryption utilities for eDirect NestJS applications. Provides four NestJS modules for different encryption algorithms: **PGP**, **Binary PGP**, **AES-256**, and **RSA** — plus a **ZIP** module for password-protected archive creation.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **PGP** encryption/decryption using OpenPGP.js (`openpgp`)
|
|
8
|
-
- **Binary PGP** for binary data encryption
|
|
9
|
-
- **AES-256-CBC** (and other AES variants) using Node.js native `crypto`
|
|
10
|
-
- **RSA** encryption/decryption using `node-rsa`
|
|
11
|
-
- **ZIP** password-protected archive creation
|
|
12
|
-
- NestJS module integration for each encryption type
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
pnpm add @edirect/encrypt-modules
|
|
18
|
-
# or
|
|
19
|
-
npm install @edirect/encrypt-modules
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Available Modules
|
|
23
|
-
|
|
24
|
-
### PGP Encryption (`PgpEncryptModule`)
|
|
25
|
-
|
|
26
|
-
Asymmetric encryption using OpenPGP keys:
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
import { Module } from '@nestjs/common';
|
|
30
|
-
import { PgpEncryptModule } from '@edirect/encrypt-modules';
|
|
31
|
-
|
|
32
|
-
@Module({
|
|
33
|
-
imports: [PgpEncryptModule],
|
|
34
|
-
})
|
|
35
|
-
export class AppModule {}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import { Injectable } from '@nestjs/common';
|
|
40
|
-
import { PgpEncryptService } from '@edirect/encrypt-modules';
|
|
41
|
-
|
|
42
|
-
@Injectable()
|
|
43
|
-
export class SecureDataService {
|
|
44
|
-
constructor(private readonly pgp: PgpEncryptService) {}
|
|
45
|
-
|
|
46
|
-
async encryptPayload(data: string, publicKey: string): Promise<string> {
|
|
47
|
-
return this.pgp.encrypt(publicKey, data);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async decryptPayload(
|
|
51
|
-
encryptedData: string,
|
|
52
|
-
privateKey: string,
|
|
53
|
-
passphrase?: string
|
|
54
|
-
): Promise<string> {
|
|
55
|
-
return this.pgp.decrypt(privateKey, encryptedData, passphrase);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**`PgpEncryptService` API:**
|
|
61
|
-
|
|
62
|
-
| Method | Signature | Description |
|
|
63
|
-
| --------- | ------------------------------------------------------------------------------- | ------------------------------------ |
|
|
64
|
-
| `encrypt` | `(pgpKey: string, dataToEncrypt: string): Promise<string>` | Encrypt data using a PGP public key |
|
|
65
|
-
| `decrypt` | `(pgpKey: string, encryptedData: string, passphrase?: string): Promise<string>` | Decrypt data using a PGP private key |
|
|
66
|
-
|
|
67
|
-
### AES Encryption (`AesEncryptModule`)
|
|
68
|
-
|
|
69
|
-
Symmetric encryption using Node.js `crypto`:
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
import { AesEncryptModule } from '@edirect/encrypt-modules';
|
|
73
|
-
|
|
74
|
-
@Module({ imports: [AesEncryptModule] })
|
|
75
|
-
export class AppModule {}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
import { AesEncryptService } from '@edirect/encrypt-modules';
|
|
80
|
-
|
|
81
|
-
// Default: AES-256-CBC
|
|
82
|
-
const encrypted = aesService.encrypt(
|
|
83
|
-
'secret data',
|
|
84
|
-
'my-32-char-passphrase-here!!!!!'
|
|
85
|
-
);
|
|
86
|
-
const decrypted = aesService.decrypt(
|
|
87
|
-
encrypted,
|
|
88
|
-
'my-32-char-passphrase-here!!!!!'
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// With custom IV and encoding
|
|
92
|
-
const encrypted2 = aesService.encrypt('data', passphrase, {
|
|
93
|
-
iv: customIv,
|
|
94
|
-
encryptionMethod: 'aes-256-cbc',
|
|
95
|
-
outputEncoding: 'base64',
|
|
96
|
-
});
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**`AesEncryptService` API:**
|
|
100
|
-
|
|
101
|
-
| Method | Signature | Description |
|
|
102
|
-
| --------- | ----------------------------------------------------------------------------------------------------- | -------------------------- |
|
|
103
|
-
| `encrypt` | `(message: string, passphrase: CipherKey, options?: IaesEncryptOptionalParameters): string` | Synchronous AES encryption |
|
|
104
|
-
| `decrypt` | `(encryptedMessage: string, passphrase: BinaryLike, options?: IaesDecryptOptionalParameters): string` | Synchronous AES decryption |
|
|
105
|
-
|
|
106
|
-
### RSA Encryption (`RsaEncryptModule`)
|
|
107
|
-
|
|
108
|
-
Asymmetric encryption using `node-rsa`:
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
import { RsaEncryptModule } from '@edirect/encrypt-modules';
|
|
112
|
-
|
|
113
|
-
@Module({ imports: [RsaEncryptModule] })
|
|
114
|
-
export class AppModule {}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { RsaEncryptService } from '@edirect/encrypt-modules';
|
|
119
|
-
|
|
120
|
-
const encrypted = rsaService.encrypt(data, 512, 'utf8');
|
|
121
|
-
const decrypted = rsaService.decrypt(encrypted, privateKey, 'utf8');
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### ZIP with Password (`ZipEncryptModule`)
|
|
125
|
-
|
|
126
|
-
Create password-protected ZIP archives:
|
|
127
|
-
|
|
128
|
-
```ts
|
|
129
|
-
import { ZipEncryptModule } from '@edirect/encrypt-modules';
|
|
130
|
-
|
|
131
|
-
@Module({ imports: [ZipEncryptModule] })
|
|
132
|
-
export class AppModule {}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## AES Optional Parameters
|
|
136
|
-
|
|
137
|
-
| Option | Type | Default | Description |
|
|
138
|
-
| ------------------ | ------------------ | --------------- | ---------------------------------- |
|
|
139
|
-
| `iv` | `BinaryLike` | Random | Initialization vector |
|
|
140
|
-
| `encryptionMethod` | `string` | `'aes-256-cbc'` | Cipher algorithm |
|
|
141
|
-
| `inputEncoding` | `Encoding` | `'utf8'` | Input data encoding |
|
|
142
|
-
| `outputEncoding` | `Encoding` | `'hex'` | Output encoding for encrypted data |
|
|
143
|
-
| `options` | `TransformOptions` | — | Additional stream options |
|
|
144
|
-
|
|
145
|
-
## Security Notes
|
|
146
|
-
|
|
147
|
-
- Never hardcode encryption keys in source code. Use environment variables.
|
|
148
|
-
- For PGP keys, store them in secure secret management (e.g., Kubernetes Secrets, AWS Secrets Manager).
|
|
149
|
-
- AES keys must be exactly 32 bytes for AES-256. Use a key derivation function (KDF) if your passphrase is shorter.
|
package/dist/package.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@edirect/encrypt-modules",
|
|
3
|
-
"version": "11.0.64",
|
|
4
|
-
"description": "Encrypt Modules",
|
|
5
|
-
"main": "./dist/src/index.js",
|
|
6
|
-
"types": "./dist/src/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./dist/src/index.js",
|
|
10
|
-
"default": "./dist/src/index.js",
|
|
11
|
-
"require": "./dist/src/index.js",
|
|
12
|
-
"types": "./dist/src/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@nestjs/common": "^11.2.1",
|
|
21
|
-
"archiver": "8.0.0",
|
|
22
|
-
"archiver-zip-encrypted": "^2.0.0",
|
|
23
|
-
"node-rsa": "1.1.1",
|
|
24
|
-
"openpgp": "^6.3.1",
|
|
25
|
-
"stream-buffers": "^3.0.3",
|
|
26
|
-
"tslib": "^2.8.1"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@types/archiver": "7.0.0",
|
|
30
|
-
"@types/node": "^26.2.0",
|
|
31
|
-
"@types/node-rsa": "^1.1.4",
|
|
32
|
-
"@types/stream-buffers": "^3.0.8"
|
|
33
|
-
},
|
|
34
|
-
"type": "commonjs"
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"5.9.3"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|