-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathIndex.dfy
54 lines (40 loc) · 1.77 KB
/
Index.dfy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
include "AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations.dfy"
module
{:extern "software.amazon.cryptography.dbencryptionsdk.structuredencryption.internaldafny" }
StructuredEncryption refines AbstractAwsCryptographyDbEncryptionSdkStructuredEncryptionService
{
import Operations = AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations
import Primitives = AtomicPrimitives
import MaterialProviders
function method DefaultStructuredEncryptionConfig(): StructuredEncryptionConfig
{
StructuredEncryptionConfig
}
method StructuredEncryption(config: StructuredEncryptionConfig)
returns (res: Result<StructuredEncryptionClient, Error>)
ensures res.Success? ==> res.value is StructuredEncryptionClient
{
var maybePrimitives := Primitives.AtomicPrimitives();
var primitives :- maybePrimitives.MapFailure(e => AwsCryptographyPrimitives(e));
var maybeMatProv := MaterialProviders.MaterialProviders();
var matProv :- maybeMatProv.MapFailure(e => AwsCryptographyMaterialProviders(e));
var client := new StructuredEncryptionClient(Operations.Config(primitives := primitives, materialProviders := matProv));
return Success(client);
}
class StructuredEncryptionClient... {
predicate ValidState()
{
&& Operations.ValidInternalConfig?(config)
&& History !in Operations.ModifiesInternalConfig(config)
&& Modifies == Operations.ModifiesInternalConfig(config) + {History}
}
constructor(config: Operations.InternalConfig)
{
this.config := config;
History := new IStructuredEncryptionClientCallHistory();
Modifies := Operations.ModifiesInternalConfig(config) + {History};
}
}
}