@edirect/encrypt-modules 10.1.0 → 11.0.29

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 (84) hide show
  1. package/README.md +9 -0
  2. package/dist/README.md +9 -0
  3. package/dist/package.json +35 -0
  4. package/dist/{aes-encrypt → src/aes-encrypt}/aes-encrypt.interface.d.ts +6 -7
  5. package/dist/src/aes-encrypt/aes-encrypt.interface.d.ts.map +1 -0
  6. package/dist/{aes-encrypt → src/aes-encrypt}/aes-encrypt.interface.js +0 -1
  7. package/dist/src/aes-encrypt/aes-encrypt.module.d.ts +3 -0
  8. package/dist/src/aes-encrypt/aes-encrypt.module.d.ts.map +1 -0
  9. package/dist/src/aes-encrypt/aes-encrypt.module.js +15 -0
  10. package/dist/{aes-encrypt → src/aes-encrypt}/aes-encrypt.service.d.ts +2 -2
  11. package/dist/src/aes-encrypt/aes-encrypt.service.d.ts.map +1 -0
  12. package/dist/{aes-encrypt → src/aes-encrypt}/aes-encrypt.service.js +21 -21
  13. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts +5 -0
  14. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts.map +1 -0
  15. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.interface.js +2 -0
  16. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts +3 -0
  17. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts.map +1 -0
  18. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.module.js +15 -0
  19. package/dist/{bin-pgp-encrypt → src/bin-pgp-encrypt}/bin-pgp-encrypt.service.d.ts +2 -1
  20. package/dist/src/bin-pgp-encrypt/bin-pgp-encrypt.service.d.ts.map +1 -0
  21. package/dist/{bin-pgp-encrypt → src/bin-pgp-encrypt}/bin-pgp-encrypt.service.js +5 -11
  22. package/dist/{index.d.ts → src/index.d.ts} +1 -0
  23. package/dist/src/index.d.ts.map +1 -0
  24. package/dist/{index.js → src/index.js} +0 -1
  25. package/dist/{pgp-encrypt → src/pgp-encrypt}/pgp-encrypt.interface.d.ts +1 -0
  26. package/dist/src/pgp-encrypt/pgp-encrypt.interface.d.ts.map +1 -0
  27. package/dist/{pgp-encrypt → src/pgp-encrypt}/pgp-encrypt.interface.js +0 -1
  28. package/dist/src/pgp-encrypt/pgp-encrypt.module.d.ts +3 -0
  29. package/dist/src/pgp-encrypt/pgp-encrypt.module.d.ts.map +1 -0
  30. package/dist/src/pgp-encrypt/pgp-encrypt.module.js +15 -0
  31. package/dist/{pgp-encrypt → src/pgp-encrypt}/pgp-encrypt.service.d.ts +1 -0
  32. package/dist/src/pgp-encrypt/pgp-encrypt.service.d.ts.map +1 -0
  33. package/dist/{pgp-encrypt → src/pgp-encrypt}/pgp-encrypt.service.js +5 -11
  34. package/dist/{rsa-encrypt → src/rsa-encrypt}/rsa-encrypt.interface.d.ts +1 -1
  35. package/dist/src/rsa-encrypt/rsa-encrypt.interface.d.ts.map +1 -0
  36. package/dist/{rsa-encrypt → src/rsa-encrypt}/rsa-encrypt.interface.js +0 -1
  37. package/dist/src/rsa-encrypt/rsa-encrypt.module.d.ts +3 -0
  38. package/dist/src/rsa-encrypt/rsa-encrypt.module.d.ts.map +1 -0
  39. package/dist/src/rsa-encrypt/rsa-encrypt.module.js +15 -0
  40. package/dist/{rsa-encrypt → src/rsa-encrypt}/rsa-encrypt.service.d.ts +2 -2
  41. package/dist/src/rsa-encrypt/rsa-encrypt.service.d.ts.map +1 -0
  42. package/dist/src/rsa-encrypt/rsa-encrypt.service.js +22 -0
  43. package/dist/{zip-encrypt → src/zip-encrypt}/zipencrypt.interface.d.ts +1 -0
  44. package/dist/src/zip-encrypt/zipencrypt.interface.d.ts.map +1 -0
  45. package/dist/{zip-encrypt → src/zip-encrypt}/zipencrypt.interface.js +0 -1
  46. package/dist/src/zip-encrypt/zipencrypt.module.d.ts +3 -0
  47. package/dist/src/zip-encrypt/zipencrypt.module.d.ts.map +1 -0
  48. package/dist/src/zip-encrypt/zipencrypt.module.js +15 -0
  49. package/dist/{zip-encrypt → src/zip-encrypt}/zipencrypt.service.d.ts +1 -1
  50. package/dist/src/zip-encrypt/zipencrypt.service.d.ts.map +1 -0
  51. package/dist/{zip-encrypt → src/zip-encrypt}/zipencrypt.service.js +10 -12
  52. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  53. package/package.json +44 -20
  54. package/.eslintrc.js +0 -24
  55. package/dist/aes-encrypt/aes-encrypt.interface.js.map +0 -1
  56. package/dist/aes-encrypt/aes-encrypt.module.d.ts +0 -2
  57. package/dist/aes-encrypt/aes-encrypt.module.js +0 -21
  58. package/dist/aes-encrypt/aes-encrypt.module.js.map +0 -1
  59. package/dist/aes-encrypt/aes-encrypt.service.js.map +0 -1
  60. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.interface.d.ts +0 -4
  61. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.interface.js +0 -3
  62. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.interface.js.map +0 -1
  63. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.module.d.ts +0 -2
  64. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.module.js +0 -21
  65. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.module.js.map +0 -1
  66. package/dist/bin-pgp-encrypt/bin-pgp-encrypt.service.js.map +0 -1
  67. package/dist/index.js.map +0 -1
  68. package/dist/pgp-encrypt/pgp-encrypt.interface.js.map +0 -1
  69. package/dist/pgp-encrypt/pgp-encrypt.module.d.ts +0 -2
  70. package/dist/pgp-encrypt/pgp-encrypt.module.js +0 -21
  71. package/dist/pgp-encrypt/pgp-encrypt.module.js.map +0 -1
  72. package/dist/pgp-encrypt/pgp-encrypt.service.js.map +0 -1
  73. package/dist/rsa-encrypt/rsa-encrypt.interface.js.map +0 -1
  74. package/dist/rsa-encrypt/rsa-encrypt.module.d.ts +0 -2
  75. package/dist/rsa-encrypt/rsa-encrypt.module.js +0 -21
  76. package/dist/rsa-encrypt/rsa-encrypt.module.js.map +0 -1
  77. package/dist/rsa-encrypt/rsa-encrypt.service.js +0 -28
  78. package/dist/rsa-encrypt/rsa-encrypt.service.js.map +0 -1
  79. package/dist/tsconfig.build.tsbuildinfo +0 -1
  80. package/dist/zip-encrypt/zipencrypt.interface.js.map +0 -1
  81. package/dist/zip-encrypt/zipencrypt.module.d.ts +0 -2
  82. package/dist/zip-encrypt/zipencrypt.module.js +0 -21
  83. package/dist/zip-encrypt/zipencrypt.module.js.map +0 -1
  84. package/dist/zip-encrypt/zipencrypt.service.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @edirect/encrypt-modules
