Skip to content

Commit 6122f41

Browse files
committed
Revert to previous example in "Reading data" section
1 parent 18825fe commit 6122f41

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

README.md

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ Once the custom types and functions are installed, you can start using EQL in yo
4040

4141
1. Create a table with a column of type `cs_encrypted_v1` which will store your encrypted data.
4242
1. Use EQL functions to add indexes for the columns you want to encrypt.
43-
- Indexes are used by Cipherstash Proxy to understand what cryptography schemes are required for your use case.
43+
- Indexes are used by Cipherstash Proxy to understand what cryptography schemes are required for your use case.
4444
1. Initialize Cipherstash Proxy for cryptographic operations.
45-
- The Proxy will dynamically encrypt data on the way in and decrypt data on the way out based on the indexes you have defined.
45+
- The Proxy will dynamically encrypt data on the way in and decrypt data on the way out based on the indexes you have defined.
4646
1. Insert data into the defined columns using a specific payload format.
47-
- The payload format is defined in the [data format](#data-format) section.
47+
- The payload format is defined in the [data format](#data-format) section.
4848
1. Query the data using the EQL functions defined in the [querying data with EQL](#querying-data-with-eql) section.
49-
- No modifications are required to simply `SELECT` data from your encrypted columns.
50-
- In order to perform `WHERE` and `ORDER BY` queries, you must wrap the queries in the EQL functions defined in the [querying data with EQL](#querying-data-with-eql) section.
49+
- No modifications are required to simply `SELECT` data from your encrypted columns.
50+
- In order to perform `WHERE` and `ORDER BY` queries, you must wrap the queries in the EQL functions defined in the [querying data with EQL](#querying-data-with-eql) section.
5151
1. Integrate with your application via the [helper packages](#helper-packages) to interact with the encrypted data.
5252

5353
You can find a full getting started guide in the [GETTINGSTARTED.md](GETTINGSTARTED.md) file.
@@ -141,49 +141,19 @@ These statements must be run through the CipherStash Proxy in order to **decrypt
141141
**Example:**
142142

143143
```rb
144-
filter = EQL.for_match("users", "email_encrypted", "test")
145-
User.select(:email_encrypted).where("cs_match_v1(email_encrypted) @> cs_match_v1(?)", filter)
144+
Users.findAll(&:encrypted_email)
146145
```
147146

148147
Which will execute on the server as:
149148

150149
```sql
151-
SELECT email_encrypted FROM users
152-
WHERE cs_match_v1(email_encrypted) @> cs_match_v1('{
153-
"v": 1,
154-
"k": "pt",
155-
"p": "test",
156-
"i": {
157-
"t": "users",
158-
"c": "email_encrypted"
159-
},
160-
"q": "match"
161-
}');
150+
SELECT encrypted_email FROM users;
162151
```
163152

164-
A similar plaintext query (without EQL) could look like:
153+
And is the EQL equivalent of the following plaintext query:
165154

166155
```sql
167-
SELECT email FROM users WHERE email LIKE 'test%';
168-
```
169-
170-
Note that plaintext payloads for query operations should set the `"q"` (for query) property.
171-
This property tells CipherStash Proxy to only perform encryption necessary for a specific operation.
172-
Otherwise, Proxy will perform source encryption and encryption for all indexes configured for the given column.
173-
174-
For reference, the EQL payload is defined as a `jsonb` with a specific schema:
175-
176-
```json
177-
{
178-
"v": 1,
179-
"k": "pt",
180-
181-
"i": {
182-
"t": "users",
183-
"c": "email_encrypted"
184-
},
185-
"q": "match"
186-
}
156+
SELECT email FROM users;
187157
```
188158

189159
All the data returned from the database is fully decrypted.

0 commit comments

Comments
 (0)