Skip to content

Commit e44ae11

Browse files
committed
fix up field names
1 parent 5f96901 commit e44ae11

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

docs/tutorials/GETTINGSTARTED.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ stash workspaces
3535
stash access-keys create --workspace-id $CS_WORKSPACE_ID eql-test
3636
```
3737

38-
6. Go to the [EQL playground](../../playground) and copy over the example `.envrc` file:
38+
6. Go to the [EQL playground](../../playground\) and copy over the example `.envrc` file:
3939

4040
```shell
41-
cd ../../playground
41+
cd playground
4242
cp .envrc.example .envrc
4343
```
4444

@@ -48,12 +48,20 @@ Update the `.envrc` file with these environment variables `CS_WORKSPACE_ID`, `CS
4848
source .envrc
4949
```
5050

51-
7. Start Postgres and CipherStash Proxy and install EQL:
51+
7. Start PostgreSQL and CipherStash Proxy and install EQL:
5252

5353
```shell
5454
docker compose up
5555
```
5656

57+
8. Check PostgreSQL and the Proxy are running:
58+
59+
```shell
60+
docker ps
61+
```
62+
63+
You should see 2 containers running, `postgres_proxy` and `eql-playground-pg`.
64+
5765
## Example
5866

5967
These examples will show how EQL works using raw SQL.
@@ -89,7 +97,10 @@ We will use a `users` table with an email field for this example.
8997
In psql, run:
9098

9199
```sql
92-
CREATE TABLE users (email VARCHAR(100));
100+
CREATE TABLE IF NOT EXISTS users (
101+
id serial PRIMARY KEY NOT NULL,
102+
email VARCHAR(100)
103+
);
93104
```
94105

95106
Our `users` schema looks like this:
@@ -233,7 +244,7 @@ docker exec -it postgres_proxy bash
233244
Run:
234245

235246
```bash
236-
cipherstash-migrator --columns email=encrypted_email --table users --database-name postres --username postgres --password postgres
247+
cipherstash-migrator --columns email=email_encrypted --table users --database-name postgres --username postgres --password postgres
237248
```
238249

239250
We now have encrypted data in our `email_encrypted` field that we can query.
@@ -266,7 +277,7 @@ An EQL payload will look like this:
266277
"p": "test@test.com", // The plaintext data
267278
"i": {
268279
"t": "users", // The table
269-
"c": "encrypted_email" // The encrypted column
280+
"c": "email_encrypted" // The encrypted column
270281
},
271282
"v": 1,
272283
"q": null // Used in queries only.
@@ -281,10 +292,10 @@ A query to insert an email into the plaintext `email` field in the `users` table
281292
INSERT INTO users (email) VALUES ('test@test.com');
282293
```
283294

284-
The equivalent of this query to insert a plaintext email and encrypt it into the `encrypted_email` column using EQL:
295+
The equivalent of this query to insert a plaintext email and encrypt it into the `email_encrypted` column using EQL:
285296

286297
```sql
287-
INSERT INTO users (encrypted_email) VALUES ('{"v":1,"k":"pt","p":"test@test.com","i":{"t":"users","c":"encrypted_email"}}');
298+
INSERT INTO users (email_encrypted) VALUES ('{"v":1,"k":"pt","p":"test@test.com","i":{"t":"users","c":"email_encrypted"}}');
288299
```
289300

290301
**What is happening?**
@@ -336,7 +347,7 @@ SELECT email FROM users;
336347
The EQL equivalent of this query is:
337348

338349
```sql
339-
SELECT encrypted_email->>'p' FROM users;
350+
SELECT email_encrypted FROM users;
340351
```
341352

342353
**What is happening?**
@@ -349,15 +360,13 @@ All data returned from CipherStash Proxy for encrypted fields will be in this js
349360
"p": "test@test.com", // The returned plaintext data
350361
"i": {
351362
"t": "users",
352-
"c": "encrypted_email"
363+
"c": "email_encrypted"
353364
},
354365
"v": 1,
355366
"q": null
356367
}
357368
```
358369

359-
We can use the `->>` jsonb operator to extract the `"p"` value.
360-
361370
#### Advanced querying
362371

363372
EQL provides specialized functions to be able to interact with encrypted data and to support operations like equality checks, comparison queries, and unique constraints.

0 commit comments

Comments
 (0)