@@ -37,6 +37,16 @@ def encrypt_dynamodb_item(item, crypto_config):
37
37
# type: (dynamodb_types.ITEM, CryptoConfig) -> dynamodb_types.ITEM
38
38
"""Encrypt a DynamoDB item.
39
39
40
+ >>> from dynamodb_encryption_sdk.encrypted.item import encrypt_dynamodb_item
41
+ >>> plaintext_item = {
42
+ ... 'some': {'S': 'data'},
43
+ ... 'more': {'N': '5'}
44
+ ... }
45
+ >>> encrypted_item = encrypt_dynamodb_item(
46
+ ... item=plaintext_item,
47
+ ... crypto_config=my_crypto_config
48
+ ... )
49
+
40
50
.. note::
41
51
42
52
This handles DynamoDB-formatted items and is for use with the boto3 DynamoDB client.
@@ -112,6 +122,16 @@ def encrypt_python_item(item, crypto_config):
112
122
# type: (dynamodb_types.ITEM, CryptoConfig) -> dynamodb_types.ITEM
113
123
"""Encrypt a dictionary for DynamoDB.
114
124
125
+ >>> from dynamodb_encryption_sdk.encrypted.item import encrypt_python_item
126
+ >>> plaintext_item = {
127
+ ... 'some': 'data',
128
+ ... 'more': 5
129
+ ... }
130
+ >>> encrypted_item = encrypt_python_item(
131
+ ... item=plaintext_item,
132
+ ... crypto_config=my_crypto_config
133
+ ... )
134
+
115
135
.. note::
116
136
117
137
This handles human-friendly dictionaries and is for use with the boto3 DynamoDB service or table resource.
@@ -130,6 +150,16 @@ def decrypt_dynamodb_item(item, crypto_config):
130
150
# type: (dynamodb_types.ITEM, CryptoConfig) -> dynamodb_types.ITEM
131
151
"""Decrypt a DynamoDB item.
132
152
153
+ >>> from dynamodb_encryption_sdk.encrypted.item import decrypt_python_item
154
+ >>> encrypted_item = {
155
+ ... 'some': {'B': b'ENCRYPTED_DATA'},
156
+ ... 'more': {'B': b'ENCRYPTED_DATA'}
157
+ ... }
158
+ >>> decrypted_item = decrypt_python_item(
159
+ ... item=encrypted_item,
160
+ ... crypto_config=my_crypto_config
161
+ ... )
162
+
133
163
.. note::
134
164
135
165
This handles DynamoDB-formatted items and is for use with the boto3 DynamoDB client.
@@ -204,6 +234,16 @@ def decrypt_python_item(item, crypto_config):
204
234
# type: (dynamodb_types.ITEM, CryptoConfig) -> dynamodb_types.ITEM
205
235
"""Decrypt a dictionary for DynamoDB.
206
236
237
+ >>> from dynamodb_encryption_sdk.encrypted.item import decrypt_python_item
238
+ >>> encrypted_item = {
239
+ ... 'some': Binary(b'ENCRYPTED_DATA'),
240
+ ... 'more': Binary(b'ENCRYPTED_DATA')
241
+ ... }
242
+ >>> decrypted_item = decrypt_python_item(
243
+ ... item=encrypted_item,
244
+ ... crypto_config=my_crypto_config
245
+ ... )
246
+
207
247
.. note::
208
248
209
249
This handles human-friendly dictionaries and is for use with the boto3 DynamoDB service or table resource.
0 commit comments