Skip to content

Commit 40624ba

Browse files
author
Lucas McDonald
committed
m
1 parent 00a840b commit 40624ba

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

TestVectors/dafny/DDBEncryption/src/Index.dfy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
include "LibraryIndex.dfy"
55
include "TestVectors.dfy"
66
include "WriteSetPermutations.dfy"
7+
include "../../WrappedDynamoDbItemEncryptor/src/Index.dfy"
78

89
module WrappedDDBEncryptionMain {
910
import opened Wrappers
@@ -16,6 +17,7 @@ module WrappedDDBEncryptionMain {
1617
import opened JSONHelpers
1718
import KeyVectors
1819
import KeyVectorsTypes = AwsCryptographyMaterialProvidersTestVectorKeysTypes
20+
import WrappedItemEncryptor
1921

2022

2123
const DEFAULT_KEYS : string := "../../../submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders/dafny/TestVectorsAwsCryptographicMaterialProviders/test/keys.json"

TestVectors/dafny/WrappedDynamoDbItemEncryptor/src/Index.dfy

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,15 @@
33
// Empty stub expected by Smithy-Dafny
44

55
include "../../../../DynamoDbEncryption/dafny/DynamoDbItemEncryptor/src/Index.dfy"
6-
module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.wrapped" } WrappedItemEncryptor refines WrappedAbstractAwsCryptographyDbEncryptionSdkDynamoDbItemEncryptorService {}
6+
include "../Model/AwsCryptographyDbEncryptionSdkDynamoDbItemEncryptorTypesWrapped.dfy"
7+
module {:extern "software.amazon.cryptography.dbencryptionsdk.dynamodb.itemencryptor.internaldafny.wrapped" } WrappedItemEncryptor refines WrappedAbstractAwsCryptographyDbEncryptionSdkDynamoDbItemEncryptorService {
8+
9+
import ComAmazonawsDynamodbTypes
10+
11+
import DynamoDbItemEncryptor
12+
13+
function method WrappedDefaultDynamoDbItemEncryptorConfig(): DynamoDbItemEncryptorConfig
14+
{
15+
DynamoDbItemEncryptor.DefaultDynamoDbItemEncryptorConfig()
16+
}
17+
}

TestVectors/runtimes/rust/src/create_wrapped_item_encryptor.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,7 @@ impl _CreateWrappedItemEncryptor_Compile::_default {
1818
pub fn CreateWrappedItemEncryptor(
1919
config: &Rc<crate::implementation_from_dafny::software::amazon::cryptography::dbencryptionsdk::dynamodb::itemencryptor::internaldafny::types::DynamoDbItemEncryptorConfig>
2020
) -> Rc<_Wrappers_Compile::Result<Object<dyn IDynamoDbItemEncryptorClient>, Rc<Error>>> {
21-
let native_config = crate::deps::aws_cryptography_dbEncryptionSdk_dynamoDb_itemEncryptor::conversions::dynamo_db_item_encryptor_config::_dynamo_db_item_encryptor_config::plain_from_dafny(config);
22-
23-
let item_encryptor = match item_encryptor_client::Client::from_conf(native_config) {
24-
Ok(client) => client,
25-
Err(e) => return Rc::new(crate::r#_Wrappers_Compile::Result::Failure {
26-
error: error::to_dafny(e),
27-
}),
28-
};
29-
30-
let wrapped_encryptor = wrapped_item_encryptor_client::Client {wrapped: item_encryptor};
31-
let dafny_encryptor = ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrapped_encryptor));
32-
33-
Rc::new(crate::r#_Wrappers_Compile::Result::Success {
34-
value: dafny_encryptor,
35-
})
21+
// from_conf converts Dafny config to native, constructs a native client, and wraps it in a Dafny client
22+
return wrapped_item_encryptor_client::Client::from_conf(config);
3623
}
3724
}

TestVectors/runtimes/rust/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ pub mod operation;
1414
pub mod types;
1515
pub mod validation;
1616
pub mod intercept;
17-
18-
// removed wrapped-client feature using sed;
19-
// removed wrapped module using sed;
17+
pub mod wrapped;
2018

2119
mod standard_library_conversions;
2220
mod standard_library_externs;
2321

2422
pub use client::Client;
2523

24+
pub use crate::deps::aws_cryptography_dbEncryptionSdk_dynamoDb_itemEncryptor;
2625
pub use crate::deps::aws_cryptography_dbEncryptionSdk_structuredEncryption;
2726
pub use crate::deps::aws_cryptography_keyStore;
2827
pub use crate::deps::aws_cryptography_materialProviders;

0 commit comments

Comments
 (0)