Skip to content

Commit 6dbcc25

Browse files
author
Bennett Hardwick
committed
Update README with cargo-rdme
1 parent 985fb03 commit 6dbcc25

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# cryptonamo
22

3-
### Cryptonamo: Encrypted Tables for DynamoDB
3+
## Cryptonamo: Encrypted Tables for DynamoDB
44

55
Based on the CipherStash SDK and ZeroKMS key service, Cryptonamo provides a simple interface for
66
storing and retrieving encrypted data in DynamoDB.
77

88
---
99

10-
### Prerequisites
10+
## Prerequisites
1111

12-
#### Install Stash CLI
12+
### Install Stash CLI
1313

1414
The `stash` CLI tool is required for creating an account and security credentials so that Cryptonamo can interact with the ZeroKMS key server.
1515

1616
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.
1717

18-
#### Sign up to create an account
18+
### Sign up to create an account
1919

2020
Run `stash signup` and follow the on screen instructions.
2121

22-
#### Login and create a Dataset
22+
### Login and create a Dataset
2323

2424
*The pages linked to below contain information that is generally applicable even though it is framed within the context of a Rails application*
2525

@@ -35,7 +35,7 @@ Run `stash signup` and follow the on screen instructions.
3535

3636
3. [Create a Client](https://docs.cipherstash.com/tutorials/rails-getting-started/define.html#3-create-a-client)
3737

38-
#### Upload a dataset config
38+
### Upload a dataset config
3939

4040
Cryptonamo fully manages the encrypted record and index settings.
4141

@@ -53,12 +53,7 @@ Upload it to ZeroKMS using the following command:
5353

5454
<!-- cargo-rdme start -->
5555

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
6257

6358
To use Cryptonamo, you must first create a table in DynamoDB.
6459
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 \
8580

8681
See below for more information on schema design for Cryptonamo tables.
8782

88-
####### Annotating a Cryptanomo Type
83+
### Annotating a Cryptanomo Type
8984

9085
To use Cryptonamo, you must first annotate a struct with the `Encryptable` derive macro, as
9186
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
109104

110105
The above example is the minimum required to use Cryptonamo however you can expand capabilities via several macros.
111106

112-
####### Controlling Encryption
107+
### Controlling Encryption
113108

114109
By default, all fields on an annotated struct are stored encrypted in the table.
115110

@@ -147,7 +142,7 @@ struct User {
147142

148143
If you implement the `Decryptable` trait these skipped fields need to implement `Default`.
149144

150-
####### Sort keys
145+
### Sort keys
151146

152147
Cryptanomo requires every record to have a sort key. By default this will be derived based on the name of the struct.
153148
However, if you want to specify your own, you can use the `sort_key_prefix` attribute:
@@ -167,7 +162,7 @@ struct User {
167162
}
168163
```
169164

170-
######## Dynamic Sort keys
165+
#### Dynamic Sort keys
171166

172167
Cryptonamo also supports specifying the sort key dynamically based on a field on the struct.
173168
You can choose the field using the `#[sort_key]` attribute.
@@ -189,7 +184,7 @@ struct User {
189184

190185
Sort keys will contain that value and will be prefixed by the sort key prefix.
191186

192-
###### Indexing
187+
## Indexing
193188

194189
Cryptanomo supports indexing of encrypted fields for searching.
195190
Exact, prefix and compound match types are currently supported.
@@ -253,7 +248,7 @@ struct User {
253248
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
254249
proliferation of terms and data.
255250

256-
###### Storing and Retrieving Records
251+
## Storing and Retrieving Records
257252

258253
Interacting with a table in DynamoDB is done via the [EncryptedTable] struct.
259254

@@ -278,7 +273,7 @@ All operations on the table are `async` and so you will need a runtime to execut
278273
In the above example, we connect to a DynamoDB running in a local container and initialize an `EncryptedTable` struct
279274
for the "users" table.
280275

281-
####### Putting Records
276+
### Putting Records
282277

283278
To store a record in the table, use the [`EncryptedTable::put`] method:
284279

@@ -297,15 +292,15 @@ let user: Option<User> = table.get("dan@coderdan.co").await?;
297292
The `get` method will return `None` if the record does not exist.
298293
It uses type information to decrypt the record and return it as a struct.
299294

300-
####### Deleting Records
295+
### Deleting Records
301296

302297
To delete a record, use the [`EncryptedTable::delete`] method:
303298

304299
```rust
305300
table.delete::<User>("jane@smith.org").await?;
306301
```
307302

308-
####### Querying Records
303+
### Querying Records
309304

310305
To query records, use the [`EncryptedTable::query`] method which returns a builder:
311306

@@ -331,7 +326,7 @@ let results: Vec<User> = table
331326
Note: if you don't have the correct indexes defined this query builder will return a runtime
332327
error.
333328

334-
###### Table Verticalization
329+
## Table Verticalization
335330

336331
Cryptonamo uses a technique called "verticalization" which is a popular approach to storing data in DynamoDB.
337332
In practice, this means you can store multiple types in the same table.
@@ -355,7 +350,7 @@ struct License {
355350
}
356351
```
357352

358-
####### Data Views
353+
### Data Views
359354

360355
In some cases, these types might simply be a different representation of the same data based on query requirements.
361356
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
387382

388383
So long as the indexes are equivalent, you can mix and match types.
389384

390-
###### Internals
385+
## Internals
391386

392-
####### Table Schema
387+
### Table Schema
393388

394389
Tables created by Cryptonamo have the following schema:
395390

@@ -409,7 +404,7 @@ HMAC(123) | user#name#4 | STE("Mike R") |
409404
And all other attributes are dependent on the type.
410405
They may be encrypted or otherwise.
411406

412-
####### Source Encryption
407+
### Source Encryption
413408

414409
Cryptonamo uses the CipherStash SDK to encrypt and decrypt data.
415410
Values are encypted using a unique key for each record using AES-GCM-SIV with 256-bit keys.
@@ -419,7 +414,7 @@ ZeroKMS's root keys are encrypted using AWS KMS and stored in DynamoDB (separate
419414

420415
When self-hosting ZeroKMS, we recommend running it in different account to your main application workloads.
421416

422-
###### Issues and TODO
417+
## Issues and TODO
423418

424419
- [ ] Sort keys are not currently hashed (and should be)
425420

0 commit comments

Comments
 (0)