@@ -26,8 +26,8 @@ import {
26
26
} from '@aws-crypto/material-management'
27
27
28
28
const nodeSuite = new NodeAlgorithmSuite ( AlgorithmSuiteIdentifier . ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256 )
29
- const encryptionMaterial = new NodeEncryptionMaterial ( nodeSuite )
30
- const decryptionMaterial = new NodeDecryptionMaterial ( nodeSuite )
29
+ const encryptionMaterial = new NodeEncryptionMaterial ( nodeSuite , { } )
30
+ const decryptionMaterial = new NodeDecryptionMaterial ( nodeSuite , { } )
31
31
32
32
describe ( 'getLocalCryptographicMaterialsCache' , ( ) => {
33
33
const {
@@ -41,8 +41,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
41
41
it ( 'putEncryptionResponse' , ( ) => {
42
42
const key = 'some encryption key'
43
43
const response : any = {
44
- material : encryptionMaterial ,
45
- context : { }
44
+ material : encryptionMaterial
46
45
}
47
46
48
47
putEncryptionResponse ( key , response , 1 )
@@ -56,8 +55,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
56
55
57
56
it ( 'Precondition: putEncryptionResponse plaintextLength can not be negative.' , ( ) => {
58
57
const response : any = {
59
- material : encryptionMaterial ,
60
- context : { }
58
+ material : encryptionMaterial
61
59
}
62
60
const u : any = undefined
63
61
const s : any = 'not-number'
@@ -70,8 +68,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
70
68
it ( 'Postcondition: Only return EncryptionMaterial.' , ( ) => {
71
69
const key = 'some decryption key'
72
70
const response : any = {
73
- material : decryptionMaterial ,
74
- context : { }
71
+ material : decryptionMaterial
75
72
}
76
73
77
74
putDecryptionResponse ( key , response )
@@ -82,8 +79,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
82
79
const key = 'some encryption key'
83
80
const suite = new NodeAlgorithmSuite ( AlgorithmSuiteIdentifier . ALG_AES128_GCM_IV12_TAG16 )
84
81
const response : any = {
85
- material : new NodeEncryptionMaterial ( suite ) ,
86
- context : { }
82
+ material : new NodeEncryptionMaterial ( suite , { } )
87
83
}
88
84
89
85
expect ( ( ) => putEncryptionResponse ( key , response , 1 ) ) . to . throw ( )
@@ -92,8 +88,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
92
88
it ( 'putDecryptionResponse' , ( ) => {
93
89
const key = 'some decryption key'
94
90
const response : any = {
95
- material : decryptionMaterial ,
96
- context : { }
91
+ material : decryptionMaterial
97
92
}
98
93
99
94
putDecryptionResponse ( key , response )
@@ -108,8 +103,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
108
103
it ( 'Precondition: Only cache DecryptionMaterial.' , ( ) => {
109
104
const key = 'some decryption key'
110
105
const response : any = {
111
- material : 'not material' ,
112
- context : { }
106
+ material : 'not material'
113
107
}
114
108
115
109
expect ( ( ) => putDecryptionResponse ( key , response ) ) . to . throw ( )
@@ -119,8 +113,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
119
113
const key = 'some decryption key'
120
114
const suite = new NodeAlgorithmSuite ( AlgorithmSuiteIdentifier . ALG_AES128_GCM_IV12_TAG16 )
121
115
const response : any = {
122
- material : new NodeEncryptionMaterial ( suite ) ,
123
- context : { }
116
+ material : new NodeEncryptionMaterial ( suite , { } )
124
117
}
125
118
126
119
expect ( ( ) => putDecryptionResponse ( key , response ) ) . to . throw ( )
@@ -143,8 +136,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
143
136
it ( 'Precondition: Only cache EncryptionMaterial.' , ( ) => {
144
137
const key = 'some encryption key'
145
138
const response : any = {
146
- material : 'not material' ,
147
- context : { }
139
+ material : 'not material'
148
140
}
149
141
150
142
expect ( ( ) => putEncryptionResponse ( key , response , 1 ) ) . to . throw ( )
@@ -158,8 +150,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
158
150
it ( 'Postcondition: Only return DecryptionMaterial.' , ( ) => {
159
151
const key = 'some encryption key'
160
152
const response : any = {
161
- material : encryptionMaterial ,
162
- context : { }
153
+ material : encryptionMaterial
163
154
}
164
155
165
156
putEncryptionResponse ( key , response , 1 )
@@ -173,8 +164,7 @@ describe('getLocalCryptographicMaterialsCache', () => {
173
164
it ( 'zero is an acceptable plaintextLength' , ( ) => {
174
165
const key = 'some encryption key'
175
166
const response : any = {
176
- material : encryptionMaterial ,
177
- context : { }
167
+ material : encryptionMaterial
178
168
}
179
169
180
170
putEncryptionResponse ( key , response , 0 )
@@ -197,8 +187,7 @@ describe('cache eviction', () => {
197
187
const key1 = 'key lost'
198
188
const key2 = 'key replace'
199
189
const response : any = {
200
- material : decryptionMaterial ,
201
- context : { }
190
+ material : decryptionMaterial
202
191
}
203
192
204
193
putDecryptionResponse ( key1 , response )
@@ -218,8 +207,7 @@ describe('cache eviction', () => {
218
207
219
208
const key = 'key deleted'
220
209
const response : any = {
221
- material : decryptionMaterial ,
222
- context : { }
210
+ material : decryptionMaterial
223
211
}
224
212
225
213
putDecryptionResponse ( key , response )
@@ -236,8 +224,7 @@ describe('cache eviction', () => {
236
224
237
225
const key = 'key lost'
238
226
const response : any = {
239
- material : decryptionMaterial ,
240
- context : { }
227
+ material : decryptionMaterial
241
228
}
242
229
243
230
putDecryptionResponse ( key , response , 1 )
@@ -255,8 +242,7 @@ describe('cache eviction', () => {
255
242
const key1 = 'key lost'
256
243
const key2 = 'key replace'
257
244
const response : any = {
258
- material : encryptionMaterial ,
259
- context : { }
245
+ material : encryptionMaterial
260
246
}
261
247
262
248
putEncryptionResponse ( key1 , response , 0 )
@@ -276,8 +262,7 @@ describe('cache eviction', () => {
276
262
277
263
const key = 'key lost'
278
264
const response : any = {
279
- material : encryptionMaterial ,
280
- context : { }
265
+ material : encryptionMaterial
281
266
}
282
267
283
268
putEncryptionResponse ( key , response , 1 , 1 )
@@ -294,8 +279,7 @@ describe('cache eviction', () => {
294
279
295
280
const key = 'key lost'
296
281
const response : any = {
297
- material : encryptionMaterial ,
298
- context : { }
282
+ material : encryptionMaterial
299
283
}
300
284
301
285
putEncryptionResponse ( key , response , 1 , 1 )
0 commit comments