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
The column **must** be of type `eql_v2_encrypted`.
14
+
If you try to configure a column that doesn't exist in the database, you'll get the error:
15
+
16
+
```
17
+
ERROR: Some pending columns do not have an encrypted target
18
+
```
19
+
20
+
## Initializing column configuration
21
+
22
+
After creating the encrypted column, initialize it for use with CipherStash Proxy using the `eql_v2.add_column` function:
23
+
24
+
```sql
25
+
SELECTeql_v2.add_column('users', 'encrypted_email', 'text'); -- Initialize the new encrypted column
26
+
```
27
+
28
+
**Full signature:**
29
+
```sql
30
+
SELECTeql_v2.add_column(
31
+
'table_name', -- Name of the table
32
+
'column_name', -- Name of the encrypted column (must already exist as type eql_v2_encrypted)
33
+
'cast_as', -- PostgreSQL type to cast decrypted data [optional, defaults to 'text']
34
+
migrating -- If true, stages changes without immediate activation [optional, defaults to false]
35
+
);
7
36
```
8
37
9
38
**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.
10
39
11
-
## Refreshing CipherStash Proxy Configuration
40
+
## Complete setup workflow
41
+
42
+
Here's the complete workflow to set up an encrypted column with search capabilities:
43
+
44
+
```sql
45
+
-- Step 1: Create the encrypted column in your table
CipherStash Proxy refreshes the configuration every 60 seconds. To force an immediate refresh, run:
14
62
@@ -25,7 +73,7 @@ Encrypted data is stored as `jsonb` values in the PostgreSQL database, regardles
25
73
26
74
You can read more about the data format [here](docs/reference/payload.md).
27
75
28
-
### Inserting Data
76
+
### Inserting data
29
77
30
78
When inserting data into the encrypted column, wrap the plaintext in the appropriate EQL payload. These statements must be run through the CipherStash Proxy to **encrypt** the data.
31
79
@@ -54,7 +102,7 @@ Data is stored in the PostgreSQL database as:
54
102
}
55
103
```
56
104
57
-
### Reading Data
105
+
### Reading data
58
106
59
107
When querying data, select the encrypted column. CipherStash Proxy will **decrypt** the data automatically.
60
108
@@ -90,15 +138,18 @@ In order to perform searchable operations on encrypted data, you must configure
90
138
91
139
### Adding an index
92
140
141
+
**Prerequisites:** The encrypted column must already exist in the database (see [Prerequisites](#prerequisites)) and be configured with `eql_v2.add_column`.
142
+
93
143
Add an index to an encrypted column using the `eql_v2.add_search_config` function:
94
144
95
145
```sql
96
146
SELECTeql_v2.add_search_config(
97
147
'table_name', -- Name of the table
98
148
'column_name', -- Name of the column
99
149
'index_name', -- Index kind ('unique', 'match', 'ore', 'ste_vec')
100
-
'cast_as', -- PostgreSQL type to cast decrypted data ('text', 'int', etc.)
101
-
'opts'-- Index options as JSONB (optional)
150
+
'cast_as', -- PostgreSQL type to cast decrypted data ('text', 'int', etc.) [optional, defaults to 'text']
151
+
'opts', -- Index options as JSONB [optional, defaults to '{}']
152
+
migrating -- If true, stages changes without immediate activation [optional, defaults to false]
-`eql_v2.add_search_config(table_name, column_name, index_name, cast_as DEFAULT 'text', opts DEFAULT '{}', migrating DEFAULT false)` - Add a search index to a column
395
+
-`eql_v2.remove_search_config(table_name, column_name, index_name, migrating DEFAULT false)` - Remove a specific search index (preserves column configuration)
396
+
-`eql_v2.modify_search_config(table_name, column_name, index_name, cast_as DEFAULT 'text', opts DEFAULT '{}', migrating DEFAULT false)` - Modify an existing search index
397
+
398
+
**Configuration Management:**
399
+
-`eql_v2.migrate_config()` - Manually migrate pending configuration to encrypting state
0 commit comments