@lindorm/aes 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/AesKit.d.ts +3 -1
- package/dist/classes/AesKit.d.ts.map +1 -1
- package/dist/classes/AesKit.js +72 -5
- package/dist/classes/AesKit.js.map +1 -1
- package/dist/errors/AesError.d.ts +1 -0
- package/dist/errors/AesError.d.ts.map +1 -1
- package/dist/errors/AesError.js +1 -0
- package/dist/errors/AesError.js.map +1 -1
- package/dist/interfaces/AesKit.d.ts +17 -0
- package/dist/interfaces/AesKit.d.ts.map +1 -1
- package/dist/internal/utils/aes-descriptor.d.ts +17 -0
- package/dist/internal/utils/aes-descriptor.d.ts.map +1 -0
- package/dist/internal/utils/aes-descriptor.js +100 -0
- package/dist/internal/utils/aes-descriptor.js.map +1 -0
- package/dist/internal/utils/aes-header.d.ts.map +1 -1
- package/dist/internal/utils/aes-header.js +6 -0
- package/dist/internal/utils/aes-header.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-aes-encryption.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-aes-encryption.js +2 -22
- package/dist/internal/utils/calculate/calculate-aes-encryption.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-content-encryption-key-size.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-content-encryption-key-size.js +2 -22
- package/dist/internal/utils/calculate/calculate-content-encryption-key-size.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-encryption.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-encryption.js +5 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-encryption.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-size.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-size.js +6 -1
- package/dist/internal/utils/calculate/calculate-key-wrap-size.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-pbkdf-hash.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-pbkdf-hash.js +6 -1
- package/dist/internal/utils/calculate/calculate-pbkdf-hash.js.map +1 -1
- package/dist/internal/utils/calculate/calculate-rsa-oaep-hash.d.ts.map +1 -1
- package/dist/internal/utils/calculate/calculate-rsa-oaep-hash.js +4 -1
- package/dist/internal/utils/calculate/calculate-rsa-oaep-hash.js.map +1 -1
- package/dist/internal/utils/content-primitive.d.ts +24 -0
- package/dist/internal/utils/content-primitive.d.ts.map +1 -0
- package/dist/internal/utils/content-primitive.js +47 -0
- package/dist/internal/utils/content-primitive.js.map +1 -0
- package/dist/internal/utils/content.d.ts.map +1 -1
- package/dist/internal/utils/content.js +12 -3
- package/dist/internal/utils/content.js.map +1 -1
- package/dist/internal/utils/data/auth-tag-hmac.d.ts.map +1 -1
- package/dist/internal/utils/data/auth-tag-hmac.js +11 -2
- package/dist/internal/utils/data/auth-tag-hmac.js.map +1 -1
- package/dist/internal/utils/data/auth-tag.d.ts.map +1 -1
- package/dist/internal/utils/data/auth-tag.js +28 -17
- package/dist/internal/utils/data/auth-tag.js.map +1 -1
- package/dist/internal/utils/data/get-initialisation-vector.d.ts.map +1 -1
- package/dist/internal/utils/data/get-initialisation-vector.js +2 -17
- package/dist/internal/utils/data/get-initialisation-vector.js.map +1 -1
- package/dist/internal/utils/data/split-content-encryption-key.d.ts.map +1 -1
- package/dist/internal/utils/data/split-content-encryption-key.js +12 -22
- package/dist/internal/utils/data/split-content-encryption-key.js.map +1 -1
- package/dist/internal/utils/diffie-hellman/diffie-hellman-key-wrap.d.ts.map +1 -1
- package/dist/internal/utils/diffie-hellman/diffie-hellman-key-wrap.js +5 -1
- package/dist/internal/utils/diffie-hellman/diffie-hellman-key-wrap.js.map +1 -1
- package/dist/internal/utils/diffie-hellman/diffie-hellman.d.ts.map +1 -1
- package/dist/internal/utils/diffie-hellman/diffie-hellman.js +10 -2
- package/dist/internal/utils/diffie-hellman/diffie-hellman.js.map +1 -1
- package/dist/internal/utils/diffie-hellman/shared-secret.d.ts.map +1 -1
- package/dist/internal/utils/diffie-hellman/shared-secret.js +30 -6
- package/dist/internal/utils/diffie-hellman/shared-secret.js.map +1 -1
- package/dist/internal/utils/encoded-aes.d.ts.map +1 -1
- package/dist/internal/utils/encoded-aes.js +33 -18
- package/dist/internal/utils/encoded-aes.js.map +1 -1
- package/dist/internal/utils/encrypt-content.d.ts.map +1 -1
- package/dist/internal/utils/encrypt-content.js +14 -10
- package/dist/internal/utils/encrypt-content.js.map +1 -1
- package/dist/internal/utils/encryption.d.ts.map +1 -1
- package/dist/internal/utils/encryption.js +20 -12
- package/dist/internal/utils/encryption.js.map +1 -1
- package/dist/internal/utils/get-key/get-decryption-key.d.ts.map +1 -1
- package/dist/internal/utils/get-key/get-decryption-key.js +3 -0
- package/dist/internal/utils/get-key/get-decryption-key.js.map +1 -1
- package/dist/internal/utils/get-key/get-encryption-key.d.ts.map +1 -1
- package/dist/internal/utils/get-key/get-encryption-key.js +3 -0
- package/dist/internal/utils/get-key/get-encryption-key.js.map +1 -1
- package/dist/internal/utils/key-derivation/pbkdf.d.ts.map +1 -1
- package/dist/internal/utils/key-derivation/pbkdf.js +4 -1
- package/dist/internal/utils/key-derivation/pbkdf.js.map +1 -1
- package/dist/internal/utils/key-types/get-ec-keys.d.ts.map +1 -1
- package/dist/internal/utils/key-types/get-ec-keys.js +6 -0
- package/dist/internal/utils/key-types/get-ec-keys.js.map +1 -1
- package/dist/internal/utils/key-types/get-oct-keys.d.ts.map +1 -1
- package/dist/internal/utils/key-types/get-oct-keys.js +6 -0
- package/dist/internal/utils/key-types/get-oct-keys.js.map +1 -1
- package/dist/internal/utils/key-types/get-okp-keys.d.ts.map +1 -1
- package/dist/internal/utils/key-types/get-okp-keys.js +6 -0
- package/dist/internal/utils/key-types/get-okp-keys.js.map +1 -1
- package/dist/internal/utils/key-types/get-rsa-keys.d.ts.map +1 -1
- package/dist/internal/utils/key-types/get-rsa-keys.js +30 -6
- package/dist/internal/utils/key-types/get-rsa-keys.js.map +1 -1
- package/dist/internal/utils/key-wrap/ecb-key-wrap.d.ts.map +1 -1
- package/dist/internal/utils/key-wrap/ecb-key-wrap.js +10 -2
- package/dist/internal/utils/key-wrap/ecb-key-wrap.js.map +1 -1
- package/dist/internal/utils/key-wrap/gcm-key-wrap.d.ts.map +1 -1
- package/dist/internal/utils/key-wrap/gcm-key-wrap.js +20 -4
- package/dist/internal/utils/key-wrap/gcm-key-wrap.js.map +1 -1
- package/dist/internal/utils/key-wrap/key-wrap.d.ts.map +1 -1
- package/dist/internal/utils/key-wrap/key-wrap.js +10 -2
- package/dist/internal/utils/key-wrap/key-wrap.js.map +1 -1
- package/dist/internal/utils/oct/get-oct-dir-keys.d.ts.map +1 -1
- package/dist/internal/utils/oct/get-oct-dir-keys.js +20 -4
- package/dist/internal/utils/oct/get-oct-dir-keys.js.map +1 -1
- package/dist/internal/utils/oct/get-oct-key-key-wrap.d.ts.map +1 -1
- package/dist/internal/utils/oct/get-oct-key-key-wrap.js +17 -3
- package/dist/internal/utils/oct/get-oct-key-key-wrap.js.map +1 -1
- package/dist/internal/utils/oct/get-oct-pbkdf-key-wrap-keys.d.ts.map +1 -1
- package/dist/internal/utils/oct/get-oct-pbkdf-key-wrap-keys.js +17 -3
- package/dist/internal/utils/oct/get-oct-pbkdf-key-wrap-keys.js.map +1 -1
- package/dist/internal/utils/tokenised-aes.d.ts.map +1 -1
- package/dist/internal/utils/tokenised-aes.js +19 -4
- package/dist/internal/utils/tokenised-aes.js.map +1 -1
- package/dist/internal/utils/validate-version.d.ts.map +1 -1
- package/dist/internal/utils/validate-version.js +12 -3
- package/dist/internal/utils/validate-version.js.map +1 -1
- package/dist/mocks/create-mock-aes-kit.d.ts.map +1 -1
- package/dist/mocks/create-mock-aes-kit.js +6 -0
- package/dist/mocks/create-mock-aes-kit.js.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils/parse-aes.d.ts.map +1 -1
- package/dist/utils/parse-aes.js +5 -1
- package/dist/utils/parse-aes.js.map +1 -1
- package/package.json +7 -7
package/dist/classes/AesKit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IKryptos } from "@lindorm/kryptos";
|
|
2
|
-
import type { AesOperationOptions, IAesKit } from "../interfaces/index.js";
|
|
2
|
+
import type { AesContentDecryption, AesContentEncryption, AesContentOptions, AesOperationOptions, IAesKit } from "../interfaces/index.js";
|
|
3
3
|
import type { AesContent, AesContentType, AesDecryptionRecord, AesEncryptionRecord, AesKitOptions, ParsedAesDecryptionRecord, SerialisedAesDecryption, SerialisedAesEncryption } from "../types/index.js";
|
|
4
4
|
import type { PreparedEncryption } from "../internal/types/prepared-encryption.js";
|
|
5
5
|
export declare class AesKit implements IAesKit {
|
|
@@ -13,6 +13,8 @@ export declare class AesKit implements IAesKit {
|
|
|
13
13
|
decrypt<T extends AesContent = string>(data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): T;
|
|
14
14
|
verify(input: AesContent, data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): boolean;
|
|
15
15
|
assert(input: AesContent, data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): void;
|
|
16
|
+
encryptContent(content: Buffer, options?: AesContentOptions): AesContentEncryption;
|
|
17
|
+
decryptContent(input: AesContentDecryption): Buffer;
|
|
16
18
|
prepareEncryption(): PreparedEncryption;
|
|
17
19
|
static contentType(input: any): AesContentType;
|
|
18
20
|
static isAesTokenised(input: any): input is string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesKit.d.ts","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,kBAAkB,CAAC;AAEpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AesKit.d.ts","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":"AACA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AAO;IAQH,MAAM,CACX,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,EAC5D,OAAO,CAAC,EAAE,mBAAmB,GAC5B,IAAI;IAUA,cAAc,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,iBAAiB,GAC1B,oBAAoB;IAqBhB,cAAc,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM;IAsBnD,iBAAiB,IAAI,kBAAkB;WAiBhC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,cAAc;WAIvC,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM;WAI3C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB;WAC9C,KAAK,CAAC,IAAI,EAAE,uBAAuB,GAAG,yBAAyB;WAC/D,KAAK,CAAC,IAAI,EAAE,mBAAmB,GAAG,mBAAmB;WACrD,KAAK,CACjB,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,GAC3D,mBAAmB;CAMvB"}
|
package/dist/classes/AesKit.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isEqual } from "@lindorm/is";
|
|
|
2
2
|
import { AesError } from "../errors/index.js";
|
|
3
3
|
import { isAesTokenised, parseAes } from "../utils/index.js";
|
|
4
4
|
import { decryptAes, encryptAes } from "../internal/utils/encryption.js";
|
|
5
|
+
import { decryptContentDirect, encryptContentDirect, } from "../internal/utils/content-primitive.js";
|
|
5
6
|
import { prepareAesEncryption } from "../internal/utils/prepare-encryption.js";
|
|
6
7
|
import { calculateContentType } from "../internal/utils/content.js";
|
|
7
8
|
import { encryptEncoded } from "../internal/utils/encrypt-encoded.js";
|
|
@@ -42,13 +43,22 @@ export class AesKit {
|
|
|
42
43
|
kryptos: this.kryptos,
|
|
43
44
|
});
|
|
44
45
|
default:
|
|
45
|
-
throw new AesError("Invalid encryption mode"
|
|
46
|
+
throw new AesError("Invalid encryption mode", {
|
|
47
|
+
code: "invalid_encryption_mode",
|
|
48
|
+
title: "Invalid Encryption Mode",
|
|
49
|
+
details: "The requested AES encryption mode is not one of the supported output modes (encoded, serialised, or tokenised).",
|
|
50
|
+
});
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
catch (error) {
|
|
49
54
|
if (error instanceof AesError)
|
|
50
55
|
throw error;
|
|
51
|
-
throw new AesError("AES encryption failed", {
|
|
56
|
+
throw new AesError("AES encryption failed", {
|
|
57
|
+
code: "encryption_failed",
|
|
58
|
+
title: "Encryption Failed",
|
|
59
|
+
details: "The AES encryption operation failed unexpectedly; see the underlying error for the root cause.",
|
|
60
|
+
error: error,
|
|
61
|
+
});
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
decrypt(data, options) {
|
|
@@ -64,7 +74,12 @@ export class AesKit {
|
|
|
64
74
|
catch (error) {
|
|
65
75
|
if (error instanceof AesError)
|
|
66
76
|
throw error;
|
|
67
|
-
throw new AesError("AES decryption failed", {
|
|
77
|
+
throw new AesError("AES decryption failed", {
|
|
78
|
+
code: "decryption_failed",
|
|
79
|
+
title: "Decryption Failed",
|
|
80
|
+
details: "The AES decryption operation failed unexpectedly; see the underlying error for the root cause.",
|
|
81
|
+
error: error,
|
|
82
|
+
});
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
85
|
verify(input, data, options) {
|
|
@@ -78,7 +93,54 @@ export class AesKit {
|
|
|
78
93
|
assert(input, data, options) {
|
|
79
94
|
if (this.verify(input, data, options))
|
|
80
95
|
return;
|
|
81
|
-
throw new AesError("Invalid AES cipher"
|
|
96
|
+
throw new AesError("Invalid AES cipher", {
|
|
97
|
+
code: "invalid_cipher",
|
|
98
|
+
title: "Invalid AES Cipher",
|
|
99
|
+
details: "The decrypted AES content did not match the expected input value during assertion.",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
encryptContent(content, options) {
|
|
103
|
+
try {
|
|
104
|
+
return encryptContentDirect({
|
|
105
|
+
aad: options?.aad,
|
|
106
|
+
content,
|
|
107
|
+
encryption: this.encryption,
|
|
108
|
+
initialisationVector: options?.iv,
|
|
109
|
+
kryptos: this.kryptos,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof AesError)
|
|
114
|
+
throw error;
|
|
115
|
+
throw new AesError("AES content encryption failed", {
|
|
116
|
+
code: "encryption_failed",
|
|
117
|
+
title: "Encryption Failed",
|
|
118
|
+
details: "The AES content-encryption primitive failed unexpectedly; see the underlying error for the root cause.",
|
|
119
|
+
error: error,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
decryptContent(input) {
|
|
124
|
+
try {
|
|
125
|
+
return decryptContentDirect({
|
|
126
|
+
aad: input.aad,
|
|
127
|
+
ciphertext: input.ciphertext,
|
|
128
|
+
encryption: this.encryption,
|
|
129
|
+
initialisationVector: input.iv,
|
|
130
|
+
kryptos: this.kryptos,
|
|
131
|
+
tag: input.tag,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (error instanceof AesError)
|
|
136
|
+
throw error;
|
|
137
|
+
throw new AesError("AES content decryption failed", {
|
|
138
|
+
code: "decryption_failed",
|
|
139
|
+
title: "Decryption Failed",
|
|
140
|
+
details: "The AES content-decryption primitive failed unexpectedly; see the underlying error for the root cause.",
|
|
141
|
+
error: error,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
82
144
|
}
|
|
83
145
|
prepareEncryption() {
|
|
84
146
|
try {
|
|
@@ -87,7 +149,12 @@ export class AesKit {
|
|
|
87
149
|
catch (error) {
|
|
88
150
|
if (error instanceof AesError)
|
|
89
151
|
throw error;
|
|
90
|
-
throw new AesError("AES prepare encryption failed", {
|
|
152
|
+
throw new AesError("AES prepare encryption failed", {
|
|
153
|
+
code: "prepare_encryption_failed",
|
|
154
|
+
title: "Prepare Encryption Failed",
|
|
155
|
+
details: "Deriving the content encryption key and parameters ahead of AES encryption failed; see the underlying error for the root cause.",
|
|
156
|
+
error: error,
|
|
157
|
+
});
|
|
91
158
|
}
|
|
92
159
|
}
|
|
93
160
|
static contentType(input) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesKit.js","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AesKit.js","sourceRoot":"","sources":["../../src/classes/AesKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAoB9C,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,OAAO,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;IAsBM,OAAO,CACZ,IAAgB,E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AC;YAC3C,MAAM,IAAI,QAAQ,CAAC,+BAA+B,EAAE;gBAClD,IAAI,EAAE,2BAA2B;gBACjC,KAAK,EAAE,2BAA2B;gBAClC,OAAO,EACL,iIAAiI;gBACnI,KAAK,EAAE,KAAc;aACtB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAIM,MAAM,CAAC,WAAW,CAAC,KAAU;QAClC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,KAAU;QACrC,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAQM,MAAM,CAAC,KAAK,CACjB,IAA4D;QAE5D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesError.d.ts","sourceRoot":"","sources":["../../src/errors/AesError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,QAAS,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"AesError.d.ts","sourceRoot":"","sources":["../../src/errors/AesError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,QAAS,SAAQ,YAAY;IACxC,gBAAuB,SAAS,SAAS;CAC1C"}
|
package/dist/errors/AesError.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesError.js","sourceRoot":"","sources":["../../src/errors/AesError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,QAAS,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"AesError.js","sourceRoot":"","sources":["../../src/errors/AesError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,QAAS,SAAQ,YAAY;IACjC,MAAM,CAAU,SAAS,GAAG,KAAK,CAAC"}
|
|
@@ -4,6 +4,21 @@ import type { PreparedEncryption } from "../internal/types/prepared-encryption.j
|
|
|
4
4
|
export type AesOperationOptions = {
|
|
5
5
|
aad?: Buffer;
|
|
6
6
|
};
|
|
7
|
+
export type AesContentOptions = {
|
|
8
|
+
aad?: Buffer;
|
|
9
|
+
iv?: Buffer;
|
|
10
|
+
};
|
|
11
|
+
export type AesContentEncryption = {
|
|
12
|
+
ciphertext: Buffer;
|
|
13
|
+
iv: Buffer;
|
|
14
|
+
tag: Buffer;
|
|
15
|
+
};
|
|
16
|
+
export type AesContentDecryption = {
|
|
17
|
+
aad?: Buffer;
|
|
18
|
+
ciphertext: Buffer;
|
|
19
|
+
iv: Buffer;
|
|
20
|
+
tag: Buffer;
|
|
21
|
+
};
|
|
7
22
|
export interface IAesKit {
|
|
8
23
|
kryptos: IKryptos;
|
|
9
24
|
encrypt(content: AesContent, mode?: "encoded", options?: AesOperationOptions): string;
|
|
@@ -13,6 +28,8 @@ export interface IAesKit {
|
|
|
13
28
|
decrypt<T extends AesContent = string>(data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): T;
|
|
14
29
|
verify(input: AesContent, data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): boolean;
|
|
15
30
|
assert(input: AesContent, data: AesDecryptionRecord | SerialisedAesDecryption | string, options?: AesOperationOptions): void;
|
|
31
|
+
encryptContent(content: Buffer, options?: AesContentOptions): AesContentEncryption;
|
|
32
|
+
decryptContent(input: AesContentDecryption): Buffer;
|
|
16
33
|
prepareEncryption(): PreparedEncryption;
|
|
17
34
|
}
|
|
18
35
|
//# sourceMappingURL=AesKit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesKit.d.ts","sourceRoot":"","sources":["../../src/interfaces/AesKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QA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C5B,uBAAuB,CAAC;IAC3B,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAEvF,OAAO,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,EACnC,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,EAC5D,OAAO,CAAC,EAAE,mBAAmB,GAC5B,CAAC,CAAC;IACL,MAAM,CACJ,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,EAC5D,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;IACX,MAAM,CACJ,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,MAAM,EAC5D,OAAO,CAAC,EAAE,mBAAmB,GAC5B,IAAI,CAAC;IAER,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;IACnF,cAAc,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC;IAEpD,iBAAiB,IAAI,kBAAkB,CAAC;CACzC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { KryptosEncryption } from "@lindorm/kryptos";
|
|
2
|
+
import type { ShaAlgorithm } from "@lindorm/types";
|
|
3
|
+
import type { AesInternalEncryption } from "../../types/index.js";
|
|
4
|
+
export type AesMode = "gcm" | "ccm" | "cbc-hmac";
|
|
5
|
+
export type AesEncDescriptor = {
|
|
6
|
+
encryption: KryptosEncryption;
|
|
7
|
+
nodeCipher: AesInternalEncryption;
|
|
8
|
+
cipherKeyBytes: 16 | 24 | 32;
|
|
9
|
+
cekBytes: 16 | 24 | 32 | 48 | 64;
|
|
10
|
+
ivBytes: number;
|
|
11
|
+
tagBytes: number;
|
|
12
|
+
mode: AesMode;
|
|
13
|
+
aead: boolean;
|
|
14
|
+
shaAlgorithm?: ShaAlgorithm;
|
|
15
|
+
};
|
|
16
|
+
export declare const getAesDescriptor: (encryption: KryptosEncryption) => AesEncDescriptor;
|
|
17
|
+
//# sourceMappingURL=aes-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes-descriptor.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/aes-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAUlE,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,CAAC;AAOjD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAE9B,UAAU,EAAE,qBAAqB,CAAC;IAElC,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAE7B,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAEjC,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IAEd,IAAI,EAAE,OAAO,CAAC;IAEd,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAuGF,eAAO,MAAM,gBAAgB,GAAI,YAAY,iBAAiB,KAAG,gBAchE,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CCM_ENCRYPTION_ALGORITHMS } from "@lindorm/types";
|
|
2
|
+
import { AesError } from "../../errors/index.js";
|
|
3
|
+
const GCM = {
|
|
4
|
+
A128GCM: {
|
|
5
|
+
encryption: "A128GCM",
|
|
6
|
+
nodeCipher: "aes-128-gcm",
|
|
7
|
+
cipherKeyBytes: 16,
|
|
8
|
+
cekBytes: 16,
|
|
9
|
+
ivBytes: 12,
|
|
10
|
+
tagBytes: 16,
|
|
11
|
+
mode: "gcm",
|
|
12
|
+
aead: true,
|
|
13
|
+
},
|
|
14
|
+
A192GCM: {
|
|
15
|
+
encryption: "A192GCM",
|
|
16
|
+
nodeCipher: "aes-192-gcm",
|
|
17
|
+
cipherKeyBytes: 24,
|
|
18
|
+
cekBytes: 24,
|
|
19
|
+
ivBytes: 12,
|
|
20
|
+
tagBytes: 16,
|
|
21
|
+
mode: "gcm",
|
|
22
|
+
aead: true,
|
|
23
|
+
},
|
|
24
|
+
A256GCM: {
|
|
25
|
+
encryption: "A256GCM",
|
|
26
|
+
nodeCipher: "aes-256-gcm",
|
|
27
|
+
cipherKeyBytes: 32,
|
|
28
|
+
cekBytes: 32,
|
|
29
|
+
ivBytes: 12,
|
|
30
|
+
tagBytes: 16,
|
|
31
|
+
mode: "gcm",
|
|
32
|
+
aead: true,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const CBC = {
|
|
36
|
+
"A128CBC-HS256": {
|
|
37
|
+
encryption: "A128CBC-HS256",
|
|
38
|
+
nodeCipher: "aes-128-cbc",
|
|
39
|
+
cipherKeyBytes: 16,
|
|
40
|
+
cekBytes: 32,
|
|
41
|
+
ivBytes: 16,
|
|
42
|
+
tagBytes: 16,
|
|
43
|
+
mode: "cbc-hmac",
|
|
44
|
+
aead: false,
|
|
45
|
+
shaAlgorithm: "SHA256",
|
|
46
|
+
},
|
|
47
|
+
"A192CBC-HS384": {
|
|
48
|
+
encryption: "A192CBC-HS384",
|
|
49
|
+
nodeCipher: "aes-192-cbc",
|
|
50
|
+
cipherKeyBytes: 24,
|
|
51
|
+
cekBytes: 48,
|
|
52
|
+
ivBytes: 16,
|
|
53
|
+
tagBytes: 24,
|
|
54
|
+
mode: "cbc-hmac",
|
|
55
|
+
aead: false,
|
|
56
|
+
shaAlgorithm: "SHA384",
|
|
57
|
+
},
|
|
58
|
+
"A256CBC-HS512": {
|
|
59
|
+
encryption: "A256CBC-HS512",
|
|
60
|
+
nodeCipher: "aes-256-cbc",
|
|
61
|
+
cipherKeyBytes: 32,
|
|
62
|
+
cekBytes: 64,
|
|
63
|
+
ivBytes: 16,
|
|
64
|
+
tagBytes: 32,
|
|
65
|
+
mode: "cbc-hmac",
|
|
66
|
+
aead: false,
|
|
67
|
+
shaAlgorithm: "SHA512",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const CCM = Object.fromEntries(CCM_ENCRYPTION_ALGORITHMS.map((encryption) => {
|
|
71
|
+
const [, , l, tagBits, keyBits] = encryption.split("-");
|
|
72
|
+
const keyBytes = (Number(keyBits) / 8);
|
|
73
|
+
return [
|
|
74
|
+
encryption,
|
|
75
|
+
{
|
|
76
|
+
encryption,
|
|
77
|
+
nodeCipher: `aes-${keyBits}-ccm`,
|
|
78
|
+
cipherKeyBytes: keyBytes,
|
|
79
|
+
cekBytes: keyBytes,
|
|
80
|
+
ivBytes: l === "16" ? 13 : 7,
|
|
81
|
+
tagBytes: Number(tagBits) / 8,
|
|
82
|
+
mode: "ccm",
|
|
83
|
+
aead: true,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
}));
|
|
87
|
+
const DESCRIPTORS = { ...GCM, ...CBC, ...CCM };
|
|
88
|
+
export const getAesDescriptor = (encryption) => {
|
|
89
|
+
const descriptor = DESCRIPTORS[encryption];
|
|
90
|
+
if (!descriptor) {
|
|
91
|
+
throw new AesError("Unsupported encryption algorithm", {
|
|
92
|
+
code: "unsupported_encryption",
|
|
93
|
+
title: "Unsupported Encryption",
|
|
94
|
+
details: "The encryption algorithm is not a supported AES content encryption (GCM, CBC-HMAC, or CCM).",
|
|
95
|
+
data: { encryption },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return descriptor;
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=aes-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAYF,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,SAgBrD,CAAC;AAEL,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,KAAG,MAGnD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,KAAG,SA4BnD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,KAAG,MAAyC,CAAC;AAEzF,eAAO,MAAM,wBAAwB,GACnC,QAAQ,SAAS,KAChB;IACD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,cAAc,CAAC;IAC5B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,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,OAAO,EAAE,MAAM,CAAC;CAYhB,CAAC"}
|
|
@@ -37,6 +37,9 @@ export const decodeAesHeader = (headerB64) => {
|
|
|
37
37
|
const parsed = JSON.parse(json);
|
|
38
38
|
if (!parsed.alg || !parsed.enc || !parsed.v) {
|
|
39
39
|
throw new AesError("Invalid AES header: missing required fields", {
|
|
40
|
+
code: "invalid_header",
|
|
41
|
+
title: "Invalid Header",
|
|
42
|
+
details: "The decoded AES header is missing one or more required fields (alg, enc, or v).",
|
|
40
43
|
debug: { parsed },
|
|
41
44
|
});
|
|
42
45
|
}
|
|
@@ -47,6 +50,9 @@ export const decodeAesHeader = (headerB64) => {
|
|
|
47
50
|
if (error instanceof AesError)
|
|
48
51
|
throw error;
|
|
49
52
|
throw new AesError("Failed to decode AES header", {
|
|
53
|
+
code: "header_decode_failed",
|
|
54
|
+
title: "Header Decode Failed",
|
|
55
|
+
details: "The AES header could not be base64url-decoded and parsed as JSON; see the underlying error for the root cause.",
|
|
50
56
|
error: error,
|
|
51
57
|
});
|
|
52
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aes-header.js","sourceRoot":"","sources":["../../../src/internal/utils/aes-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA2B3D,MAAM,QAAQ,GAAG,CAAoC,GAAM,EAAK,EAAE;IAChE,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAuB,EAAa,EAAE,CACnE,QAAQ,CAAC;IACP,GAAG,EAAE,OAAO,CAAC,SAAS;IACtB,GAAG,EAAE,OAAO,CAAC,WAAW;IACxB,GAAG,EAAE,OAAO,CAAC,UAAU;IACvB,GAAG,EAAE,OAAO,CAAC,mBAAmB;IAChC,EAAE,EAAE,OAAO,CAAC,kBAAkB;QAC5B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC;QAChD,CAAC,CAAC,SAAS;IACb,GAAG,EAAE,OA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,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,MAAiB,EAYjB,EAAE,CAAC,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;IACpE,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;IAC3E,mBAAmB,EAAE,MAAM,CAAC,GAAG;IAC/B,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;IAC9E,OAAO,EAAE,MAAM,CAAC,CAAC;CAClB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-aes-encryption.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"calculate-aes-encryption.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQrE,eAAO,MAAM,sBAAsB,GACjC,YAAY,iBAAiB,KAC5B,qBAAgE,CAAC"}
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const calculateAesEncryption = (encryption) =>
|
|
3
|
-
if (!encryption) {
|
|
4
|
-
throw new AesError("Encryption algorithm is required");
|
|
5
|
-
}
|
|
6
|
-
switch (encryption) {
|
|
7
|
-
case "A128CBC-HS256":
|
|
8
|
-
return "aes-128-cbc";
|
|
9
|
-
case "A192CBC-HS384":
|
|
10
|
-
return "aes-192-cbc";
|
|
11
|
-
case "A256CBC-HS512":
|
|
12
|
-
return "aes-256-cbc";
|
|
13
|
-
case "A128GCM":
|
|
14
|
-
return "aes-128-gcm";
|
|
15
|
-
case "A192GCM":
|
|
16
|
-
return "aes-192-gcm";
|
|
17
|
-
case "A256GCM":
|
|
18
|
-
return "aes-256-gcm";
|
|
19
|
-
default:
|
|
20
|
-
throw new AesError("Unsupported encryption algorithm");
|
|
21
|
-
}
|
|
22
|
-
};
|
|
1
|
+
import { getAesDescriptor } from "../aes-descriptor.js";
|
|
2
|
+
export const calculateAesEncryption = (encryption) => getAesDescriptor(encryption).nodeCipher;
|
|
23
3
|
//# sourceMappingURL=calculate-aes-encryption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAA6B,EACN,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AASnD,eAAO,MAAM,iCAAiC,GAC5C,YAAY,iBAAiB,KAC5B,YAAqD,CAAC"}
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const calculateContentEncryptionKeySize = (encryption) =>
|
|
3
|
-
if (!encryption) {
|
|
4
|
-
throw new AesError("Encryption algorithm is required");
|
|
5
|
-
}
|
|
6
|
-
switch (encryption) {
|
|
7
|
-
case "A128GCM":
|
|
8
|
-
return 16;
|
|
9
|
-
case "A192GCM":
|
|
10
|
-
return 24;
|
|
11
|
-
case "A256GCM":
|
|
12
|
-
return 32;
|
|
13
|
-
case "A128CBC-HS256":
|
|
14
|
-
return 32;
|
|
15
|
-
case "A192CBC-HS384":
|
|
16
|
-
return 48;
|
|
17
|
-
case "A256CBC-HS512":
|
|
18
|
-
return 64;
|
|
19
|
-
default:
|
|
20
|
-
throw new AesError("Unsupported encryption", { debug: { encryption } });
|
|
21
|
-
}
|
|
22
|
-
};
|
|
1
|
+
import { getAesDescriptor } from "../aes-descriptor.js";
|
|
2
|
+
export const calculateContentEncryptionKeySize = (encryption) => getAesDescriptor(encryption).cekBytes;
|
|
23
3
|
//# sourceMappingURL=calculate-content-encryption-key-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQxD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,UAA6B,EACf,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,0BAA0B,GAAI,SAAS,QAAQ,KAAG,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,0BAA0B,GAAI,SAAS,QAAQ,KAAG,iBAqC9D,CAAC"}
|
|
@@ -23,7 +23,11 @@ export const calculateKeyWrapEncryption = (kryptos) => {
|
|
|
23
23
|
case "ECDH-ES+A256GCMKW":
|
|
24
24
|
return "aes-256-gcm";
|
|
25
25
|
default:
|
|
26
|
-
throw new AesError("Unsupported keywrap encryption"
|
|
26
|
+
throw new AesError("Unsupported keywrap encryption", {
|
|
27
|
+
code: "unsupported_key_wrap_encryption",
|
|
28
|
+
title: "Unsupported Key Wrap Encryption",
|
|
29
|
+
details: "The Kryptos algorithm does not map to a supported AES cipher for encrypting the wrapped content encryption key.",
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
33
|
//# sourceMappingURL=calculate-key-wrap-encryption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-encryption.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,OAAiB,EAAqB,EAAE;IACjF,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,QAAQ,CAAC,gCAAgC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-encryption.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,OAAiB,EAAqB,EAAE;IACjF,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,QAAQ,CAAC,gCAAgC,EAAE;gBACnD,IAAI,EAAE,iCAAiC;gBACvC,KAAK,EAAE,iCAAiC;gBACxC,OAAO,EACL,iHAAiH;aACpH,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,oBAAoB,GAAI,WAAW,gBAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,oBAAoB,GAAI,WAAW,gBAAgB,KAAG,YAgClE,CAAC"}
|
|
@@ -20,7 +20,12 @@ export const calculateKeyWrapSize = (algorithm) => {
|
|
|
20
20
|
case "PBES2-HS512+A256KW":
|
|
21
21
|
return 32;
|
|
22
22
|
default:
|
|
23
|
-
throw new AesError("Unsupported algorithm", {
|
|
23
|
+
throw new AesError("Unsupported algorithm", {
|
|
24
|
+
code: "unsupported_key_wrap_algorithm",
|
|
25
|
+
title: "Unsupported Key Wrap Algorithm",
|
|
26
|
+
details: "The algorithm is not a recognised AES key wrapping algorithm, so its wrapped key size cannot be determined.",
|
|
27
|
+
data: { algorithm },
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
31
|
//# sourceMappingURL=calculate-key-wrap-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-size.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,QAAQ,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-size.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,QAAQ,CAAC,uBAAuB,EAAE;gBAC1C,IAAI,EAAE,gCAAgC;gBACtC,KAAK,EAAE,gCAAgC;gBACvC,OAAO,EACL,6GAA6G;gBAC/G,IAAI,EAAE,EAAE,SAAS,EAAE;aACpB,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,uBAAuB,GAAI,SAAS,QAAQ,KAAG,
|
|
1
|
+
{"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,uBAAuB,GAAI,SAAS,QAAQ,KAAG,YAoB3D,CAAC"}
|
|
@@ -8,7 +8,12 @@ export const calculatePbkdfAlgorithm = (kryptos) => {
|
|
|
8
8
|
case "PBES2-HS512+A256KW":
|
|
9
9
|
return "SHA512";
|
|
10
10
|
default:
|
|
11
|
-
throw new AesError("Unsupported PBKDF2 algorithm"
|
|
11
|
+
throw new AesError("Unsupported PBKDF2 algorithm", {
|
|
12
|
+
code: "unsupported_pbkdf2_algorithm",
|
|
13
|
+
title: "Unsupported PBKDF2 Algorithm",
|
|
14
|
+
details: "The Kryptos algorithm is not a supported PBES2 PBKDF2 algorithm (PBES2-HS256+A128KW, PBES2-HS384+A192KW, or PBES2-HS512+A256KW).",
|
|
15
|
+
data: { algorithm: kryptos.algorithm },
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
19
|
//# sourceMappingURL=calculate-pbkdf-hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-pbkdf-hash.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAiB,EAAgB,EAAE;IACzE,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,QAAQ,CAAC,8BAA8B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"calculate-pbkdf-hash.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAiB,EAAgB,EAAE;IACzE,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,QAAQ,CAAC,8BAA8B,EAAE;gBACjD,IAAI,EAAE,8BAA8B;gBACpC,KAAK,EAAE,8BAA8B;gBACrC,OAAO,EACL,kIAAkI;gBACpI,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;aACvC,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-rsa-oaep-hash.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,oBAAoB,GAAI,WAAW,gBAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"calculate-rsa-oaep-hash.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,oBAAoB,GAAI,WAAW,gBAAgB,KAAG,YAuBlE,CAAC"}
|
|
@@ -11,7 +11,10 @@ export const calculateRsaOaepHash = (algorithm) => {
|
|
|
11
11
|
return "SHA512";
|
|
12
12
|
default:
|
|
13
13
|
throw new AesError("Unexpected encryption key algorithm", {
|
|
14
|
-
|
|
14
|
+
code: "unexpected_key_algorithm",
|
|
15
|
+
title: "Unexpected Key Algorithm",
|
|
16
|
+
details: "The key algorithm is not a supported RSA-OAEP variant (RSA-OAEP, RSA-OAEP-256, RSA-OAEP-384, or RSA-OAEP-512).",
|
|
17
|
+
data: { algorithm },
|
|
15
18
|
});
|
|
16
19
|
}
|
|
17
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-rsa-oaep-hash.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,QAAQ,CAAC,qCAAqC,EAAE;gBACxD,KAAK,EAAE,EAAE,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"calculate-rsa-oaep-hash.js","sourceRoot":"","sources":["../../../../src/internal/utils/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,QAAQ,CAAC,qCAAqC,EAAE;gBACxD,IAAI,EAAE,0BAA0B;gBAChC,KAAK,EAAE,0BAA0B;gBACjC,OAAO,EACL,gHAAgH;gBAClH,IAAI,EAAE,EAAE,SAAS,EAAE;aACpB,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IKryptos, KryptosEncryption } from "@lindorm/kryptos";
|
|
2
|
+
export type ContentPrimitiveResult = {
|
|
3
|
+
ciphertext: Buffer;
|
|
4
|
+
iv: Buffer;
|
|
5
|
+
tag: Buffer;
|
|
6
|
+
};
|
|
7
|
+
export type EncryptContentDirectOptions = {
|
|
8
|
+
aad?: Buffer;
|
|
9
|
+
content: Buffer;
|
|
10
|
+
encryption: KryptosEncryption;
|
|
11
|
+
initialisationVector?: Buffer;
|
|
12
|
+
kryptos: IKryptos;
|
|
13
|
+
};
|
|
14
|
+
export type DecryptContentDirectOptions = {
|
|
15
|
+
aad?: Buffer;
|
|
16
|
+
ciphertext: Buffer;
|
|
17
|
+
encryption: KryptosEncryption;
|
|
18
|
+
initialisationVector: Buffer;
|
|
19
|
+
kryptos: IKryptos;
|
|
20
|
+
tag: Buffer;
|
|
21
|
+
};
|
|
22
|
+
export declare const encryptContentDirect: (options: EncryptContentDirectOptions) => ContentPrimitiveResult;
|
|
23
|
+
export declare const decryptContentDirect: (options: DecryptContentDirectOptions) => Buffer;
|
|
24
|
+
//# sourceMappingURL=content-primitive.d.ts.map
|