@@ -91,8 +91,10 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald
91
91
class IDynamoDbEncryptionClientCallHistory {
92
92
ghost constructor () {
93
93
CreateDynamoDbEncryptionBranchKeyIdSupplier := [];
94
+ GetEncryptedDataKeyDescription := [];
94
95
}
95
96
ghost var CreateDynamoDbEncryptionBranchKeyIdSupplier: seq < DafnyCallEvent< CreateDynamoDbEncryptionBranchKeyIdSupplierInput, Result< CreateDynamoDbEncryptionBranchKeyIdSupplierOutput, Error>>>
97
+ ghost var GetEncryptedDataKeyDescription: seq < DafnyCallEvent< GetEncryptedDataKeyDescriptionInput, Result< GetEncryptedDataKeyDescriptionOutput, Error>>>
96
98
}
97
99
trait {:termination false } IDynamoDbEncryptionClient
98
100
{
@@ -145,6 +147,21 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald
145
147
ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly (input, output)
146
148
ensures History. CreateDynamoDbEncryptionBranchKeyIdSupplier == old (History. CreateDynamoDbEncryptionBranchKeyIdSupplier) + [DafnyCallEvent (input, output)]
147
149
150
+ predicate GetEncryptedDataKeyDescriptionEnsuresPublicly (input: GetEncryptedDataKeyDescriptionInput , output: Result <GetEncryptedDataKeyDescriptionOutput , Error>)
151
+ // The public method to be called by library consumers
152
+ method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput )
153
+ returns (output: Result< GetEncryptedDataKeyDescriptionOutput, Error> )
154
+ requires
155
+ && ValidState ()
156
+ modifies Modifies - {History} ,
157
+ History`GetEncryptedDataKeyDescription
158
+ // Dafny will skip type parameters when generating a default decreases clause.
159
+ decreases Modifies - {History}
160
+ ensures
161
+ && ValidState ()
162
+ ensures GetEncryptedDataKeyDescriptionEnsuresPublicly (input, output)
163
+ ensures History. GetEncryptedDataKeyDescription == old (History. GetEncryptedDataKeyDescription) + [DafnyCallEvent (input, output)]
164
+
148
165
}
149
166
datatype DynamoDbEncryptionConfig = | DynamoDbEncryptionConfig (
150
167
@@ -232,6 +249,13 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald
232
249
datatype DynamoDbTablesEncryptionConfig = | DynamoDbTablesEncryptionConfig (
233
250
nameonly tableEncryptionConfigs: DynamoDbTableEncryptionConfigList
234
251
)
252
+ datatype EncryptedDataKeyDescription = | EncryptedDataKeyDescription (
253
+ nameonly keyProviderId: string ,
254
+ nameonly keyProviderInfo: Option <string > := Option.None ,
255
+ nameonly branchKeyId: Option <string > := Option.None ,
256
+ nameonly branchKeyVersion: Option <string > := Option.None
257
+ )
258
+ type EncryptedDataKeyDescriptionList = seq < EncryptedDataKeyDescription>
235
259
datatype EncryptedPart = | EncryptedPart (
236
260
nameonly name: string ,
237
261
nameonly prefix: Prefix
@@ -246,6 +270,15 @@ module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.internald
246
270
datatype GetBranchKeyIdFromDdbKeyOutput = | GetBranchKeyIdFromDdbKeyOutput (
247
271
nameonly branchKeyId: string
248
272
)
273
+ datatype GetEncryptedDataKeyDescriptionInput = | GetEncryptedDataKeyDescriptionInput (
274
+ nameonly input: GetEncryptedDataKeyDescriptionUnion
275
+ )
276
+ datatype GetEncryptedDataKeyDescriptionOutput = | GetEncryptedDataKeyDescriptionOutput (
277
+ nameonly EncryptedDataKeyDescriptionOutput: EncryptedDataKeyDescriptionList
278
+ )
279
+ datatype GetEncryptedDataKeyDescriptionUnion =
280
+ | header (header: seq <uint8 >)
281
+ | item (item: ComAmazonawsDynamodbTypes .AttributeMap)
249
282
datatype GetPrefix = | GetPrefix (
250
283
nameonly length: int32
251
284
)
@@ -510,6 +543,26 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbService
510
543
History. CreateDynamoDbEncryptionBranchKeyIdSupplier := History. CreateDynamoDbEncryptionBranchKeyIdSupplier + [DafnyCallEvent (input, output)];
511
544
}
512
545
546
+ predicate GetEncryptedDataKeyDescriptionEnsuresPublicly (input: GetEncryptedDataKeyDescriptionInput , output: Result <GetEncryptedDataKeyDescriptionOutput , Error>)
547
+ {Operations. GetEncryptedDataKeyDescriptionEnsuresPublicly (input, output)}
548
+ // The public method to be called by library consumers
549
+ method GetEncryptedDataKeyDescription ( input: GetEncryptedDataKeyDescriptionInput )
550
+ returns (output: Result< GetEncryptedDataKeyDescriptionOutput, Error> )
551
+ requires
552
+ && ValidState ()
553
+ modifies Modifies - {History} ,
554
+ History`GetEncryptedDataKeyDescription
555
+ // Dafny will skip type parameters when generating a default decreases clause.
556
+ decreases Modifies - {History}
557
+ ensures
558
+ && ValidState ()
559
+ ensures GetEncryptedDataKeyDescriptionEnsuresPublicly (input, output)
560
+ ensures History. GetEncryptedDataKeyDescription == old (History. GetEncryptedDataKeyDescription) + [DafnyCallEvent (input, output)]
561
+ {
562
+ output := Operations. GetEncryptedDataKeyDescription (config, input);
563
+ History. GetEncryptedDataKeyDescription := History. GetEncryptedDataKeyDescription + [DafnyCallEvent (input, output)];
564
+ }
565
+
513
566
}
514
567
}
515
568
abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations {
@@ -541,4 +594,20 @@ abstract module AbstractAwsCryptographyDbEncryptionSdkDynamoDbOperations {
541
594
&& fresh (output. value. branchKeyIdSupplier)
542
595
&& fresh ( output. value. branchKeyIdSupplier. Modifies - ModifiesInternalConfig (config) - input. ddbKeyBranchKeyIdSupplier. Modifies ) )
543
596
ensures CreateDynamoDbEncryptionBranchKeyIdSupplierEnsuresPublicly (input, output)
597
+
598
+
599
+ predicate GetEncryptedDataKeyDescriptionEnsuresPublicly (input: GetEncryptedDataKeyDescriptionInput , output: Result <GetEncryptedDataKeyDescriptionOutput , Error>)
600
+ // The private method to be refined by the library developer
601
+
602
+
603
+ method GetEncryptedDataKeyDescription ( config: InternalConfig , input: GetEncryptedDataKeyDescriptionInput )
604
+ returns (output: Result< GetEncryptedDataKeyDescriptionOutput, Error> )
605
+ requires
606
+ && ValidInternalConfig?(config)
607
+ modifies ModifiesInternalConfig (config)
608
+ // Dafny will skip type parameters when generating a default decreases clause.
609
+ decreases ModifiesInternalConfig (config)
610
+ ensures
611
+ && ValidInternalConfig?(config)
612
+ ensures GetEncryptedDataKeyDescriptionEnsuresPublicly (input, output)
544
613
}
0 commit comments