@@ -6,6 +6,7 @@ package clientsupplier
66import (
77 "context"
88 "fmt"
9+ "reflect"
910
1011 mpl "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygenerated"
1112 mpltypes "github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes"
@@ -169,11 +170,9 @@ func ClientSupplierExample(ddbTableName, keyArn string, accountIds, regions []st
169170 getResponse , err := ddbClient .GetItem (context .Background (), getRequest )
170171 utils .HandleError (err )
171172
172- // Demonstrate that GetItem succeeded and returned the decrypted item
173- returnedItem := getResponse .Item
174- sensitiveData := returnedItem ["sensitive_data" ].(* types.AttributeValueMemberS ).Value
175- if sensitiveData != "encrypt and sign me!" {
176- panic ("Decrypted data does not match expected value" )
173+ // Verify the decrypted item
174+ if ! reflect .DeepEqual (item , getResponse .Item ) {
175+ panic ("Decrypted item does not match original item" )
177176 }
178177
179178 // 9. Create a MRK discovery multi-keyring with a custom client supplier.
@@ -242,11 +241,9 @@ func ClientSupplierExample(ddbTableName, keyArn string, accountIds, regions []st
242241 onlyReplicaKeyGetResponse , err := onlyReplicaKeyDdbClient .GetItem (context .Background (), onlyReplicaKeyGetRequest )
243242 utils .HandleError (err )
244243
245- // Demonstrate that GetItem succeeded and returned the decrypted item
246- onlyReplicaKeyReturnedItem := onlyReplicaKeyGetResponse .Item
247- onlyReplicaKeySensitiveData := onlyReplicaKeyReturnedItem ["sensitive_data" ].(* types.AttributeValueMemberS ).Value
248- if onlyReplicaKeySensitiveData != "encrypt and sign me!" {
249- panic ("Decrypted data from discovery keyring does not match expected value" )
244+ // Verify the decrypted item
245+ if ! reflect .DeepEqual (item , onlyReplicaKeyGetResponse .Item ) {
246+ panic ("Decrypted item does not match original item" )
250247 }
251248
252249 fmt .Println ("Client Supplier Example completed successfully" )
0 commit comments