1
1
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
include ".. / src/ Index. dfy"
4
+ include ".. / .. / DynamoDbEncryption/ test/ BeaconTestFixtures. dfy"
4
5
5
6
module TestFixtures {
6
7
import opened Wrappers
@@ -9,6 +10,7 @@ module TestFixtures {
9
10
import opened AwsCryptographyDbEncryptionSdkDynamoDbTransformsTypes
10
11
import opened AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptorTypes
11
12
import opened AwsCryptographyDbEncryptionSdkDynamoDbTypes
13
+ import opened BeaconTestFixtures
12
14
import DynamoDbEncryptionTransforms
13
15
import DynamoDbItemEncryptor
14
16
import AwsCryptographyMaterialProvidersTypes
@@ -216,7 +218,7 @@ module TestFixtures {
216
218
ensures fresh (encryption. Modifies)
217
219
{
218
220
var keyring := GetKmsKeyring ();
219
- var encryption2 : IDynamoDbEncryptionTransformsClient :- expect DynamoDbEncryptionTransforms. DynamoDbEncryptionTransforms (
221
+ encryption :- expect DynamoDbEncryptionTransforms. DynamoDbEncryptionTransforms (
220
222
DynamoDbTablesEncryptionConfig(
221
223
tableEncryptionConfigs := map[
222
224
"foo" := DynamoDbTableEncryptionConfig(
@@ -241,8 +243,60 @@ module TestFixtures {
241
243
]
242
244
)
243
245
);
244
- assert encryption2 is DynamoDbEncryptionTransforms. DynamoDbEncryptionTransformsClient;
245
- encryption := encryption2 as DynamoDbEncryptionTransforms. DynamoDbEncryptionTransformsClient;
246
246
assume {:axiom} fresh (encryption. Modifies);
247
247
}
248
+
249
+ // type AttributeActions = map<ComAmazonawsDynamodbTypes.AttributeName, AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.CryptoAction>
250
+
251
+ function method GetMultiActions () : AttributeActions
252
+ {
253
+ map [
254
+ "bar" := SE. SIGN_ONLY,
255
+ "std2" := SE. ENCRYPT_AND_SIGN,
256
+ "std4" := SE. ENCRYPT_AND_SIGN,
257
+ "std6" := SE. ENCRYPT_AND_SIGN,
258
+ "Name" := SE. ENCRYPT_AND_SIGN,
259
+ "Title" := SE. ENCRYPT_AND_SIGN,
260
+ "TooBad" := SE. ENCRYPT_AND_SIGN,
261
+ "Year" := SE. SIGN_ONLY,
262
+ "Date" := SE. SIGN_ONLY,
263
+ "TheKeyField" := SE. SIGN_ONLY
264
+ ]
265
+ }
266
+
267
+ method GetDynamoDbEncryptionTransformsMutli (plaintextOverride : Option <AwsCryptographyDbEncryptionSdkDynamoDbTypes .PlaintextOverride>)
268
+ returns (encryption: DynamoDbEncryptionTransforms. DynamoDbEncryptionTransformsClient)
269
+ ensures encryption. ValidState ()
270
+ ensures fresh (encryption)
271
+ ensures fresh (encryption. Modifies)
272
+ {
273
+ var keyring := GetKmsKeyring ();
274
+ var beacons := GetLotsaBeaconsMulti ();
275
+ var search := SearchConfig (
276
+ versions := [beacons],
277
+ writeVersion := 1
278
+ );
279
+ encryption :- expect DynamoDbEncryptionTransforms. DynamoDbEncryptionTransforms (
280
+ DynamoDbTablesEncryptionConfig(
281
+ tableEncryptionConfigs := map[
282
+ "foo" := DynamoDbTableEncryptionConfig(
283
+ logicalTableName := "foo",
284
+ partitionKeyName := "bar",
285
+ sortKeyName := None(),
286
+ attributeActionsOnEncrypt := GetMultiActions (),
287
+ allowedUnsignedAttributes := Some (["plain"]),
288
+ allowedUnsignedAttributePrefix := None (),
289
+ algorithmSuiteId := None (),
290
+ keyring := Some (keyring),
291
+ cmm := None (),
292
+ search := Some (search),
293
+ legacyOverride := None,
294
+ plaintextOverride := plaintextOverride
295
+ )
296
+ ]
297
+ )
298
+ );
299
+ assume {:axiom} fresh (encryption. Modifies);
300
+ }
301
+
248
302
}
0 commit comments