2
+
3
+ The EDirectInsure Encrypt Modules.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ $ npm i --save @edirect/encrypt-modules
9
+ ```
package/dist/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @edirect/encrypt-modules
2
+
3
+ The EDirectInsure Encrypt Modules.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ $ npm i --save @edirect/encrypt-modules
9
+ ```
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@edirect/encrypt-modules",
3
+ "version": "11.0.26",
4
+ "description": "Encrypt Modules",
5
+ "main": "./dist/src/index.js",
6
+ "types": "./dist/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "development": "./src/index.ts",
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.6",
21
+ "archiver-zip-encrypted": "^2.0.0",
22
+ "node-rsa": "1.1.1",
23
+ "openpgp": "^6.2.2",
24
+ "stream-buffers": "^3.0.3",
25
+ "archiver": "7.0.1",
26
+ "tslib": "^2.8.1"
27
+ },
28
+ "devDependencies": {
29
+ "@types/archiver": "^6.0.3",
30
+ "@types/node": "^24.3.1",
31
+ "@types/node-rsa": "^1.1.4",
32
+ "@types/stream-buffers": "^3.0.7"
33
+ },
34
+ "type": "commonjs"
35
+ }
@@ -1,20 +1,18 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { CipherKey, BinaryLike, CipherCCMTypes, Utf8AsciiBinaryEncoding, HexBase64BinaryEncoding } from 'crypto';
1
+ import { BinaryLike, CipherCCMTypes, CipherKey, Encoding } from 'crypto';
4
2
  import { TransformOptions } from 'stream';
