55Based on the CipherStash SDK and ZeroKMS key service, CipherStash for DynamoDB provides a simple interface for
66storing and retrieving encrypted data in DynamoDB.
77
8+ ## Playground
9+
10+ To easily try out CipherStash for DynamoDB, visit the [ cipherstash-playground] ( https://github.com/cipherstash/cipherstash-playground ) repo.
11+
812## Code status
913
1014[ ![ Test suite] ( https://github.com/cipherstash/cipherstash-dynamodb/actions/workflows/test.yml/badge.svg )] ( https://github.com/cipherstash/cipherstash-dynamodb/actions/workflows/test.yml ) [ ![ Published documentation] ( https://github.com/cipherstash/cipherstash-dynamodb/actions/workflows/deploy-public-docs.yml/badge.svg )] ( https://github.com/cipherstash/cipherstash-dynamodb/actions/workflows/deploy-public-docs.yml )
@@ -83,9 +87,9 @@ To use CipherStash for DynamoDB, you must first annotate a struct with the `Encr
8387` Decryptable ` derive macros.
8488
8589``` rust
86- use cipherstash_dynamodb :: {Searchable , Decryptable , Encryptable };
90+ use cipherstash_dynamodb :: {Searchable , Decryptable , Encryptable , Identifiable };
8791
88- #[derive(Debug , Searchable , Decryptable , Encryptable )]
92+ #[derive(Debug , Searchable , Decryptable , Encryptable , Identifiable )]
8993struct User {
9094 name : String ,
9195 #[partition_key]
@@ -108,9 +112,9 @@ By default, all fields on an annotated struct are stored encrypted in the table.
108112To store a field as a plaintext, you can use the ` plaintext ` attribute:
109113
110114``` rust
111- use cipherstash_dynamodb :: {Searchable , Decryptable , Encryptable };
115+ use cipherstash_dynamodb :: {Searchable , Decryptable , Encryptable , Identifiable };
112116
113- #[derive(Debug , Searchable , Decryptable , Encryptable )]
117+ #[derive(Debug , Searchable , Decryptable , Encryptable , Identifiable )]
114118struct User {
115119 #[partition_key]
116120 email : String ,
@@ -124,9 +128,9 @@ struct User {
124128If you don't want a field stored in the the database at all, you can annotate the field with ` #[cipherstash(skip)] ` .
125129
126130``` rust
127- use cipherstash_dynamodb :: {Searchable , Encryptable , Decryptable };
131+ use cipherstash_dynamodb :: {Searchable , Encryptable , Decryptable , Identifiable };
128132
129- #[derive(Debug , Searchable , Encryptable , Decryptable )]
133+ #[derive(Debug , Searchable , Encryptable , Decryptable , Identifiable )]
130134struct User {
131135 #[partition_key]
132136 email : String ,
@@ -145,9 +149,9 @@ cipherstash-dynamodb requires every record to have a sort key. By default this w
145149However, if you want to specify your own, you can use the ` sort_key_prefix ` attribute:
146150
147151``` rust
148- use cipherstash_dynamodb :: Encryptable ;
152+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
149153
150- #[derive(Debug , Encryptable )]
154+ #[derive(Debug , Encryptable , Identifiable )]
151155#[cipherstash(sort_key_prefix = " user" )]
152156struct User {
153157 #[partition_key]
@@ -165,9 +169,9 @@ CipherStash for DynamoDB also supports specifying the sort key dynamically based
165169You can choose the field using the ` #[sort_key] ` attribute.
166170
167171``` rust
168- use cipherstash_dynamodb :: Encryptable ;
172+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
169173
170- #[derive(Debug , Encryptable )]
174+ #[derive(Debug , Encryptable , Identifiable )]
171175struct User {
172176 #[partition_key]
173177 email : String ,
@@ -188,9 +192,9 @@ and sort keys. To support this behaviour these are treated as special keywords i
188192If your field contains a ` pk ` or an ` sk ` field they must be annotated with the ` #[partition_key] ` and ` #[sort_key] ` attributes respectively.
189193
190194``` rust
191- use cipherstash_dynamodb :: Encryptable ;
195+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
192196
193- #[derive(Debug , Encryptable )]
197+ #[derive(Debug , Encryptable , Identifiable )]
194198struct User {
195199 #[partition_key]
196200 pk : String ,
@@ -209,9 +213,9 @@ Exact, prefix and compound match types are currently supported.
209213To index a field, use the ` query ` attribute:
210214
211215``` rust
212- use cipherstash_dynamodb :: Encryptable ;
216+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
213217
214- #[derive(Debug , Encryptable )]
218+ #[derive(Debug , Encryptable , Identifiable )]
215219struct User {
216220 #[cipherstash(query = " exact" )]
217221 #[partition_key]
@@ -230,9 +234,9 @@ Fields mentioned in the compound index name that aren't correctly annotated will
230234compilation error.
231235
232236``` rust
233- use cipherstash_dynamodb :: Encryptable ;
237+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
234238
235- #[derive(Debug , Encryptable )]
239+ #[derive(Debug , Encryptable , Identifiable )]
236240struct User {
237241 #[cipherstash(query = " exact" , compound = " email#name" )]
238242 #[partition_key]
@@ -248,9 +252,9 @@ different ways.
248252
249253
250254``` rust
251- use cipherstash_dynamodb :: Encryptable ;
255+ use cipherstash_dynamodb :: { Encryptable , Identifiable } ;
252256
253- #[derive(Debug , Encryptable )]
257+ #[derive(Debug , Encryptable , Identifiable )]
254258struct User {
255259 #[cipherstash(query = " exact" )]
256260 #[cipherstash(query = " exact" , compound = " email#name" )]
@@ -361,9 +365,9 @@ In practice, this means you can store multiple types in the same table.
361365For example, you might want to store related records to ` User ` such as ` License ` .
362366
363367``` rust
364- use cipherstash_dynamodb :: { Searchable , Encryptable , Decryptable };
368+ use cipherstash_dynamodb :: { Searchable , Encryptable , Decryptable , Identifiable };
365369
366- #[derive(Debug , Searchable , Encryptable , Decryptable )]
370+ #[derive(Debug , Searchable , Encryptable , Decryptable , Identifiable )]
367371struct License {
368372 #[cipherstash(query = " exact" )]
369373 #[partition_key]
@@ -384,7 +388,7 @@ For example, you might want to query users by name using a prefix (say for using
384388
385389``` rust
386390
387- #[derive(Debug , Searchable , Encryptable , Decryptable )]
391+ #[derive(Debug , Searchable , Encryptable , Decryptable , Identifiable )]
388392pub struct UserView {
389393 #[cipherstash(skip)]
390394 #[partition_key]
@@ -443,7 +447,7 @@ When self-hosting ZeroKMS, we recommend running it in different account to your
443447
444448## Issues and TODO
445449
446- - [ ] Sort keys are not currently hashed (and should be )
450+ - [ ] Sort keys are not currently hashed (but this may change in the future )
447451
448452<!-- cargo-rdme end -->
449453
0 commit comments