You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-27Lines changed: 22 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
1
# cryptonamo
2
2
3
-
###Cryptonamo: Encrypted Tables for DynamoDB
3
+
## Cryptonamo: Encrypted Tables for DynamoDB
4
4
5
5
Based on the CipherStash SDK and ZeroKMS key service, Cryptonamo provides a simple interface for
6
6
storing and retrieving encrypted data in DynamoDB.
7
7
8
8
---
9
9
10
-
###Prerequisites
10
+
## Prerequisites
11
11
12
-
####Install Stash CLI
12
+
### Install Stash CLI
13
13
14
14
The `stash` CLI tool is required for creating an account and security credentials so that Cryptonamo can interact with the ZeroKMS key server.
15
15
16
16
See [here](https://docs.cipherstash.com/reference/cli.html#install-the-cipherstash-cli) for instructions on how to download and install the `stash` CLI tool.
17
17
18
-
####Sign up to create an account
18
+
### Sign up to create an account
19
19
20
20
Run `stash signup` and follow the on screen instructions.
21
21
22
-
####Login and create a Dataset
22
+
### Login and create a Dataset
23
23
24
24
*The pages linked to below contain information that is generally applicable even though it is framed within the context of a Rails application*
25
25
@@ -35,7 +35,7 @@ Run `stash signup` and follow the on screen instructions.
35
35
36
36
3.[Create a Client](https://docs.cipherstash.com/tutorials/rails-getting-started/define.html#3-create-a-client)
37
37
38
-
####Upload a dataset config
38
+
### Upload a dataset config
39
39
40
40
Cryptonamo fully manages the encrypted record and index settings.
41
41
@@ -53,12 +53,7 @@ Upload it to ZeroKMS using the following command:
53
53
54
54
<!-- cargo-rdme start -->
55
55
56
-
###### Cryptonamo: Encrypted Tables for DynamoDB
57
-
58
-
Based on the CipherStash SDK and ZeroKMS key service, Cryptonamo provides a simple interface for
59
-
storing and retrieving encrypted data in DynamoDB.
60
-
61
-
###### Usage
56
+
## Usage
62
57
63
58
To use Cryptonamo, you must first create a table in DynamoDB.
64
59
The table must have a at least partition key, sort key, and term field - all of type String.
@@ -85,7 +80,7 @@ aws dynamodb create-table \
85
80
86
81
See below for more information on schema design for Cryptonamo tables.
87
82
88
-
####### Annotating a Cryptanomo Type
83
+
### Annotating a Cryptanomo Type
89
84
90
85
To use Cryptonamo, you must first annotate a struct with the `Encryptable` derive macro, as
91
86
well as the `Searchable` and `Decryptable` macros if you want to support those features.
@@ -109,7 +104,7 @@ These derive macros will generate implementations for the following traits of th
109
104
110
105
The above example is the minimum required to use Cryptonamo however you can expand capabilities via several macros.
111
106
112
-
####### Controlling Encryption
107
+
### Controlling Encryption
113
108
114
109
By default, all fields on an annotated struct are stored encrypted in the table.
115
110
@@ -147,7 +142,7 @@ struct User {
147
142
148
143
If you implement the `Decryptable` trait these skipped fields need to implement `Default`.
149
144
150
-
####### Sort keys
145
+
### Sort keys
151
146
152
147
Cryptanomo requires every record to have a sort key. By default this will be derived based on the name of the struct.
153
148
However, if you want to specify your own, you can use the `sort_key_prefix` attribute:
@@ -167,7 +162,7 @@ struct User {
167
162
}
168
163
```
169
164
170
-
######## Dynamic Sort keys
165
+
#### Dynamic Sort keys
171
166
172
167
Cryptonamo also supports specifying the sort key dynamically based on a field on the struct.
173
168
You can choose the field using the `#[sort_key]` attribute.
@@ -189,7 +184,7 @@ struct User {
189
184
190
185
Sort keys will contain that value and will be prefixed by the sort key prefix.
191
186
192
-
######Indexing
187
+
## Indexing
193
188
194
189
Cryptanomo supports indexing of encrypted fields for searching.
195
190
Exact, prefix and compound match types are currently supported.
@@ -253,7 +248,7 @@ struct User {
253
248
It's important to note that the more annotations that are added to a field the more index terms that will be generated. Adding too many attributes could result in a
254
249
proliferation of terms and data.
255
250
256
-
######Storing and Retrieving Records
251
+
## Storing and Retrieving Records
257
252
258
253
Interacting with a table in DynamoDB is done via the [EncryptedTable] struct.
259
254
@@ -278,7 +273,7 @@ All operations on the table are `async` and so you will need a runtime to execut
278
273
In the above example, we connect to a DynamoDB running in a local container and initialize an `EncryptedTable` struct
279
274
for the "users" table.
280
275
281
-
####### Putting Records
276
+
### Putting Records
282
277
283
278
To store a record in the table, use the [`EncryptedTable::put`] method:
284
279
@@ -297,15 +292,15 @@ let user: Option<User> = table.get("dan@coderdan.co").await?;
297
292
The `get` method will return `None` if the record does not exist.
298
293
It uses type information to decrypt the record and return it as a struct.
299
294
300
-
####### Deleting Records
295
+
### Deleting Records
301
296
302
297
To delete a record, use the [`EncryptedTable::delete`] method:
303
298
304
299
```rust
305
300
table.delete::<User>("jane@smith.org").await?;
306
301
```
307
302
308
-
####### Querying Records
303
+
### Querying Records
309
304
310
305
To query records, use the [`EncryptedTable::query`] method which returns a builder:
311
306
@@ -331,7 +326,7 @@ let results: Vec<User> = table
331
326
Note: if you don't have the correct indexes defined this query builder will return a runtime
332
327
error.
333
328
334
-
######Table Verticalization
329
+
## Table Verticalization
335
330
336
331
Cryptonamo uses a technique called "verticalization" which is a popular approach to storing data in DynamoDB.
337
332
In practice, this means you can store multiple types in the same table.
@@ -355,7 +350,7 @@ struct License {
355
350
}
356
351
```
357
352
358
-
####### Data Views
353
+
### Data Views
359
354
360
355
In some cases, these types might simply be a different representation of the same data based on query requirements.
361
356
For example, you might want to query users by name using a prefix (say for using a "type ahead") but only return the name.
@@ -387,9 +382,9 @@ let results: Vec<UserView> = table
387
382
388
383
So long as the indexes are equivalent, you can mix and match types.
389
384
390
-
######Internals
385
+
## Internals
391
386
392
-
####### Table Schema
387
+
### Table Schema
393
388
394
389
Tables created by Cryptonamo have the following schema:
0 commit comments