Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(examples): Shared cache across Hierarchical Keyrings #1410

Merged
merged 13 commits into from
Jan 15, 2025
2 changes: 1 addition & 1 deletion .github/workflows/library_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id-token: write
contents: read
env:
RUST_MIN_STACK: 104857600
RUST_MIN_STACK: 404857600
steps:
- name: Support longpaths on Git checkout
run: |
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public class TestUtils {
public static final String TEST_LOGICAL_KEYSTORE_NAME = "KeyStoreDdbTable";
public static final String TEST_KEYSTORE_KMS_KEY_ID =
"arn:aws:kms:us-west-2:370957321024:key/9d989aa2-2f9c-438c-a745-cc57d3ad0126";
public static final String TEST_PARTITION_ID =
"91c1b6a2-6fc3-4539-ad5e-938d597ed730";

public static final String TEST_AWS_ACCOUNT_ID = "658956600833";
public static final String TEST_AWS_REGION = "us-west-2";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package software.amazon.cryptography.examples.keyring;

import org.testng.annotations.Test;
import software.amazon.cryptography.examples.CreateKeyStoreKeyExample;
import software.amazon.cryptography.examples.TestUtils;

public class TestSharedCacheAcrossHierarchicalKeyringsExample {

@Test
public void TestSharedCacheAcrossHierarchicalKeyringsExample()
throws InterruptedException {
// Create new branch key for test
String keyId = CreateKeyStoreKeyExample.KeyStoreCreateKey(
TestUtils.TEST_KEYSTORE_NAME,
TestUtils.TEST_LOGICAL_KEYSTORE_NAME,
TestUtils.TEST_KEYSTORE_KMS_KEY_ID
);

// Key creation is eventually consistent, so wait 5 seconds to decrease the likelihood
// our test fails due to eventual consistency issues.
Thread.sleep(5000);

SharedCacheAcrossHierarchicalKeyringsExample.SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(
TestUtils.TEST_DDB_TABLE_NAME,
keyId,
TestUtils.TEST_KEYSTORE_NAME,
TestUtils.TEST_LOGICAL_KEYSTORE_NAME,
TestUtils.TEST_PARTITION_ID,
TestUtils.TEST_KEYSTORE_KMS_KEY_ID
);
}
}
1 change: 1 addition & 0 deletions Examples/runtimes/net/src/Examples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static async Task Main()
Thread.Sleep(5000);

await HierarchicalKeyringExample.HierarchicalKeyringGetItemPutItem(keyId, keyId2);
await SharedCacheAcrossHierarchicalKeyringsExample.SharedCacheAcrossHierarchicalKeyringsGetItemPutItem(keyId);

await BasicSearchableEncryptionExample.PutItemQueryItemWithBeacon(keyId);
await CompoundBeaconSearchableEncryptionExample.PutItemQueryItemWithCompoundBeacon(keyId);
Expand Down
2 changes: 2 additions & 0 deletions Examples/runtimes/net/src/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class TestUtils
public static readonly string TEST_KEYSTORE_NAME = "KeyStoreDdbTable";
public static readonly string TEST_LOGICAL_KEYSTORE_NAME = "KeyStoreDdbTable";

public static readonly string TEST_PARTITION_ID = "91c1b6a2-6fc3-4539-ad5e-938d597ed730";

public static readonly string TEST_KEYSTORE_KMS_KEY_ID =
"arn:aws:kms:us-west-2:370957321024:key/9d989aa2-2f9c-438c-a745-cc57d3ad0126";

Expand Down

Large diffs are not rendered by default.

Loading