@lindorm/aes 0.4.2 → 0.5.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/classes/AesKit.d.ts +9 -6
  3. package/dist/classes/AesKit.d.ts.map +1 -1
  4. package/dist/classes/AesKit.js +16 -30
  5. package/dist/classes/AesKit.js.map +1 -1
  6. package/dist/constants/private/format.d.ts.map +1 -1
  7. package/dist/constants/private/version.d.ts +1 -1
  8. package/dist/constants/private/version.d.ts.map +1 -1
  9. package/dist/constants/private/version.js +1 -1
  10. package/dist/constants/private/version.js.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/interfaces/AesKit.d.ts +6 -6
  16. package/dist/interfaces/AesKit.d.ts.map +1 -1
  17. package/dist/types/{aes-data.d.ts → aes-decryption-data.d.ts} +12 -3
  18. package/dist/types/aes-decryption-data.d.ts.map +1 -0
  19. package/dist/types/aes-decryption-data.js +3 -0
  20. package/dist/types/aes-decryption-data.js.map +1 -0
  21. package/dist/types/aes-encryption-data.d.ts +3 -0
  22. package/dist/types/aes-encryption-data.d.ts.map +1 -1
  23. package/dist/types/content.d.ts +4 -0
  24. package/dist/types/content.d.ts.map +1 -0
  25. package/dist/types/{aes-data.js → content.js} +1 -1
  26. package/dist/types/content.js.map +1 -0
  27. package/dist/types/index.d.ts +2 -1
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/index.js +2 -1
  30. package/dist/types/index.js.map +1 -1
  31. package/dist/types/private/aes-data.d.ts +1 -1
  32. package/dist/types/private/aes-data.d.ts.map +1 -1
  33. package/dist/types/private/aes-string.d.ts +2 -0
  34. package/dist/types/private/aes-string.d.ts.map +1 -1
  35. package/dist/types/types.d.ts +1 -1
  36. package/dist/types/types.d.ts.map +1 -1
  37. package/dist/utils/index.d.ts +3 -0
  38. package/dist/utils/index.d.ts.map +1 -0
  39. package/dist/utils/index.js +19 -0
  40. package/dist/utils/index.js.map +1 -0
  41. package/dist/utils/{private/is-aes.d.ts → is-aes.d.ts} +1 -1
  42. package/dist/utils/is-aes.d.ts.map +1 -0
  43. package/dist/utils/is-aes.js.map +1 -0
  44. package/dist/utils/parse-aes.d.ts +3 -0
  45. package/dist/utils/parse-aes.d.ts.map +1 -0
  46. package/dist/utils/parse-aes.js +24 -0
  47. package/dist/utils/parse-aes.js.map +1 -0
  48. package/dist/utils/private/calculate/calculate-aes-encryption.d.ts +2 -2
  49. package/dist/utils/private/calculate/calculate-aes-encryption.d.ts.map +1 -1
  50. package/dist/utils/private/calculate/calculate-aes-encryption.js +3 -0
  51. package/dist/utils/private/calculate/calculate-aes-encryption.js.map +1 -1
  52. package/dist/utils/private/calculate/calculate-content-encryption-key-size.d.ts.map +1 -1
  53. package/dist/utils/private/calculate/calculate-content-encryption-key-size.js +3 -0
  54. package/dist/utils/private/calculate/calculate-content-encryption-key-size.js.map +1 -1
  55. package/dist/utils/private/calculate/calculate-key-wrap-encryption.d.ts.map +1 -1
  56. package/dist/utils/private/calculate/calculate-key-wrap-size.d.ts.map +1 -1
  57. package/dist/utils/private/calculate/calculate-pbkdf-hash.d.ts.map +1 -1
  58. package/dist/utils/private/calculate/calculate-rsa-oaep-hash.d.ts.map +1 -1
  59. package/dist/utils/private/content.d.ts +5 -0
  60. package/dist/utils/private/content.d.ts.map +1 -0
  61. package/dist/utils/private/content.js +51 -0
  62. package/dist/utils/private/content.js.map +1 -0
  63. package/dist/utils/private/data/auth-tag-hmac.d.ts.map +1 -1
  64. package/dist/utils/private/data/auth-tag.d.ts.map +1 -1
  65. package/dist/utils/private/data/get-initialisation-vector.d.ts.map +1 -1
  66. package/dist/utils/private/data/split-content-encryption-key.d.ts.map +1 -1
  67. package/dist/utils/private/diffie-hellman/diffie-hellman-key-wrap.d.ts.map +1 -1
  68. package/dist/utils/private/diffie-hellman/diffie-hellman.d.ts.map +1 -1
  69. package/dist/utils/private/diffie-hellman/diffie-hellman.js +1 -1
  70. package/dist/utils/private/diffie-hellman/diffie-hellman.js.map +1 -1
  71. package/dist/utils/private/diffie-hellman/shared-secret.d.ts.map +1 -1
  72. package/dist/utils/private/diffie-hellman/shared-secret.js +19 -9
  73. package/dist/utils/private/diffie-hellman/shared-secret.js.map +1 -1
  74. package/dist/utils/private/encoded-aes.d.ts.map +1 -1
  75. package/dist/utils/private/encoded-aes.js +9 -5
  76. package/dist/utils/private/encoded-aes.js.map +1 -1
  77. package/dist/utils/private/encryption.d.ts +2 -2
  78. package/dist/utils/private/encryption.d.ts.map +1 -1
  79. package/dist/utils/private/encryption.js +7 -3
  80. package/dist/utils/private/encryption.js.map +1 -1
  81. package/dist/utils/private/get-key/get-decryption-key.d.ts.map +1 -1
  82. package/dist/utils/private/get-key/get-encryption-key.d.ts.map +1 -1
  83. package/dist/utils/private/index.d.ts +0 -1
  84. package/dist/utils/private/index.d.ts.map +1 -1
  85. package/dist/utils/private/index.js +0 -1
  86. package/dist/utils/private/index.js.map +1 -1
  87. package/dist/utils/private/key-derivation/hkdf.d.ts.map +1 -1
  88. package/dist/utils/private/key-derivation/pbkdf.d.ts.map +1 -1
  89. package/dist/utils/private/key-types/get-ec-keys.d.ts.map +1 -1
  90. package/dist/utils/private/key-types/get-oct-keys.d.ts.map +1 -1
  91. package/dist/utils/private/key-types/get-okp-keys.d.ts.map +1 -1
  92. package/dist/utils/private/key-types/get-rsa-keys.d.ts.map +1 -1
  93. package/dist/utils/private/key-types/get-rsa-keys.js +2 -2
  94. package/dist/utils/private/key-types/get-rsa-keys.js.map +1 -1
  95. package/dist/utils/private/key-wrap/ecb-key-wrap.d.ts.map +1 -1
  96. package/dist/utils/private/key-wrap/ecb-key-wrap.js.map +1 -1
  97. package/dist/utils/private/key-wrap/gcm-key-wrap.d.ts.map +1 -1
  98. package/dist/utils/private/key-wrap/key-wrap.d.ts.map +1 -1
  99. package/dist/utils/private/oct/get-oct-dir-keys.d.ts.map +1 -1
  100. package/dist/utils/private/oct/get-oct-dir-keys.js +2 -2
  101. package/dist/utils/private/oct/get-oct-dir-keys.js.map +1 -1
  102. package/dist/utils/private/oct/get-oct-key-key-wrap.d.ts.map +1 -1
  103. package/dist/utils/private/oct/get-oct-key-key-wrap.js +2 -2
  104. package/dist/utils/private/oct/get-oct-key-key-wrap.js.map +1 -1
  105. package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.d.ts.map +1 -1
  106. package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.js +2 -2
  107. package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.js.map +1 -1
  108. package/dist/utils/private/serialised-aes.d.ts.map +1 -1
  109. package/dist/utils/private/serialised-aes.js +5 -0
  110. package/dist/utils/private/serialised-aes.js.map +1 -1
  111. package/dist/utils/private/tokenised-aes.d.ts +1 -1
  112. package/dist/utils/private/tokenised-aes.d.ts.map +1 -1
  113. package/dist/utils/private/tokenised-aes.js +6 -4
  114. package/dist/utils/private/tokenised-aes.js.map +1 -1
  115. package/package.json +10 -8
  116. package/dist/types/aes-data.d.ts.map +0 -1
  117. package/dist/types/aes-data.js.map +0 -1
  118. package/dist/utils/private/is-aes.d.ts.map +0 -1
  119. package/dist/utils/private/is-aes.js.map +0 -1
  120. /package/dist/utils/{private/is-aes.js → is-aes.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.5.0](https://github.com/lindorm-io/monorepo/compare/@lindorm/aes@0.4.2...@lindorm/aes@0.5.0) (2025-06-17)
7
+
8
+ ### Bug Fixes
9
+
10
+ - align with kryptos changes ([3f934a4](https://github.com/lindorm-io/monorepo/commit/3f934a4ec55eee3d4ebc6f0be55886d8f095af8b))
11
+ - align with kryptos changes ([206eb38](https://github.com/lindorm-io/monorepo/commit/206eb38ae2a03b14973e706035c87a953cc753af))
12
+ - improve and expose aes parsing ([ec6f271](https://github.com/lindorm-io/monorepo/commit/ec6f27179ec3d67146a50257cbff98fe253c3380))
13
+ - improve types ([f6ce002](https://github.com/lindorm-io/monorepo/commit/f6ce002e8555c54ba4f12bd67222457fa2bcf90a))
14
+ - update try catch ([7ebebe8](https://github.com/lindorm-io/monorepo/commit/7ebebe81f40851b0d1fcb05e6e6cc60b1c754a91))
15
+
16
+ ### Features
17
+
18
+ - add content type to aes data ([dfb3285](https://github.com/lindorm-io/monorepo/commit/dfb3285ddf20bc77cf8f3d2531e26032853b98a9))
19
+
6
20
  ## [0.4.2](https://github.com/lindorm-io/monorepo/compare/@lindorm/aes@0.4.1...@lindorm/aes@0.4.2) (2025-01-28)
7
21
 
8
22
  **Note:** Version bump only for package @lindorm/aes
@@ -1,16 +1,19 @@
1
1
  import { IKryptos } from "@lindorm/kryptos";
2
2
  import { IAesKit } from "../interfaces";
3
- import { AesDecryptionRecord, AesEncryptionRecord, AesKitOptions, SerialisedAesDecryption, SerialisedAesEncryption } from "../types";
3
+ import { AesContent, AesContentType, AesDecryptionRecord, AesEncryptionRecord, AesKitOptions, SerialisedAesDecryption, SerialisedAesEncryption } from "../types";
4
4
  export declare class AesKit implements IAesKit {
5
5
  private readonly encryption;
6
6
  readonly kryptos: IKryptos;
7
7
  constructor(options: AesKitOptions);
8
- encrypt(data: string, mode?: "encoded"): string;
9
- encrypt(data: string, mode: "record"): AesEncryptionRecord;
10
- encrypt(data: string, mode: "serialised"): SerialisedAesEncryption;
11
- encrypt(data: string, mode: "tokenised"): string;
12
- decrypt(data: AesDecryptionRecord | SerialisedAesDecryption | string): string;
8
+ encrypt(data: AesContent, mode?: "encoded"): string;
9
+ encrypt(data: AesContent, mode: "record"): AesEncryptionRecord;
10
+ encrypt(data: AesContent, mode: "serialised"): SerialisedAesEncryption;
11
+ encrypt(data: AesContent, mode: "tokenised"): string;
12
+ decrypt<T extends AesContent = string>(data: AesDecryptionRecord | SerialisedAesDecryption | string): T;
13
13
  verify(input: string, data: AesDecryptionRecord | SerialisedAesDecryption | string): boolean;
14
14
  assert(input: string, data: AesDecryptionRecord | SerialisedAesDecryption | string): void;
15
+ static contentType(input: any): AesContentType;
16
+ static isAesTokenised(input: any): input is string;
17
+ static parse(data: AesDecryptionRecord | SerialisedAesDecryption | string): AesDecryptionRecord;
15
18
  }
16
19
  //# sourceMappingURL=AesKit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AesKit.d.ts","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAqB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,mBAAmB,EAEnB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAelB,qBAAa,MAAO,YAAW,OAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,SAAgB,OAAO,EAAE,QAAQ,CAAC;gBAEf,OAAO,EAAE,aAAa;IAKlC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,mBAAmB;IAC1D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,uBAAuB;IAClE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM;IA6ChD,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAAG,MAAM;IAgC7E,MAAM,CACX,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAC3D,OAAO;IAIH,MAAM,CACX,KAAK,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,GAAG,GAAG,KAAK,IAAI,MAAM;WAI3C,KAAK,CACjB,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAC3D,mBAAmB;CAGvB"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AesKit = void 0;
4
- const is_1 = require("@lindorm/is");
5
4
  const errors_1 = require("../errors");
5
+ const utils_1 = require("../utils");
6
6
  const private_1 = require("../utils/private");
7
+ const content_1 = require("../utils/private/content");
7
8
  class AesKit {
8
9
  encryption;
9
10
  kryptos;
@@ -15,25 +16,25 @@ class AesKit {
15
16
  switch (mode) {
16
17
  case "encoded":
17
18
  return (0, private_1.createEncodedAesString)((0, private_1.encryptAes)({
18
- data: data,
19
+ data,
19
20
  encryption: this.encryption,
20
21
  kryptos: this.kryptos,
21
22
  }));
22
23
  case "record":
23
24
  return (0, private_1.encryptAes)({
24
- data: data,
25
+ data,
25
26
  encryption: this.encryption,
26
27
  kryptos: this.kryptos,
27
28
  });
28
29
  case "serialised":
29
30
  return (0, private_1.createSerialisedAesRecord)((0, private_1.encryptAes)({
30
- data: data,
31
+ data,
31
32
  encryption: this.encryption,
32
33
  kryptos: this.kryptos,
33
34
  }));
34
35
  case "tokenised":
35
36
  return (0, private_1.createTokenisedAesString)((0, private_1.encryptAes)({
36
- data: data,
37
+ data,
37
38
  encryption: this.encryption,
38
39
  kryptos: this.kryptos,
39
40
  }));
@@ -42,31 +43,7 @@ class AesKit {
42
43
  }
43
44
  }
44
45
  decrypt(data) {
45
- if ((0, is_1.isString)(data) && !(0, private_1.isAesTokenised)(data)) {
46
- return (0, private_1.decryptAes)({
47
- ...(0, private_1.parseEncodedAesString)(data),
48
- kryptos: this.kryptos,
49
- });
50
- }
51
- if ((0, is_1.isString)(data) && (0, private_1.isAesTokenised)(data)) {
52
- return (0, private_1.decryptAes)({
53
- ...(0, private_1.parseTokenisedAesString)(data),
54
- kryptos: this.kryptos,
55
- });
56
- }
57
- if ((0, is_1.isObject)(data) && (0, private_1.isAesBufferData)(data)) {
58
- return (0, private_1.decryptAes)({
59
- ...data,
60
- kryptos: this.kryptos,
61
- });
62
- }
63
- if ((0, is_1.isObject)(data) && (0, private_1.isAesSerialisedData)(data)) {
64
- return (0, private_1.decryptAes)({
65
- ...(0, private_1.parseSerialisedAesRecord)(data),
66
- kryptos: this.kryptos,
67
- });
68
- }
69
- throw new errors_1.AesError("Invalid decryption type");
46
+ return (0, private_1.decryptAes)({ ...(0, utils_1.parseAes)(data), kryptos: this.kryptos });
70
47
  }
71
48
  verify(input, data) {
72
49
  return this.decrypt(data) === input;
@@ -76,6 +53,15 @@ class AesKit {
76
53
  return;
77
54
  throw new errors_1.AesError("Invalid AES cipher");
78
55
  }
56
+ static contentType(input) {
57
+ return (0, content_1.calculateContentType)(input);
58
+ }
59
+ static isAesTokenised(input) {
60
+ return (0, utils_1.isAesTokenised)(input);
61
+ }
62
+ static parse(data) {
63
+ return (0, utils_1.parseAes)(data);
64
+ }
79
65
  }
80
66
  exports.AesKit = AesKit;
81
67
  //# sourceMappingURL=AesKit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AesKit.js","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAEjD,sCAAqC;AAUrC,8CAY0B;AAE1B,MAAa,MAAM;IACA,UAAU,CAAoB;IAC/B,OAAO,CAAW;IAElC,YAAmB,OAAsB;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,SAAS,CAAC;IAClF,CAAC;IAMM,OAAO,CACZ,IAAY,EACZ,OAA0B,SAAS;QAEnC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,SAAS;gBACZ,OAAO,IAAA,gCAAsB,EAC3B,IAAA,oBAAU,EAAC;oBACT,IA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AE,IAAI,CAAC;YAAE,OAAO;QACrC,MAAM,IAAI,iBAAQ,CAAC,oBAAoB,CAAC,CAAC;IAC3C,CAAC;IAIM,MAAM,CAAC,WAAW,CAAC,KAAU;QAClC,OAAO,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,KAAU;QACrC,OAAO,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,KAAK,CACjB,IAA4D;QAE5D,OAAO,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AA7FD,wBA6FC"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/constants/private/format.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,aAAuB,CAAC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/constants/private/format.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,EAAG,WAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const LATEST_AES_VERSION = 9;
1
+ export declare const LATEST_AES_VERSION = 10;
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/constants/private/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,IAAI,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/constants/private/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LATEST_AES_VERSION = void 0;
4
- exports.LATEST_AES_VERSION = 9;
4
+ exports.LATEST_AES_VERSION = 10;
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/constants/private/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/constants/private/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from "./errors";
3
3
  export * from "./interfaces";
4
4
  export * from "./mocks";
5
5
  export * from "./types";
6
+ export * from "./utils";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -19,4 +19,5 @@ __exportStar(require("./errors"), exports);
19
19
  __exportStar(require("./interfaces"), exports);
20
20
  __exportStar(require("./mocks"), exports);
21
21
  __exportStar(require("./types"), exports);
22
+ __exportStar(require("./utils"), exports);
22
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB"}
@@ -1,12 +1,12 @@
1
1
  import { IKryptos } from "@lindorm/kryptos";
2
- import { AesDecryptionRecord, AesEncryptionRecord, SerialisedAesDecryption, SerialisedAesEncryption } from "../types";
2
+ import { AesContent, AesDecryptionRecord, AesEncryptionRecord, SerialisedAesDecryption, SerialisedAesEncryption } from "../types";
3
3
  export interface IAesKit {
4
4
  kryptos: IKryptos;
5
- encrypt(data: string, mode?: "encoded"): string;
6
- encrypt(data: string, mode: "record"): AesEncryptionRecord;
7
- encrypt(data: string, mode: "serialised"): SerialisedAesEncryption;
8
- encrypt(data: string, mode: "tokenised"): string;
9
- decrypt(data: AesDecryptionRecord | SerialisedAesDecryption | string): string;
5
+ encrypt(content: AesContent, mode?: "encoded"): string;
6
+ encrypt(content: AesContent, mode: "record"): AesEncryptionRecord;
7
+ encrypt(content: AesContent, mode: "serialised"): SerialisedAesEncryption;
8
+ encrypt(content: AesContent, mode: "tokenised"): string;
9
+ decrypt<T extends AesContent = string>(data: AesDecryptionRecord | SerialisedAesDecryption | string): T;
10
10
  verify(input: string, data: AesDecryptionRecord | SerialisedAesDecryption | string): boolean;
11
11
  assert(input: string, data: AesDecryptionRecord | SerialisedAesDecryption | string): void;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AesKit.d.ts","sourceRoot":"","sources":["../../src/interfaces/AesKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,QAAQ,CAAC;IAElB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAChD,OAAO,CAAC,IAA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GAAG,MAAM,GAC3D,CAAC,CAAC;IACL,MAAM,CACJ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAC3D,OAAO,CAAC;IACX,MAAM,CACJ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAC3D,IAAI,CAAC;CACT"}
@@ -1,34 +1,43 @@
1
- import { KryptosEncryption } from "@lindorm/kryptos";
1
+ import { KryptosAlgorithm, KryptosEncryption } from "@lindorm/kryptos";
2
+ import { AesContent, AesContentType } from "./content";
2
3
  import { PublicEncryptionJwk } from "./types";
3
4
  export type AesEncryptionMode = "encoded" | "record" | "serialised" | "tokenised";
4
5
  export type AesEncryptionOptions = {
5
- data: Buffer | string;
6
+ data: AesContent;
6
7
  encryption?: KryptosEncryption;
7
8
  };
8
9
  export type AesDecryptionRecord = {
10
+ algorithm?: KryptosAlgorithm;
9
11
  authTag?: Buffer;
10
12
  content: Buffer;
13
+ contentType?: AesContentType;
11
14
  encryption: KryptosEncryption;
12
15
  hkdfSalt?: Buffer;
13
16
  initialisationVector: Buffer;
17
+ keyId?: string;
14
18
  pbkdfIterations?: number;
15
19
  pbkdfSalt?: Buffer;
16
20
  publicEncryptionIv?: Buffer;
17
21
  publicEncryptionJwk?: PublicEncryptionJwk;
18
22
  publicEncryptionKey?: Buffer;
19
23
  publicEncryptionTag?: Buffer;
24
+ version?: number;
20
25
  };
21
26
  export type SerialisedAesDecryption = {
27
+ algorithm?: KryptosAlgorithm;
22
28
  authTag?: string;
23
29
  content: string;
30
+ contentType?: AesContentType;
24
31
  encryption: KryptosEncryption;
25
32
  hkdfSalt?: string;
26
33
  initialisationVector: string;
34
+ keyId?: string;
27
35
  pbkdfIterations?: number;
28
36
  pbkdfSalt?: string;
29
37
  publicEncryptionIv?: string;
30
38
  publicEncryptionJwk?: PublicEncryptionJwk;
31
39
  publicEncryptionKey?: string;
32
40
  publicEncryptionTag?: string;
41
+ version?: number;
33
42
  };
34
- //# sourceMappingURL=aes-data.d.ts.map
43
+ //# sourceMappingURL=aes-decryption-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aes-decryption-data.d.ts","sourceRoot":"","sources":["../../src/types/aes-decryption-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAElF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=aes-decryption-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aes-decryption-data.js","sourceRoot":"","sources":["../../src/types/aes-decryption-data.ts"],"names":[],"mappings":""}
@@ -1,9 +1,11 @@
1
1
  import { KryptosAlgorithm, KryptosEncryption } from "@lindorm/kryptos";
2
+ import { AesContentType } from "./content";
2
3
  import { PublicEncryptionJwk } from "./types";
3
4
  export type AesEncryptionRecord = {
4
5
  algorithm: KryptosAlgorithm;
5
6
  authTag: Buffer;
6
7
  content: Buffer;
8
+ contentType: AesContentType;
7
9
  encryption: KryptosEncryption;
8
10
  hkdfSalt: Buffer | undefined;
9
11
  initialisationVector: Buffer;
@@ -20,6 +22,7 @@ export type SerialisedAesEncryption = {
20
22
  algorithm: KryptosAlgorithm;
21
23
  authTag: string;
22
24
  content: string;
25
+ contentType: AesContentType;
23
26
  encryption: KryptosEncryption;
24
27
  hkdfSalt: string | undefined;
25
28
  initialisationVector: string;
@@ -1 +1 @@
1
- {"version":3,"file":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CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACrD,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Dict } from "@lindorm/types";
2
+ export type AesContent = Array<any> | Buffer | Dict | number | string;
3
+ export type AesContentType = "application/json" | "application/octet-stream" | "text/plain";
4
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/types/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtE,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,0BAA0B,GAC1B,YAAY,CAAC"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=aes-data.js.map
3
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/types/content.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
- export * from "./aes-data";
1
+ export * from "./aes-decryption-data";
2
2
  export * from "./aes-encryption-data";
3
3
  export * from "./aes-kit";
4
+ export * from "./content";
4
5
  export * from "./curve";
5
6
  export * from "./types";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./aes-data"), exports);
17
+ __exportStar(require("./aes-decryption-data"), exports);
18
18
  __exportStar(require("./aes-encryption-data"), exports);
19
19
  __exportStar(require("./aes-kit"), exports);
20
+ __exportStar(require("./content"), exports);
20
21
  __exportStar(require("./curve"), exports);
21
22
  __exportStar(require("./types"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,wDAAsC;AACtC,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,wDAAsC;AACtC,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB"}
@@ -1,5 +1,5 @@
1
1
  import { IKryptos } from "@lindorm/kryptos";
2
- import { AesDecryptionRecord, AesEncryptionOptions, SerialisedAesDecryption } from "../aes-data";
2
+ import { AesDecryptionRecord, AesEncryptionOptions, SerialisedAesDecryption } from "../aes-decryption-data";
3
3
  export type PrivateAesEncryptionOptions = AesEncryptionOptions & {
4
4
  kryptos: IKryptos;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"aes-data.d.ts","sourceRoot":"","sources":["../../../src/types/private/aes-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,qCAAqC,GAAG,uBAAuB,GAAG;IAC5E,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"aes-data.d.ts","sourceRoot":"","sources":["../../../src/types/private/aes-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,qCAAqC,GAAG,uBAAuB,GAAG;IAC5E,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { KryptosAlgorithm, KryptosCurve, KryptosType } from "@lindorm/kryptos";
2
+ import { AesContentType } from "../content";
2
3
  export type AesStringValues = {
3
4
  v: string;
4
5
  alg: KryptosAlgorithm;
6
+ cty: AesContentType;
5
7
  crv: KryptosCurve | undefined;
6
8
  hks: string | undefined;
7
9
  iv: string;
@@ -1 +1 @@
1
- {"version":3,"file":"aes-string.d.ts","sourceRoot":"","sources":["../../../src/types/private/aes-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,gBAAgB,CAAC;IACtB,GAAG,EAAE,YAAY,GAAG,SAAS,CAAC;IAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"aes-string.d.ts","sourceRoot":"","sources":["../../../src/types/private/aes-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,gBAAgB,CAAC;IACtB,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,YAAY,GAAG,SAAS,CAAC;IAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { KryptosJwk } from "@lindorm/kryptos";
2
- export type AesEncryption = "aes-128-cbc" | "aes-192-cbc" | "aes-256-cbc" | "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
2
+ export type AesInternalEncryption = "aes-128-cbc" | "aes-192-cbc" | "aes-256-cbc" | "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
3
3
  export type PublicEncryptionJwk = Pick<KryptosJwk, "crv" | "kty" | "x" | "y">;
4
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./is-aes";
2
+ export * from "./parse-aes";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./is-aes"), exports);
18
+ __exportStar(require("./parse-aes"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
@@ -1,4 +1,4 @@
1
- import { AesDecryptionRecord, SerialisedAesDecryption } from "../../types";
1
+ import { AesDecryptionRecord, SerialisedAesDecryption } from "../types";
2
2
  export declare const isAesBufferData: (data: AesDecryptionRecord | SerialisedAesDecryption) => data is AesDecryptionRecord;
3
3
  export declare const isAesSerialisedData: (options: AesDecryptionRecord | SerialisedAesDecryption) => options is SerialisedAesDecryption;
4
4
  export declare const isAesTokenised: (string: string) => boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-aes.d.ts","sourceRoot":"","sources":["../../src/utils/is-aes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,eAAe,GAC1B,MAAM,mBAAmB,GAAG,uBAAuB,KAClD,IAAI,IAAI,mBAAmE,CAAC;AAE/E,eAAO,MAAM,mBAAmB,GAC9B,SAAS,mBAAmB,GAAG,uBAAuB,KACrD,OAAO,IAAI,uBACqC,CAAC;AAEpD,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,OAIvB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-aes.js","sourceRoot":"","sources":["../../src/utils/is-aes.ts"],"names":[],"mappings":";;;AAAA,oCAAuC;AAGhC,MAAM,eAAe,GAAG,CAC7B,IAAmD,EACtB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,aAAQ,EAAC,CAAC,CAAC,CAAC,CAAC;AAFlE,QAAA,eAAe,mBAEmD;AAExE,MAAM,mBAAmB,GAAG,CACjC,OAAsD,EAClB,EAAE,CACtC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,aAAQ,EAAC,CAAC,CAAC,CAAC,CAAC;AAHvC,QAAA,mBAAmB,uBAGoB;AAE7C,MAAM,cAAc,GAAG,CAAC,MAAc,EAAW,EAAE,CACxD,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;IACtB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;IACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IACrB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAJb,QAAA,cAAc,kBAID"}
@@ -0,0 +1,3 @@
1
+ import { AesDecryptionRecord, SerialisedAesDecryption } from "../types";
2
+ export declare const parseAes: (data: AesDecryptionRecord | SerialisedAesDecryption | string) => AesDecryptionRecord;
3
+ //# sourceMappingURL=parse-aes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-aes.d.ts","sourceRoot":"","sources":["../../src/utils/parse-aes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAQxE,eAAO,MAAM,QAAQ,GACnB,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,KAC3D,mBAkBF,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAes = void 0;
4
+ const is_1 = require("@lindorm/is");
5
+ const errors_1 = require("../errors");
6
+ const is_aes_1 = require("./is-aes");
7
+ const private_1 = require("./private");
8
+ const parseAes = (data) => {
9
+ if ((0, is_1.isString)(data) && !(0, is_aes_1.isAesTokenised)(data)) {
10
+ return (0, private_1.parseEncodedAesString)(data);
11
+ }
12
+ if ((0, is_1.isString)(data) && (0, is_aes_1.isAesTokenised)(data)) {
13
+ return (0, private_1.parseTokenisedAesString)(data);
14
+ }
15
+ if ((0, is_1.isObject)(data) && (0, is_aes_1.isAesBufferData)(data)) {
16
+ return data;
17
+ }
18
+ if ((0, is_1.isObject)(data) && (0, is_aes_1.isAesSerialisedData)(data)) {
19
+ return (0, private_1.parseSerialisedAesRecord)(data);
20
+ }
21
+ throw new errors_1.AesError("Invalid AES data");
22
+ };
23
+ exports.parseAes = parseAes;
24
+ //# sourceMappingURL=parse-aes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-aes.js","sourceRoot":"","sources":["../../src/utils/parse-aes.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AACjD,sCAAqC;AAErC,qCAAgF;AAChF,uCAImB;AAEZ,MAAM,QAAQ,GAAG,CACtB,IAA4D,EACvC,EAAE;IACvB,IAAI,IAAA,aAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,IAAA,uBAAc,EAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAA,+BAAqB,EAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,IAAA,aAAQ,EAAC,IAAI,CAAC,IAAI,IAAA,uBAAc,EAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAA,iCAAuB,EAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,IAAA,aAAQ,EAAC,IAAI,CAAC,IAAI,IAAA,wBAAe,EAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAA,aAAQ,EAAC,IAAI,CAAC,IAAI,IAAA,4BAAmB,EAAC,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO,IAAA,kCAAwB,EAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,iBAAQ,CAAC,kBAAkB,CAAC,CAAC;AACzC,CAAC,CAAC;AApBW,QAAA,QAAQ,YAoBnB"}
@@ -1,4 +1,4 @@
1
1
  import { KryptosEncryption } from "@lindorm/kryptos";
2
- import { AesEncryption } from "../../../types";
3
- export declare const calculateAesEncryption: (encryption: KryptosEncryption) => AesEncryption;
2
+ import { AesInternalEncryption } from "../../../types";
3
+ export declare const calculateAesEncryption: (encryption: KryptosEncryption) => AesInternalEncryption;
4
4
  //# sourceMappingURL=calculate-aes-encryption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-aes-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,sBAAsB,eAAgB,iBAAiB,KAAG,aAuBtE,CAAC"}
1
+ {"version":3,"file":"calculate-aes-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,eAAO,MAAM,sBAAsB,GACjC,YAAY,iBAAiB,KAC5B,qBA2BF,CAAC"}
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateAesEncryption = void 0;
4
4
  const errors_1 = require("../../../errors");
5
5
  const calculateAesEncryption = (encryption) => {
6
+ if (!encryption) {
7
+ throw new errors_1.AesError("Encryption algorithm is required");
8
+ }
6
9
  switch (encryption) {
7
10
  case "A128CBC-HS256":
8
11
  return "aes-128-cbc";
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAGpC,MAAM,sBAAsB,GAAG,CAAC,UAA6B,EAAiB,EAAE;IACrF,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,sBAAsB,0BAuBjC"}
1
+ {"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAGpC,MAAM,sBAAsB,GAAG,CACpC,UAA6B,EACN,EAAE;IACzB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,CAAC,CAAC;IACzD,CAAC;IAED,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AA7BW,QAAA,sBAAsB,0BA6BjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,iCAAiC,eAChC,iBAAiB,KAC5B,YAuBF,CAAC"}
1
+ {"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,iCAAiC,GAC5C,YAAY,iBAAiB,KAC5B,YA2BF,CAAC"}
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateContentEncryptionKeySize = void 0;
4
4
  const errors_1 = require("../../../errors");
5
5
  const calculateContentEncryptionKeySize = (encryption) => {
6
+ if (!encryption) {
7
+ throw new errors_1.AesError("Encryption algorithm is required");
8
+ }
6
9
  switch (encryption) {
7
10
  case "A128GCM":
8
11
  return 16;
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,iCAAiC,GAAG,CAC/C,UAA6B,EACf,EAAE;IAChB,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC;AAzBW,QAAA,iCAAiC,qCAyB5C"}
1
+ {"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,iCAAiC,GAAG,CAC/C,UAA6B,EACf,EAAE;IAChB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,CAAC,CAAC;IACzD,CAAC;IAED,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC;AA7BW,QAAA,iCAAiC,qCA6B5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,0BAA0B,YAAa,QAAQ,KAAG,iBAgC9D,CAAC"}
1
+ {"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,0BAA0B,GAAI,SAAS,QAAQ,KAAG,iBAgC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,oBAAoB,cAAe,gBAAgB,KAAG,YA0BlE,CAAC"}
1
+ {"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,oBAAoB,GAAI,WAAW,gBAAgB,KAAG,YA0BlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,uBAAuB,YAAa,QAAQ,KAAG,YAc3D,CAAC"}
1
+ {"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,uBAAuB,GAAI,SAAS,QAAQ,KAAG,YAc3D,CAAC"}