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
@@ -222,12 +222,11 @@ You can also [run the tests locally](#running-tests-locally) when doing local de
222
222
223
223
### Running tests locally
224
224
225
-
> [!IMPORTANT]
226
-
> **Before you run the tests locally** you need to [set up a local dev environment](#set-up-a-local-development-environment).
225
+
> [!IMPORTANT] > **Before you run the tests locally** you need to [set up a local dev environment](#set-up-a-local-development-environment).
227
226
228
227
To run tests locally with PostgreSQL 17:
229
228
230
-
```shell
229
+
```shell
231
230
# Start a postgres instance (defaults to PostgreSQL 17)
232
231
mise run postgres:up --extra-args "--detach --wait"
233
232
@@ -292,67 +291,66 @@ mise run build
292
291
293
292
This produces two SQL files in `releases/`:
294
293
295
-
- An installer (`cipherstash-encrypt.sql`), and
296
-
- An uninstaller (`cipherstash-encrypt-uninstall.sql`)
294
+
- An installer (`cipherstash-encrypt.sql`), and
295
+
- An uninstaller (`cipherstash-encrypt-uninstall.sql`)
297
296
298
297
## Structure
299
298
300
299
### Schema
301
300
302
-
EQL is installed into the `eql_v1` PostgreSQL schema.
301
+
EQL is installed into the `eql_v2` PostgreSQL schema.
303
302
304
303
### Types
305
304
306
305
#### Encrypted column type
307
306
308
-
`public.eql_v1_encrypted` is EQL's encrypted column type, defined as PostgreSQL composite type.
307
+
`public.eql_v2_encrypted` is EQL's encrypted column type, defined as PostgreSQL composite type.
309
308
310
309
This column type is used for storing the encrypted value and any associated indexes for searching.
311
310
The associated indexes are described in the [index term types](#index-term-types) section.
312
311
313
-
`public.eql_v1_encrypted` is in the public schema, because once it's used by a user in one of their tables, encrypted column types cannot be dropped without dropping data.
312
+
`public.eql_v2_encrypted` is in the public schema, because once it's used by a user in one of their tables, encrypted column types cannot be dropped without dropping data.
314
313
315
314
#### Encrypted index term types
316
315
317
316
Each type of encrypted index (`unique`, `match`, `ore`) has an associated type, functions, and operators.
318
317
319
318
These are transient runtime types, used internally by EQL functions and operators:
320
319
321
-
-`eql_v1.blake3`
322
-
-`eql_v1.unique_index`
323
-
-`eql_v1.match`
324
-
-`eql_v1.ore_cllw_u64_8`
325
-
-`eql_v1.ore_cllw_var_8`
326
-
-`eql_v1.ore_64_8_v1`
327
-
-`eql_v1.ore_64_8_v1_term`
320
+
-`eql_v2.blake3`
321
+
-`eql_v2.unique_index`
322
+
-`eql_v2.match`
323
+
-`eql_v2.ore_cllw_u64_8`
324
+
-`eql_v2.ore_cllw_var_8`
325
+
-`eql_v2.ore_64_8_v2`
326
+
-`eql_v2.ore_64_8_v2_term`
328
327
329
328
The data in the column is converted into these types, when any operations are being performed on that encrypted data.
330
329
331
330
### Operators
332
331
333
332
Searchable encryption functionality is driven by operators on two types:
334
333
335
-
- EQL's `eql_v1_encrypted` column type
334
+
- EQL's `eql_v2_encrypted` column type
336
335
- PostgreSQL's `jsonb` column type
337
336
338
-
For convenience, operators allow comparisons between `eql_v1_encrypted` and `jsonb` column types.
337
+
For convenience, operators allow comparisons between `eql_v2_encrypted` and `jsonb` column types.
339
338
340
339
Operators allow comparisons between:
341
340
342
-
-`eql_v1_encrypted` and `eql_v1_encrypted`
343
-
-`jsonb` and `eql_v1_encrypted`
344
-
-`eql_v1_encrypted` and `jsonb`
341
+
-`eql_v2_encrypted` and `eql_v2_encrypted`
342
+
-`jsonb` and `eql_v2_encrypted`
343
+
-`eql_v2_encrypted` and `jsonb`
345
344
346
-
Operators defined on the `eql_v1_encrypted` dispatch to the underlying index terms based on the most efficient order of operations.
345
+
Operators defined on the `eql_v2_encrypted` dispatch to the underlying index terms based on the most efficient order of operations.
347
346
348
347
For example, it is possible to have both `unique` and `ore` indexes defined.
349
348
For equality (`=`, `<>`) operations, a `unique` index term is a text comparison and should be preferred over an `ore` index term.
350
349
351
-
The index term types and functions are internal implementation details and should not be exposed as operators on the `eql_v1_encrypted` type.
352
-
For example, `eql_v1_encrypted` should not have an operator with the `ore_64_8_v1` type.
350
+
The index term types and functions are internal implementation details and should not be exposed as operators on the `eql_v2_encrypted` type.
351
+
For example, `eql_v2_encrypted` should not have an operator with the `ore_64_8_v2` type.
353
352
Users should never need to think about or interact with EQL internals.
354
353
355
-
356
354
#### Working without operators
357
355
358
356
There are scenarios where users are unable to install EQL operators in your database.
@@ -363,12 +361,12 @@ EQL can still be used, but requires the use of functions instead of operators.
363
361
For example, to perform an equality query:
364
362
365
363
```sql
366
-
SELECT email FROM users WHEREeql_v1.eq(email, $1);
364
+
SELECT email FROM users WHEREeql_v2.eq(email, $1);
367
365
```
368
366
369
367
### Configuration table
370
368
371
-
EQL uses a table for tracking configuration state in the database, called `public.eql_v1_configuration`.
369
+
EQL uses a table for tracking configuration state in the database, called `public.eql_v2_configuration`.
372
370
373
371
This table should never be dropped, except by a user explicitly uninstalling EQL.
374
372
@@ -381,14 +379,14 @@ Experimenting with using a Composite type instead of a Domain type for the encry
381
379
Composite types are a bit more capable. Domain types are more like an alias for the underlying type (in this case jsonb)
382
380
The consequence of using a Composite type is that the data is stored in the column as a Tuple - effectively the data is wrapped in ()
383
381
This means
384
-
on insert/update the data needs to be cast to eql_v1_encrypted (proxy mapping will handle)
382
+
on insert/update the data needs to be cast to eql_v2_encrypted (proxy mapping will handle)
385
383
on read the data needs to be cast back to jsonb if a customer needs the raw json (for data lake transfer etc etc)
386
384
Already built cast helpers so syntax is something like
**Note:** This function allows you to encrypt and decrypt data but does not enable searchable encryption. See [Searching data with EQL](#searching-data-with-eql) for enabling searchable encryption.
0 commit comments