@edirect/encrypt-modules 11.0.43 → 11.0.45

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.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/dist/README.md +0 -34
  3. package/dist/package.json +0 -35
  4. package/dist/src/aes-encrypt/aes-encrypt.interface.d.ts +0 -23
  5. package/dist/src/aes-encrypt/aes-encrypt.interface.d.ts.map +0 -1
  6. package/dist/src/aes-encrypt/aes-encrypt.interface.js +0 -2
  7. package/dist/src/aes-encrypt/aes-encrypt.module.d.ts +0 -3
  8. package/dist/src/aes-encrypt/aes-encrypt.module.d.ts.map +0 -1
  9. package/dist/src/aes-encrypt/aes-encrypt.module.js +0 -15
  10. package/dist/src/aes-encrypt/aes-encrypt.service.d.ts +0 -7
  11. package/dist/src/aes-encrypt/aes-encrypt.service.d.ts.map +0 -1
  12. package/dist/src/aes-encrypt/aes-encrypt.service.js +0 -42
  13. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts +0 -5
  14. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts.map +0 -1
  15. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.js +0 -2
  16. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts +0 -3
  17. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts.map +0 -1
  18. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.js +0 -15
  19. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.service.d.ts +0 -6
  20. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.service.d.ts.map +0 -1
  21. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.service.js +0 -64
  22. package/dist/src/index.d.ts +0 -11
  23. package/dist/src/index.d.ts.map +0 -1
  24. package/dist/src/index.js +0 -23
  25. package/dist/src/pgp-encrypt/pgp-encrypt.interface.d.ts +0 -5
  26. package/dist/src/pgp-encrypt/pgp-encrypt.interface.d.ts.map +0 -1
  27. package/dist/src/pgp-encrypt/pgp-encrypt.interface.js +0 -2
  28. package/dist/src/pgp-encrypt/pgp-encrypt.module.d.ts +0 -3
  29. package/dist/src/pgp-encrypt/pgp-encrypt.module.d.ts.map +0 -1
  30. package/dist/src/pgp-encrypt/pgp-encrypt.module.js +0 -15
  31. package/dist/src/pgp-encrypt/pgp-encrypt.service.d.ts +0 -6
  32. package/dist/src/pgp-encrypt/pgp-encrypt.service.d.ts.map +0 -1
  33. package/dist/src/pgp-encrypt/pgp-encrypt.service.js +0 -68
  34. package/dist/src/rsa-encrypt/rsa-encrypt.interface.d.ts +0 -6
  35. package/dist/src/rsa-encrypt/rsa-encrypt.interface.d.ts.map +0 -1
  36. package/dist/src/rsa-encrypt/rsa-encrypt.interface.js +0 -2
  37. package/dist/src/rsa-encrypt/rsa-encrypt.module.d.ts +0 -3
  38. package/dist/src/rsa-encrypt/rsa-encrypt.module.d.ts.map +0 -1
  39. package/dist/src/rsa-encrypt/rsa-encrypt.module.js +0 -15
  40. package/dist/src/rsa-encrypt/rsa-encrypt.service.d.ts +0 -7
  41. package/dist/src/rsa-encrypt/rsa-encrypt.service.d.ts.map +0 -1
  42. package/dist/src/rsa-encrypt/rsa-encrypt.service.js +0 -22
  43. package/dist/src/zip-encrypt/zipencrypt.interface.d.ts +0 -10
  44. package/dist/src/zip-encrypt/zipencrypt.interface.d.ts.map +0 -1
  45. package/dist/src/zip-encrypt/zipencrypt.interface.js +0 -2
  46. package/dist/src/zip-encrypt/zipencrypt.module.d.ts +0 -3
  47. package/dist/src/zip-encrypt/zipencrypt.module.d.ts.map +0 -1
  48. package/dist/src/zip-encrypt/zipencrypt.module.js +0 -15
  49. package/dist/src/zip-encrypt/zipencrypt.service.d.ts +0 -5
  50. package/dist/src/zip-encrypt/zipencrypt.service.d.ts.map +0 -1
  51. package/dist/src/zip-encrypt/zipencrypt.service.js +0 -34
  52. package/dist/tsconfig.lib.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edirect/encrypt-modules",
