Skip to content

Commit

Permalink
chore(rust): clean-up lib.rs (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikKapila authored Dec 19, 2024
1 parent 3117b0c commit d03ab27
Show file tree
Hide file tree
Showing 32 changed files with 191 additions and 123 deletions.
2 changes: 1 addition & 1 deletion AwsEncryptionSDK/runtimes/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For more details about the design and architecture of the AWS Encryption SDK, se

## Examples for AWS Encryption SDK in Rust

Please look at the Examples on how to use the Encryption SDK in Rust [here](https://github.com/aws/aws-encryption-sdk-dafny/tree/mainline/AwsEncryptionSDK/runtimes/rust/examples).
Please look at the Examples on how to use the Encryption SDK in Rust [here](https://github.com/aws/aws-encryption-sdk-dafny/tree/mainline/releases/rust/esdk/examples).

Please note that some examples MAY require internet access and valid AWS credentials, since calls to KMS are made.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
use super::regional_role_client_supplier::RegionalRoleClientSupplier;
use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::types::error::Error::AwsCryptographicMaterialProvidersException;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
use aws_esdk::material_providers::types::error::Error::AwsCryptographicMaterialProvidersException;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::DiscoveryFilter;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_keyring(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0

use aws_config::Region;
use aws_esdk::aws_cryptography_materialProviders::types::ClientSupplier;
use aws_esdk::aws_cryptography_materialProviders::operation::get_client::GetClientInput;
use aws_esdk::aws_cryptography_materialProviders::types::error::Error;
use aws_esdk::material_providers::types::ClientSupplier;
use aws_esdk::material_providers::operation::get_client::GetClientInput;
use aws_esdk::material_providers::types::error::Error;
use aws_esdk::com_amazonaws_kms::client::Client as kms_client;
use super::regional_role_client_supplier_config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ On decrypt, the client MUST supply the key/value pair(s) that were not stored to

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError;
use std::collections::HashMap;
use std::vec::Vec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use super::signing_suite_only_cmm::SigningSuiteOnlyCMM;
use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef;
use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef;
use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_cmm(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use aws_esdk::aws_cryptography_materialProviders::operation::get_encryption_materials::GetEncryptionMaterialsInput;
use aws_esdk::aws_cryptography_materialProviders::operation::get_encryption_materials::GetEncryptionMaterialsOutput;
use aws_esdk::aws_cryptography_materialProviders::operation::decrypt_materials::DecryptMaterialsInput;
use aws_esdk::aws_cryptography_materialProviders::operation::decrypt_materials::DecryptMaterialsOutput;
use aws_esdk::aws_cryptography_materialProviders::types::error::Error;
use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManager;
use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef;
use aws_esdk::aws_cryptography_materialProviders::types::keyring::KeyringRef;
use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId;
use aws_esdk::aws_cryptography_materialProviders::types::AlgorithmSuiteId;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::operation::get_encryption_materials::GetEncryptionMaterialsInput;
use aws_esdk::material_providers::operation::get_encryption_materials::GetEncryptionMaterialsOutput;
use aws_esdk::material_providers::operation::decrypt_materials::DecryptMaterialsInput;
use aws_esdk::material_providers::operation::decrypt_materials::DecryptMaterialsOutput;
use aws_esdk::material_providers::types::error::Error;
use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManager;
use aws_esdk::material_providers::types::cryptographic_materials_manager::CryptographicMaterialsManagerRef;
use aws_esdk::material_providers::types::keyring::KeyringRef;
use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId;
use aws_esdk::material_providers::types::AlgorithmSuiteId;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::vec::Vec;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::DiscoveryFilter;
use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError;
use std::collections::HashMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::DiscoveryFilter;
use std::collections::HashMap;
use std::vec::Vec;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ use super::example_branch_key_id_supplier::ExampleBranchKeyIdSupplier;
use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::types::error::Error::AwsCryptographicMaterialProvidersError;
use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration;
use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig;
use aws_esdk::aws_cryptography_keyStore::client as keystore_client;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::key_store::types::KmsConfiguration;
use aws_esdk::key_store::types::key_store_config::KeyStoreConfig;
use aws_esdk::key_store::client as keystore_client;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_keyring(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use aws_esdk::aws_cryptography_keyStore::client as keystore_client;
use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig;
use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration;
use aws_esdk::key_store::client as keystore_client;
use aws_esdk::key_store::types::key_store_config::KeyStoreConfig;
use aws_esdk::key_store::types::KmsConfiguration;

/*
The Hierarchical Keyring Example relies on the existence
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use aws_esdk::aws_cryptography_materialProviders::operation::get_branch_key_id::GetBranchKeyIdInput;
use aws_esdk::aws_cryptography_materialProviders::operation::get_branch_key_id::GetBranchKeyIdOutput;
use aws_esdk::aws_cryptography_materialProviders::types::error::Error;
use aws_esdk::aws_cryptography_materialProviders::types::branch_key_id_supplier::BranchKeyIdSupplier;
use aws_esdk::material_providers::operation::get_branch_key_id::GetBranchKeyIdInput;
use aws_esdk::material_providers::operation::get_branch_key_id::GetBranchKeyIdOutput;
use aws_esdk::material_providers::types::error::Error;
use aws_esdk::material_providers::types::branch_key_id_supplier::BranchKeyIdSupplier;
use std::collections::HashMap;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
use super::create_branch_key_id::create_branch_key_id;
use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::types::CacheType;
use aws_esdk::aws_cryptography_materialProviders::types::DefaultCache;
use aws_esdk::aws_cryptography_materialProviders::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef;
use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration;
use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig;
use aws_esdk::aws_cryptography_keyStore::client as keystore_client;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::CacheType;
use aws_esdk::material_providers::types::DefaultCache;
use aws_esdk::material_providers::types::cryptographic_materials_cache::CryptographicMaterialsCacheRef;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::key_store::types::KmsConfiguration;
use aws_esdk::key_store::types::key_store_config::KeyStoreConfig;
use aws_esdk::key_store::client as keystore_client;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_keyring(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

use aws_esdk::aws_cryptography_keyStore::client as keystore_client;
use aws_esdk::aws_cryptography_keyStore::types::key_store_config::KeyStoreConfig;
use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration;
use aws_esdk::key_store::client as keystore_client;
use aws_esdk::key_store::types::key_store_config::KeyStoreConfig;
use aws_esdk::key_store::types::KmsConfiguration;

/*
This example demonstrates configuring a KeyStore and then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_keyring(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::DiscoveryFilter;
use std::collections::HashMap;
use aws_config::Region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::DiscoveryFilter;
use std::collections::HashMap;
use aws_config::Region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;
use aws_config::Region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;
use aws_config::Region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;
use aws_config::Region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::EsdkAlgorithmSuiteId;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::EsdkAlgorithmSuiteId;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use std::collections::HashMap;

pub async fn encrypt_and_decrypt_with_keyring(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-raw-ecdh-k

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::RawEcdhStaticConfigurations;
use aws_esdk::aws_cryptography_materialProviders::types::EphemeralPrivateKeyToStaticPublicKeyInput;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::RawEcdhStaticConfigurations;
use aws_esdk::material_providers::types::EphemeralPrivateKeyToStaticPublicKeyInput;
use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec;
use std::collections::HashMap;
use std::path::Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-ecdh-k

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::KmsEcdhStaticConfigurations;
use aws_esdk::aws_cryptography_materialProviders::types::KmsPrivateKeyToStaticPublicKeyInput;
use aws_esdk::aws_cryptography_materialProviders::types::KmsPublicKeyDiscoveryInput;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::KmsEcdhStaticConfigurations;
use aws_esdk::material_providers::types::KmsPrivateKeyToStaticPublicKeyInput;
use aws_esdk::material_providers::types::KmsPublicKeyDiscoveryInput;
use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec;
use aws_smithy_types::Blob;
use std::collections::HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/use-kms-ecdh-k

use aws_esdk::client as esdk_client;
use aws_esdk::types::aws_encryption_sdk_config::AwsEncryptionSdkConfig;
use aws_esdk::aws_cryptography_materialProviders::client as mpl_client;
use aws_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::aws_cryptography_materialProviders::types::KmsEcdhStaticConfigurations;
use aws_esdk::aws_cryptography_materialProviders::types::KmsPrivateKeyToStaticPublicKeyInput;
use aws_esdk::material_providers::client as mpl_client;
use aws_esdk::material_providers::types::material_providers_config::MaterialProvidersConfig;
use aws_esdk::material_providers::types::KmsEcdhStaticConfigurations;
use aws_esdk::material_providers::types::KmsPrivateKeyToStaticPublicKeyInput;
use aws_esdk::aws_cryptography_primitives::types::EcdhCurveSpec;
use std::collections::HashMap;
use std::path::Path;
Expand Down
Loading

0 comments on commit d03ab27

Please sign in to comment.