5
3
  type encryptionMethods = CipherCCMTypes | 'aes-256-cbc';
6
4
  export interface IaesEncryptOptionalParameters {
7
5
  iv?: BinaryLike;
8
6
  encryptionMethod?: encryptionMethods;
9
- inputEncoding?: Utf8AsciiBinaryEncoding;
10
- outputEncoding?: HexBase64BinaryEncoding;
7
+ inputEncoding?: Encoding;
8
+ outputEncoding?: Encoding;
11
9
  options?: TransformOptions;
12
10
  }
13
11
  export interface IaesDecryptOptionalParameters {
14
12
  iv?: BinaryLike;
15
13
  encryptionMethod?: encryptionMethods;
16
- inputEncoding?: HexBase64BinaryEncoding;
17
- outputEncoding?: Utf8AsciiBinaryEncoding;
14
+ inputEncoding?: Encoding;
15
+ outputEncoding?: Encoding;
18
16
  options?: TransformOptions;
19
17
  }
20
18
  export interface AesEncryptInterface {
@@ -22,3 +20,4 @@ export interface AesEncryptInterface {
22
20
  decrypt(encryptedMessage: string, passphrase: BinaryLike, optionalParameters?: IaesDecryptOptionalParameters): string;
23
21
  }
24
22
  export {};
23
+ //# sourceMappingURL=aes-encrypt.interface.d.ts.map
@@ -0,0 +1 @@
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,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=aes-encrypt.interface.js.map
@@ -0,0 +1,3 @@
1
+ export declare class AesEncryptModule {
2
+ }
3
+ //# sourceMappingURL=aes-encrypt.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aes-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/aes-encrypt/aes-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -0,0 +1,15 @@
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 +1,7 @@
1
- /// <reference types="node" />
2
- import { CipherKey, BinaryLike } from 'crypto';
1
+ import { BinaryLike, CipherKey } from 'crypto';
3
2
  import { AesEncryptInterface, IaesDecryptOptionalParameters, IaesEncryptOptionalParameters } from './aes-encrypt.interface';
4
3
  export declare class AesEncryptService implements AesEncryptInterface {
5
4
  encrypt(message: string, passphrase: CipherKey, optionalParameters?: IaesEncryptOptionalParameters): string;
6
5
  decrypt(encryptedMessage: string, passphrase: BinaryLike, optionalParameters?: IaesDecryptOptionalParameters): string;
7
6
  }
7
+ //# sourceMappingURL=aes-encrypt.service.d.ts.map
@@ -0,0 +1 @@
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 +1,42 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.AesEncryptService = void 0;
4
+ const tslib_1 = require("tslib");
10
5
  const common_1 = require("@nestjs/common");
11
6
  const crypto_1 = require("crypto");
12
7
  let AesEncryptService = class AesEncryptService {
13
8
  encrypt(message, passphrase, optionalParameters = {}) {
14
- optionalParameters = Object.assign({
15
- iv: Buffer.alloc(16).fill(0),
16
- encryptionMethod: 'aes-256-cbc',
17
- inputEncoding: 'utf8',
18
- outputEncoding: 'hex',
19
- }, 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
+ };
20
18
  const cipher = (0, crypto_1.createCipheriv)(optionalParameters.encryptionMethod, passphrase, optionalParameters.iv, optionalParameters.options);
21
19
  let result = cipher.update(message, optionalParameters.inputEncoding, optionalParameters.outputEncoding);
22
20
  result += cipher.final(optionalParameters.outputEncoding);
23
21
  return result;
24
22
  }
25
23
  decrypt(encryptedMessage, passphrase, optionalParameters = {}) {
26
- optionalParameters = Object.assign({
27
- encryptionMethod: 'aes-256-cbc',
28
- iv: Buffer.alloc(16).fill(0),
29
- inputEncoding: 'hex',
30
- outputEncoding: 'utf8',
31
- }, 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
+ };
32
33
  const decipher = (0, crypto_1.createDecipheriv)(optionalParameters.encryptionMethod, passphrase, optionalParameters.iv, optionalParameters.options);
33
34
  let result = decipher.update(encryptedMessage, optionalParameters.inputEncoding, optionalParameters.outputEncoding);
34
35
  result += decipher.final(optionalParameters.outputEncoding);
35
36
  return result;
36
37
  }
37
38
  };
38
- AesEncryptService = __decorate([
39
+ exports.AesEncryptService = AesEncryptService;
40
+ exports.AesEncryptService = AesEncryptService = tslib_1.__decorate([
39
41
  (0, common_1.Injectable)()
40
42
  ], AesEncryptService);
41
- exports.AesEncryptService = AesEncryptService;
42
- //# sourceMappingURL=aes-encrypt.service.js.map
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export declare class BinPgpEncryptModule {
2
+ }
3
+ //# sourceMappingURL=bin-pgp-encrypt.module.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,15 @@
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,5 +1,6 @@
1
1
  import { IBinPgpEncryptModuleInterface } from './bin-pgp-encrypt.interface';
2
2
  export declare class BinPgpEncryptService implements IBinPgpEncryptModuleInterface {
3
3
  encrypt(pgpKey: string, dataToEncrypt: any): Promise<string>;
4
- decrypt(pgpKey: string, encryptedData: BinaryData, passphrase?: string): Promise<string>;
4
+ decrypt(pgpKey: string, encryptedData: Buffer | Uint8Array | string, passphrase?: string): Promise<string>;
5
5
  }
6
+ //# sourceMappingURL=bin-pgp-encrypt.service.d.ts.map
@@ -0,0 +1 @@
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;IAgB5D,OAAO,CAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAC3C,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;CA2CnB"}
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.BinPgpEncryptService = void 0;
4
+ const tslib_1 = require("tslib");
10
5
  const common_1 = require("@nestjs/common");
11
- const openpgp = require("openpgp");
6
+ const openpgp = tslib_1.__importStar(require("openpgp"));
12
7
  let BinPgpEncryptService = class BinPgpEncryptService {
13
8
  async encrypt(pgpKey, dataToEncrypt) {
14
9
  try {
@@ -39,7 +34,7 @@ let BinPgpEncryptService = class BinPgpEncryptService {
39
34
  },
40
35
  };
41
36
  let privateKey = openpgpPrivatekey;
42
- if (!!passphrase) {
37
+ if (passphrase) {
43
38
  decryptKeyOptions.passphrase = passphrase;
44
39
  privateKey = await openpgp.decryptKey(decryptKeyOptions);
45
40
  }
@@ -62,8 +57,7 @@ let BinPgpEncryptService = class BinPgpEncryptService {
62
57
  }
63
58
  }
64
59
  };
65
- BinPgpEncryptService = __decorate([
60
+ exports.BinPgpEncryptService = BinPgpEncryptService;
61
+ exports.BinPgpEncryptService = BinPgpEncryptService = tslib_1.__decorate([
66
62
  (0, common_1.Injectable)()
67
63
  ], BinPgpEncryptService);
68
- exports.BinPgpEncryptService = BinPgpEncryptService;
69
- //# sourceMappingURL=bin-pgp-encrypt.service.js.map
@@ -8,3 +8,4 @@ export { BinPgpEncryptModule } from './bin-pgp-encrypt/bin-pgp-encrypt.module';
8
8
  export { BinPgpEncryptService } from './bin-pgp-encrypt/bin-pgp-encrypt.service';
9
9
  export { ZipEncryptModule } from './zip-encrypt/zipencrypt.module';
10
10
  export { ZipEncryptService } from './zip-encrypt/zipencrypt.service';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -21,4 +21,3 @@ var zipencrypt_module_1 = require("./zip-encrypt/zipencrypt.module");
21
21
  Object.defineProperty(exports, "ZipEncryptModule", { enumerable: true, get: function () { return zipencrypt_module_1.ZipEncryptModule; } });
22
22
  var zipencrypt_service_1 = require("./zip-encrypt/zipencrypt.service");
23
23
  Object.defineProperty(exports, "ZipEncryptService", { enumerable: true, get: function () { return zipencrypt_service_1.ZipEncryptService; } });
24
- //# sourceMappingURL=index.js.map
@@ -2,3 +2,4 @@ export interface IPgpEncryptModuleInterface {
2
2
  encrypt(pgpKey: any, dataToEncrypt: any): Promise<string>;
3
3
  decrypt(pgpKey: any, encryptedData: any, passphrase?: string): Promise<string>;
4
4
  }
5
+ //# sourceMappingURL=pgp-encrypt.interface.d.ts.map
@@ -0,0 +1 @@
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,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=pgp-encrypt.interface.js.map
@@ -0,0 +1,3 @@
1
+ export declare class PgpEncryptModule {
2
+ }
3
+ //# sourceMappingURL=pgp-encrypt.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pgp-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/pgp-encrypt/pgp-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -0,0 +1,15 @@
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);
@@ -3,3 +3,4 @@ export declare class PgpEncryptService implements IPgpEncryptModuleInterface {
3
3
  encrypt(pgpKey: any, dataToEncrypt: any): Promise<string>;
4
4
  decrypt(pgpKey: any, encryptedData: any, passphrase?: string): Promise<string>;
5
5
  }
6
+ //# sourceMappingURL=pgp-encrypt.service.d.ts.map
@@ -0,0 +1 @@
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;IAgBzD,OAAO,CAClB,MAAM,EAAE,GAAG,EACX,aAAa,EAAE,GAAG,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;CAiDnB"}
@@ -1,14 +1,9 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.PgpEncryptService = void 0;
4
+ const tslib_1 = require("tslib");
10
5
  const common_1 = require("@nestjs/common");
11
- const openpgp = require("openpgp");
6
+ const openpgp = tslib_1.__importStar(require("openpgp"));
12
7
  let PgpEncryptService = class PgpEncryptService {
13
8
  async encrypt(pgpKey, dataToEncrypt) {
14
9
  try {
@@ -39,7 +34,7 @@ let PgpEncryptService = class PgpEncryptService {
39
34
  },
40
35
  };
41
36
  let privateKey = openpgpPrivatekey;
42
- if (!!passphrase) {
37
+ if (passphrase) {
43
38
  decryptKeyOptions.passphrase = passphrase;
44
39
  privateKey = await openpgp.decryptKey(decryptKeyOptions);
45
40
  }
@@ -66,8 +61,7 @@ let PgpEncryptService = class PgpEncryptService {
66
61
  }
67
62
  }
68
63
  };
69
- PgpEncryptService = __decorate([
64
+ exports.PgpEncryptService = PgpEncryptService;
65
+ exports.PgpEncryptService = PgpEncryptService = tslib_1.__decorate([
70
66
  (0, common_1.Injectable)()
71
67
  ], PgpEncryptService);
72
- exports.PgpEncryptService = PgpEncryptService;
73
- //# sourceMappingURL=pgp-encrypt.service.js.map
@@ -1,6 +1,6 @@
1
- /// <reference types="node" />
2
1
  import * as NodeRSA from 'node-rsa';
3
2
  export interface RsaEncryptInterface {
4
3
  encrypt(message: NodeRSA.Data, key: NodeRSA.KeyBits, messageEncoding: NodeRSA.Encoding): string;
5
4
  decrypt(message: string | Buffer, key: NodeRSA.Key, messageEncoding: NodeRSA.Encoding): string;
6
5
  }
6
+ //# sourceMappingURL=rsa-encrypt.interface.d.ts.map
@@ -0,0 +1 @@
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,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=rsa-encrypt.interface.js.map
@@ -0,0 +1,3 @@
1
+ export declare class RsaEncryptModule {
2
+ }
3
+ //# sourceMappingURL=rsa-encrypt.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsa-encrypt.module.d.ts","sourceRoot":"","sources":["../../../src/rsa-encrypt/rsa-encrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -0,0 +1,15 @@
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 +1,7 @@
1
- /// <reference types="node" />
2
- import * as NodeRSA from 'node-rsa';
1
+ import NodeRSA from 'node-rsa';
3
2
  import { RsaEncryptInterface } from './rsa-encrypt.interface';
4
3
  export declare class RsaEncryptService implements RsaEncryptInterface {
5
4
  encrypt(message: NodeRSA.Data, key: NodeRSA.KeyBits, messageEncoding?: NodeRSA.Encoding): string;
6
5
  decrypt(message: string | Buffer, key: NodeRSA.Key, messageEncoding?: NodeRSA.Encoding): string;
7
6
  }
7
+ //# sourceMappingURL=rsa-encrypt.service.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,22 @@
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);
@@ -7,3 +7,4 @@ export interface FileFormat {
7
7
  content: any;
8
8
  filename: string;
9
9
  }
10
+ //# sourceMappingURL=zipencrypt.interface.d.ts.map
@@ -0,0 +1 @@
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,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=zipencrypt.interface.js.map
@@ -0,0 +1,3 @@
1
+ export declare class ZipEncryptModule {
2
+ }
3
+ //# sourceMappingURL=zipencrypt.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zipencrypt.module.d.ts","sourceRoot":"","sources":["../../../src/zip-encrypt/zipencrypt.module.ts"],"names":[],"mappings":"AAGA,qBAIa,gBAAgB;CAAG"}
@@ -0,0 +1,15 @@
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 +1,5 @@
1
- /// <reference types="node" />
2
1
  import { encryptionMethodType, FileFormat } from './zipencrypt.interface';
3
2
  export declare class ZipEncryptService {
4
3
  encryptFiles(files: FileFormat[], password: string, encryptionMethod?: encryptionMethodType): Promise<Buffer | false>;
5
4
  }
5
+ //# sourceMappingURL=zipencrypt.service.d.ts.map
@@ -0,0 +1 @@
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,25 +1,24 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.ZipEncryptService = void 0;
4
+ const tslib_1 = require("tslib");
10
5
  const common_1 = require("@nestjs/common");
11
6
  const archiver_1 = require("archiver");
12
7
  const stream_buffers_1 = require("stream-buffers");
13
8
  let ZipEncryptService = class ZipEncryptService {
14
9
  async encryptFiles(files, password, encryptionMethod = 'zip20') {
15
10
  const output = new stream_buffers_1.WritableStreamBuffer({
16
- initialSize: (1000),
17
- incrementAmount: (1000),
11
+ initialSize: 1000,
12
+ incrementAmount: 1000,
18
13
  });
19
14
  if (!(0, archiver_1.isRegisteredFormat)('zip-encrypted')) {
20
15
  (0, archiver_1.registerFormat)('zip-encrypted', require('archiver-zip-encrypted'));
21
16
  }
22
- const archive = (0, archiver_1.create)('zip-encrypted', { zlib: { level: 8 }, encryptionMethod, password });
17
+ const archive = (0, archiver_1.create)('zip-encrypted', {
18
+ zlib: { level: 8 },
19
+ encryptionMethod,
20
+ password,
21
+ });
23
22
  archive.pipe(output);
24
23
  files.map((file) => {
25
24
  archive.append(file.content, { name: file.filename });
@@ -29,8 +28,7 @@ let ZipEncryptService = class ZipEncryptService {
29
28
  return output.getContents();
30
29
  }
31
30
  };
32
- ZipEncryptService = __decorate([
31
+ exports.ZipEncryptService = ZipEncryptService;
32
+ exports.ZipEncryptService = ZipEncryptService = tslib_1.__decorate([
33
33
  (0, common_1.Injectable)()
34
34
  ], ZipEncryptService);
35
- exports.ZipEncryptService = ZipEncryptService;
36
- //# sourceMappingURL=zipencrypt.service.js.map
@@ -0,0 +1 @@
1
+ {"version":"5.9.2"}