3
- "version": "11.0.43",
3
+ "version": "11.0.45",
4
4
  "description": "Encrypt Modules",
5
5
  "packageScope": "@edirect",
6
6
  "main": "./dist/src/index.js",
package/dist/README.md DELETED
@@ -1,34 +0,0 @@
1
- # @edirect/encrypt-modules
2
-
3
- Encryption utilities and modules for Edirect applications. Provides services and helpers for encrypting and decrypting data, including support for PGP and other algorithms.
4
-
5
- ## Features
6
-
7
- - PGP encryption and decryption helpers
8
- - Utilities for secure data handling
9
- - Integrates with NestJS and other Edirect modules
10
-
11
- ## Installation
12
-
13
- ```bash
14
- npm install @edirect/encrypt-modules
15
- ```
16
-
17
- ## Usage
18
-
19
- Import and use the encryption services in your application:
20
-
21
- ```typescript
22
- import { PgpEncryptService } from '@edirect/encrypt-modules';
23
-
24
- const encrypted = await PgpEncryptService.encrypt(data, publicKey);
25
- const decrypted = await PgpEncryptService.decrypt(
26
- encrypted,
27
- privateKey,
28
- passphrase
29
- );
30
- ```
31
-
32
- ## Environment Variables
33
-
34
- This package does not require environment variables by default, but you may provide keys or secrets via environment variables as needed for your encryption setup.
package/dist/package.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "name": "@edirect/encrypt-modules",
3
- "version": "11.0.43",
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.1.12",
21
- "archiver": "7.0.1",
22
- "archiver-zip-encrypted": "^2.0.0",
23
- "node-rsa": "1.1.1",
24
- "openpgp": "^6.3.0",
25
- "stream-buffers": "^3.0.3",
26
- "tslib": "^2.8.1"
27
- },
28
- "devDependencies": {
29
- "@types/archiver": "^7.0.0",
30
- "@types/node": "^25.0.10",
31
- "@types/node-rsa": "^1.1.4",
32
- "@types/stream-buffers": "^3.0.8"
33
- },
34
- "type": "commonjs"
35
- }
@@ -1,23 +0,0 @@
1
- import { BinaryLike, CipherCCMTypes, CipherKey, Encoding } from 'crypto';
2
- import { TransformOptions } from 'stream';
3
- type encryptionMethods = CipherCCMTypes | 'aes-256-cbc';
4
- export interface IaesEncryptOptionalParameters {
5
- iv?: BinaryLike;
6
- encryptionMethod?: encryptionMethods;
7
- inputEncoding?: Encoding;
8
- outputEncoding?: Encoding;
9
- options?: TransformOptions;
10
- }
11
- export interface IaesDecryptOptionalParameters {
12
- iv?: BinaryLike;
13
- encryptionMethod?: encryptionMethods;
14
- inputEncoding?: Encoding;
15
- outputEncoding?: Encoding;
16
- options?: TransformOptions;
17
- }
18
- export interface AesEncryptInterface {
19
- encrypt(message: string, passphrase: CipherKey, optionalParameters?: IaesEncryptOptionalParameters): string;
20
- decrypt(encryptedMessage: string, passphrase: BinaryLike, optionalParameters?: IaesDecryptOptionalParameters): string;
21
- }
22
- export {};
23
- //# sourceMappingURL=aes-encrypt.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-encrypt.interface.d.ts","sourceRoot":"","sources":["../../../src/aes-encrypt/aes-encrypt.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C,KAAK,iBAAiB,GAAG,cAAc,GAAG,aAAa,CAAC;AAExD,MAAM,WAAW,6BAA6B;IAC5C,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CACL,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,SAAS,EACrB,kBAAkB,CAAC,EAAE,6BAA6B,GACjD,MAAM,CAAC;IAEV,OAAO,CACL,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,UAAU,EACtB,kBAAkB,CAAC,EAAE,6BAA6B,GACjD,MAAM,CAAC;CACX"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class AesEncryptModule {
2
- }
3
- //# sourceMappingURL=aes-encrypt.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/aes-encrypt/aes-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AesEncryptModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const aes_encrypt_service_1 = require("./aes-encrypt.service");
7
- let AesEncryptModule = class AesEncryptModule {
8
- };
9
- exports.AesEncryptModule = AesEncryptModule;
10
- exports.AesEncryptModule = AesEncryptModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- providers: [aes_encrypt_service_1.AesEncryptService],
13
- exports: [aes_encrypt_service_1.AesEncryptService],
14
- })
15
- ], AesEncryptModule);
@@ -1,7 +0,0 @@
1
- import { BinaryLike, CipherKey } from 'crypto';
2
- import { AesEncryptInterface, IaesDecryptOptionalParameters, IaesEncryptOptionalParameters } from './aes-encrypt.interface';
3
- export declare class AesEncryptService implements AesEncryptInterface {
4
- encrypt(message: string, passphrase: CipherKey, optionalParameters?: IaesEncryptOptionalParameters): string;
5
- decrypt(encryptedMessage: string, passphrase: BinaryLike, optionalParameters?: IaesDecryptOptionalParameters): string;
6
- }
7
- //# sourceMappingURL=aes-encrypt.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aes-encrypt.service.d.ts","sourceRoot":"","sources":["../../../src/aes-encrypt/aes-encrypt.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,yBAAyB,CAAC;AAEjC,qBACa,iBAAkB,YAAW,mBAAmB;IACpD,OAAO,CACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,SAAS,EACrB,kBAAkB,GAAE,6BAAkC,GACrD,MAAM;IAyBF,OAAO,CACZ,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,UAAU,EACtB,kBAAkB,GAAE,6BAAkC,GACrD,MAAM;CAwBV"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AesEncryptService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const crypto_1 = require("crypto");
7
- let AesEncryptService = class AesEncryptService {
8
- encrypt(message, passphrase, optionalParameters = {}) {
9
- optionalParameters = {
10
- ...{
11
- iv: Buffer.alloc(16).fill(0),
12
- encryptionMethod: 'aes-256-cbc',
13
- inputEncoding: 'utf8',
14
- outputEncoding: 'hex',
15
- },
16
- ...optionalParameters,
17
- };
18
- const cipher = (0, crypto_1.createCipheriv)(optionalParameters.encryptionMethod, passphrase, optionalParameters.iv, optionalParameters.options);
19
- let result = cipher.update(message, optionalParameters.inputEncoding, optionalParameters.outputEncoding);
20
- result += cipher.final(optionalParameters.outputEncoding);
21
- return result;
22
- }
23
- decrypt(encryptedMessage, passphrase, optionalParameters = {}) {
24
- optionalParameters = {
25
- ...{
26
- encryptionMethod: 'aes-256-cbc',
27
- iv: Buffer.alloc(16).fill(0),
28
- inputEncoding: 'hex',
29
- outputEncoding: 'utf8',
30
- },
31
- ...optionalParameters,
32
- };
33
- const decipher = (0, crypto_1.createDecipheriv)(optionalParameters.encryptionMethod, passphrase, optionalParameters.iv, optionalParameters.options);
34
- let result = decipher.update(encryptedMessage, optionalParameters.inputEncoding, optionalParameters.outputEncoding);
35
- result += decipher.final(optionalParameters.outputEncoding);
36
- return result;
37
- }
38
- };
39
- exports.AesEncryptService = AesEncryptService;
40
- exports.AesEncryptService = AesEncryptService = tslib_1.__decorate([
41
- (0, common_1.Injectable)()
42
- ], AesEncryptService);
@@ -1,5 +0,0 @@
1
- export interface IBinPgpEncryptModuleInterface {
2
- encrypt(pgpKey: string, dataToEncrypt: unknown): Promise<string>;
3
- decrypt(pgpKey: string, encryptedData: Buffer | Uint8Array | string, passphrase?: string): Promise<string>;
4
- }
5
- //# sourceMappingURL=bin-pgp-encrypt.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin-pgp-encrypt.interface.d.ts","sourceRoot":"","sources":["../../../src/bin-pgp-encrypt/bin-pgp-encrypt.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,CACL,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAC3C,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class BinPgpEncryptModule {
2
- }
3
- //# sourceMappingURL=bin-pgp-encrypt.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin-pgp-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/bin-pgp-encrypt/bin-pgp-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,mBAAmB;CAAG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BinPgpEncryptModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const bin_pgp_encrypt_service_1 = require("./bin-pgp-encrypt.service");
7
- let BinPgpEncryptModule = class BinPgpEncryptModule {
8
- };
9
- exports.BinPgpEncryptModule = BinPgpEncryptModule;
10
- exports.BinPgpEncryptModule = BinPgpEncryptModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- providers: [bin_pgp_encrypt_service_1.BinPgpEncryptService],
13
- exports: [bin_pgp_encrypt_service_1.BinPgpEncryptService],
14
- })
15
- ], BinPgpEncryptModule);
@@ -1,6 +0,0 @@
1
- import { IBinPgpEncryptModuleInterface } from './bin-pgp-encrypt.interface';
2
- export declare class BinPgpEncryptService implements IBinPgpEncryptModuleInterface {
3
- encrypt(pgpKey: string, dataToEncrypt: any): Promise<string>;
4
- decrypt(pgpKey: string, encryptedData: Buffer | Uint8Array | string, passphrase?: string): Promise<string>;
5
- }
6
- //# sourceMappingURL=bin-pgp-encrypt.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin-pgp-encrypt.service.d.ts","sourceRoot":"","sources":["../../../src/bin-pgp-encrypt/bin-pgp-encrypt.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE5E,qBACa,oBAAqB,YAAW,6BAA6B;IAC3D,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB5D,OAAO,CAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAC3C,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;CA4CnB"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BinPgpEncryptService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- let BinPgpEncryptService = class BinPgpEncryptService {
7
- async encrypt(pgpKey, dataToEncrypt) {
8
- try {
9
- const openpgp = await import('openpgp');
10
- const publicKey = await openpgp.readKey({
11
- armoredKey: pgpKey,
12
- });
13
- const encrypted = await openpgp.encrypt({
14
- message: await openpgp.createMessage({ text: dataToEncrypt }),
15
- encryptionKeys: publicKey,
16
- format: 'binary',
17
- });
18
- return encrypted.toString();
19
- }
20
- catch (error) {
21
- throw new Error(`File encryption error: \n ${error}`);
22
- }
23
- }
24
- async decrypt(pgpKey, encryptedData, passphrase) {
25
- try {
26
- const openpgp = await import('openpgp');
27
- const openpgpPrivatekey = await openpgp.readPrivateKey({
28
- armoredKey: pgpKey,
29
- });
30
- const decryptKeyOptions = {
31
- privateKey: openpgpPrivatekey,
32
- config: {
33
- allowInsecureDecryptionWithSigningKeys: true,
34
- allowUnauthenticatedMessages: true,
35
- },
36
- };
37
- let privateKey = openpgpPrivatekey;
38
- if (passphrase) {
39
- decryptKeyOptions.passphrase = passphrase;
40
- privateKey = await openpgp.decryptKey(decryptKeyOptions);
41
- }
42
- const message = await openpgp.readMessage({
43
- binaryMessage: encryptedData,
44
- });
45
- const { data: decryptedData } = await openpgp.decrypt({
46
- message,
47
- decryptionKeys: privateKey,
48
- format: 'utf8',
49
- config: {
50
- allowInsecureDecryptionWithSigningKeys: true,
51
- allowUnauthenticatedMessages: true,
52
- },
53
- });
54
- return decryptedData.toString();
55
- }
56
- catch (error) {
57
- throw new Error(`File decryption error: \n ${error}`);
58
- }
59
- }
60
- };
61
- exports.BinPgpEncryptService = BinPgpEncryptService;
62
- exports.BinPgpEncryptService = BinPgpEncryptService = tslib_1.__decorate([
63
- (0, common_1.Injectable)()
64
- ], BinPgpEncryptService);
@@ -1,11 +0,0 @@
1
- export { AesEncryptModule } from './aes-encrypt/aes-encrypt.module';
2
- export { AesEncryptService } from './aes-encrypt/aes-encrypt.service';
3
- export { RsaEncryptModule } from './rsa-encrypt/rsa-encrypt.module';
4
- export { RsaEncryptService } from './rsa-encrypt/rsa-encrypt.service';
5
- export { PgpEncryptModule } from './pgp-encrypt/pgp-encrypt.module';
6
- export { PgpEncryptService } from './pgp-encrypt/pgp-encrypt.service';
7
- export { BinPgpEncryptModule } from './bin-pgp-encrypt/bin-pgp-encrypt.module';
8
- export { BinPgpEncryptService } from './bin-pgp-encrypt/bin-pgp-encrypt.service';
9
- export { ZipEncryptModule } from './zip-encrypt/zipencrypt.module';
10
- export { ZipEncryptService } from './zip-encrypt/zipencrypt.service';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/src/index.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZipEncryptService = exports.ZipEncryptModule = exports.BinPgpEncryptService = exports.BinPgpEncryptModule = exports.PgpEncryptService = exports.PgpEncryptModule = exports.RsaEncryptService = exports.RsaEncryptModule = exports.AesEncryptService = exports.AesEncryptModule = void 0;
4
- var aes_encrypt_module_1 = require("./aes-encrypt/aes-encrypt.module");
5
- Object.defineProperty(exports, "AesEncryptModule", { enumerable: true, get: function () { return aes_encrypt_module_1.AesEncryptModule; } });
6
- var aes_encrypt_service_1 = require("./aes-encrypt/aes-encrypt.service");
7
- Object.defineProperty(exports, "AesEncryptService", { enumerable: true, get: function () { return aes_encrypt_service_1.AesEncryptService; } });
8
- var rsa_encrypt_module_1 = require("./rsa-encrypt/rsa-encrypt.module");
9
- Object.defineProperty(exports, "RsaEncryptModule", { enumerable: true, get: function () { return rsa_encrypt_module_1.RsaEncryptModule; } });
10
- var rsa_encrypt_service_1 = require("./rsa-encrypt/rsa-encrypt.service");
11
- Object.defineProperty(exports, "RsaEncryptService", { enumerable: true, get: function () { return rsa_encrypt_service_1.RsaEncryptService; } });
12
- var pgp_encrypt_module_1 = require("./pgp-encrypt/pgp-encrypt.module");
13
- Object.defineProperty(exports, "PgpEncryptModule", { enumerable: true, get: function () { return pgp_encrypt_module_1.PgpEncryptModule; } });
14
- var pgp_encrypt_service_1 = require("./pgp-encrypt/pgp-encrypt.service");
15
- Object.defineProperty(exports, "PgpEncryptService", { enumerable: true, get: function () { return pgp_encrypt_service_1.PgpEncryptService; } });
16
- var bin_pgp_encrypt_module_1 = require("./bin-pgp-encrypt/bin-pgp-encrypt.module");
17
- Object.defineProperty(exports, "BinPgpEncryptModule", { enumerable: true, get: function () { return bin_pgp_encrypt_module_1.BinPgpEncryptModule; } });
18
- var bin_pgp_encrypt_service_1 = require("./bin-pgp-encrypt/bin-pgp-encrypt.service");
19
- Object.defineProperty(exports, "BinPgpEncryptService", { enumerable: true, get: function () { return bin_pgp_encrypt_service_1.BinPgpEncryptService; } });
20
- var zipencrypt_module_1 = require("./zip-encrypt/zipencrypt.module");
21
- Object.defineProperty(exports, "ZipEncryptModule", { enumerable: true, get: function () { return zipencrypt_module_1.ZipEncryptModule; } });
22
- var zipencrypt_service_1 = require("./zip-encrypt/zipencrypt.service");
23
- Object.defineProperty(exports, "ZipEncryptService", { enumerable: true, get: function () { return zipencrypt_service_1.ZipEncryptService; } });
@@ -1,5 +0,0 @@
1
- export interface IPgpEncryptModuleInterface {
2
- encrypt(pgpKey: any, dataToEncrypt: any): Promise<string>;
3
- decrypt(pgpKey: any, encryptedData: any, passphrase?: string): Promise<string>;
4
- }
5
- //# sourceMappingURL=pgp-encrypt.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pgp-encrypt.interface.d.ts","sourceRoot":"","sources":["../../../src/pgp-encrypt/pgp-encrypt.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,CACL,MAAM,EAAE,GAAG,EACX,aAAa,EAAE,GAAG,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class PgpEncryptModule {
2
- }
3
- //# sourceMappingURL=pgp-encrypt.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pgp-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/pgp-encrypt/pgp-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PgpEncryptModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const pgp_encrypt_service_1 = require("./pgp-encrypt.service");
7
- let PgpEncryptModule = class PgpEncryptModule {
8
- };
9
- exports.PgpEncryptModule = PgpEncryptModule;
10
- exports.PgpEncryptModule = PgpEncryptModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- providers: [pgp_encrypt_service_1.PgpEncryptService],
13
- exports: [pgp_encrypt_service_1.PgpEncryptService],
14
- })
15
- ], PgpEncryptModule);
@@ -1,6 +0,0 @@
1
- import { IPgpEncryptModuleInterface } from './pgp-encrypt.interface';
2
- export declare class PgpEncryptService implements IPgpEncryptModuleInterface {
3
- encrypt(pgpKey: any, dataToEncrypt: any): Promise<string>;
4
- decrypt(pgpKey: any, encryptedData: any, passphrase?: string): Promise<string>;
5
- }
6
- //# sourceMappingURL=pgp-encrypt.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pgp-encrypt.service.d.ts","sourceRoot":"","sources":["../../../src/pgp-encrypt/pgp-encrypt.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,qBACa,iBAAkB,YAAW,0BAA0B;IACrD,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBzD,OAAO,CAClB,MAAM,EAAE,GAAG,EACX,aAAa,EAAE,GAAG,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;CAkDnB"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PgpEncryptService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- let PgpEncryptService = class PgpEncryptService {
7
- async encrypt(pgpKey, dataToEncrypt) {
8
- try {
9
- const openpgp = await import('openpgp');
10
- const publicKey = await openpgp.readKey({
11
- armoredKey: pgpKey,
12
- });
13
- const encrypted = await openpgp.encrypt({
14
- message: await openpgp.createMessage({ text: dataToEncrypt }),
15
- encryptionKeys: publicKey,
16
- format: 'armored',
17
- });
18
- return encrypted.toString();
19
- }
20
- catch (error) {
21
- throw new Error(`File encryption error: \n ${error}`);
22
- }
23
- }
24
- async decrypt(pgpKey, encryptedData, passphrase) {
25
- try {
26
- const openpgp = await import('openpgp');
27
- const openpgpPrivatekey = await openpgp.readPrivateKey({
28
- armoredKey: pgpKey,
29
- });
30
- const decryptKeyOptions = {
31
- privateKey: openpgpPrivatekey,
32
- config: {
33
- allowInsecureDecryptionWithSigningKeys: true,
34
- allowUnauthenticatedMessages: true,
35
- },
36
- };
37
- let privateKey = openpgpPrivatekey;
38
- if (passphrase) {
39
- decryptKeyOptions.passphrase = passphrase;
40
- privateKey = await openpgp.decryptKey(decryptKeyOptions);
41
- }
42
- const armoredMessage = (await openpgp.createMessage({
43
- text: encryptedData,
44
- format: 'utf8',
45
- })).getText();
46
- const message = await openpgp.readMessage({
47
- armoredMessage,
48
- });
49
- const { data: decryptedData } = await openpgp.decrypt({
50
- message,
51
- decryptionKeys: privateKey,
52
- format: 'utf8',
53
- config: {
54
- allowInsecureDecryptionWithSigningKeys: true,
55
- allowUnauthenticatedMessages: true,
56
- },
57
- });
58
- return decryptedData.toString();
59
- }
60
- catch (error) {
61
- throw new Error(`File decryption error: \n ${error}`);
62
- }
63
- }
64
- };
65
- exports.PgpEncryptService = PgpEncryptService;
66
- exports.PgpEncryptService = PgpEncryptService = tslib_1.__decorate([
67
- (0, common_1.Injectable)()
68
- ], PgpEncryptService);
@@ -1,6 +0,0 @@
1
- import * as NodeRSA from 'node-rsa';
2
- export interface RsaEncryptInterface {
3
- encrypt(message: NodeRSA.Data, key: NodeRSA.KeyBits, messageEncoding: NodeRSA.Encoding): string;
4
- decrypt(message: string | Buffer, key: NodeRSA.Key, messageEncoding: NodeRSA.Encoding): string;
5
- }
6
- //# sourceMappingURL=rsa-encrypt.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-encrypt.interface.d.ts","sourceRoot":"","sources":["../../../src/rsa-encrypt/rsa-encrypt.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,OAAO,CACL,OAAO,EAAE,OAAO,CAAC,IAAI,EACrB,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,eAAe,EAAE,OAAO,CAAC,QAAQ,GAChC,MAAM,CAAC;IAEV,OAAO,CACL,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,eAAe,EAAE,OAAO,CAAC,QAAQ,GAChC,MAAM,CAAC;CACX"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class RsaEncryptModule {
2
- }
3
- //# sourceMappingURL=rsa-encrypt.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/rsa-encrypt/rsa-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RsaEncryptModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const rsa_encrypt_service_1 = require("./rsa-encrypt.service");
7
- let RsaEncryptModule = class RsaEncryptModule {
8
- };
9
- exports.RsaEncryptModule = RsaEncryptModule;
10
- exports.RsaEncryptModule = RsaEncryptModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- providers: [rsa_encrypt_service_1.RsaEncryptService],
13
- exports: [rsa_encrypt_service_1.RsaEncryptService],
14
- })
15
- ], RsaEncryptModule);
@@ -1,7 +0,0 @@
1
- import NodeRSA from 'node-rsa';
2
- import { RsaEncryptInterface } from './rsa-encrypt.interface';
3
- export declare class RsaEncryptService implements RsaEncryptInterface {
4
- encrypt(message: NodeRSA.Data, key: NodeRSA.KeyBits, messageEncoding?: NodeRSA.Encoding): string;
5
- decrypt(message: string | Buffer, key: NodeRSA.Key, messageEncoding?: NodeRSA.Encoding): string;
6
- }
7
- //# sourceMappingURL=rsa-encrypt.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsa-encrypt.service.d.ts","sourceRoot":"","sources":["../../../src/rsa-encrypt/rsa-encrypt.service.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qBACa,iBAAkB,YAAW,mBAAmB;IACpD,OAAO,CACZ,OAAO,EAAE,OAAO,CAAC,IAAI,EACrB,GAAG,EAAE,OAAO,CAAC,OAAO,EACpB,eAAe,GAAE,OAAO,CAAC,QAAmB,GAC3C,MAAM;IAMF,OAAO,CACZ,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,eAAe,GAAE,OAAO,CAAC,QAAmB,GAC3C,MAAM;CAKV"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RsaEncryptService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const node_rsa_1 = tslib_1.__importDefault(require("node-rsa"));
7
- let RsaEncryptService = class RsaEncryptService {
8
- encrypt(message, key, messageEncoding = 'base64') {
9
- const rsa = new node_rsa_1.default(key);
10
- const encryptedData = rsa.encrypt(message, messageEncoding);
11
- return encryptedData;
12
- }
13
- decrypt(message, key, messageEncoding = 'buffer') {
14
- const rsa = new node_rsa_1.default(key);
15
- const decrypt = rsa.decrypt(message, messageEncoding).toString();
16
- return decrypt;
17
- }
18
- };
19
- exports.RsaEncryptService = RsaEncryptService;
20
- exports.RsaEncryptService = RsaEncryptService = tslib_1.__decorate([
21
- (0, common_1.Injectable)()
22
- ], RsaEncryptService);
@@ -1,10 +0,0 @@
1
- import { ArchiverOptions } from 'archiver';
2
- export type encryptionMethodType = 'zip20' | 'aes256';
3
- export type archiverOptionsZipEncrypted = ArchiverOptions & {
4
- encryptionMethod: encryptionMethodType;
5
- };
6
- export interface FileFormat {
7
- content: any;
8
- filename: string;
9
- }
10
- //# sourceMappingURL=zipencrypt.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zipencrypt.interface.d.ts","sourceRoot":"","sources":["../../../src/zip-encrypt/zipencrypt.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GAAG,eAAe,GAAG;IAC1D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class ZipEncryptModule {
2
- }
3
- //# sourceMappingURL=zipencrypt.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zipencrypt.module.d.ts","sourceRoot":"","sources":["../../../src/zip-encrypt/zipencrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZipEncryptModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const zipencrypt_service_1 = require("./zipencrypt.service");
7
- let ZipEncryptModule = class ZipEncryptModule {
8
- };
9
- exports.ZipEncryptModule = ZipEncryptModule;
10
- exports.ZipEncryptModule = ZipEncryptModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- providers: [zipencrypt_service_1.ZipEncryptService],
13
- exports: [zipencrypt_service_1.ZipEncryptService],
14
- })
15
- ], ZipEncryptModule);
@@ -1,5 +0,0 @@
1
- import { encryptionMethodType, FileFormat } from './zipencrypt.interface';
2
- export declare class ZipEncryptService {
3
- encryptFiles(files: FileFormat[], password: string, encryptionMethod?: encryptionMethodType): Promise<Buffer | false>;
4
- }
5
- //# sourceMappingURL=zipencrypt.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zipencrypt.service.d.ts","sourceRoot":"","sources":["../../../src/zip-encrypt/zipencrypt.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,oBAAoB,EACpB,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC,qBACa,iBAAiB;IACf,YAAY,CACvB,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,GAAE,oBAA8B,GAC/C,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;CA0B3B"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZipEncryptService = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const archiver_1 = require("archiver");
7
- const stream_buffers_1 = require("stream-buffers");
8
- let ZipEncryptService = class ZipEncryptService {
9
- async encryptFiles(files, password, encryptionMethod = 'zip20') {
10
- const output = new stream_buffers_1.WritableStreamBuffer({
11
- initialSize: 1000,
12
- incrementAmount: 1000,
13
- });
14
- if (!(0, archiver_1.isRegisteredFormat)('zip-encrypted')) {
15
- (0, archiver_1.registerFormat)('zip-encrypted', require('archiver-zip-encrypted'));
16
- }
17
- const archive = (0, archiver_1.create)('zip-encrypted', {
18
- zlib: { level: 8 },
19
- encryptionMethod,
20
- password,
21
- });
22
- archive.pipe(output);
23
- files.map((file) => {
24
- archive.append(file.content, { name: file.filename });
25
- });
26
- await archive.finalize();
27
- output.end();
28
- return output.getContents();
29
- }
30
- };
31
- exports.ZipEncryptService = ZipEncryptService;
32
- exports.ZipEncryptService = ZipEncryptService = tslib_1.__decorate([
33
- (0, common_1.Injectable)()
34
- ], ZipEncryptService);
@@ -1 +0,0 @@
1
- {"version":"5.9.3"}