Skip to content

Commit d78a3c1

Browse files
authored
Merge pull request #111 from cipherstash/update-eql-json-version
Update eql json version
2 parents 76476a0 + fa9d683 commit d78a3c1

File tree

9 files changed

+98
-64
lines changed

9 files changed

+98
-64
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ When inserting data into the encrypted column, wrap the plaintext in the appropr
134134

135135
```sql
136136
INSERT INTO users (encrypted_email) VALUES (
137-
'{"v":1,"k":"pt","p":"[email protected]","i":{"t":"users","c":"encrypted_email"}}'
137+
'{"v":2,"k":"pt","p":"[email protected]","i":{"t":"users","c":"encrypted_email"}}'
138138
);
139139
```
140140

@@ -151,7 +151,7 @@ Data is stored in the PostgreSQL database as:
151151
"bf": null,
152152
"ob": null,
153153
"u": null,
154-
"v": 1
154+
"v": 2
155155
}
156156
```
157157

@@ -175,7 +175,7 @@ Data is returned as:
175175
"t": "users",
176176
"c": "encrypted_email"
177177
},
178-
"v": 1,
178+
"v": 2,
179179
"q": null
180180
}
181181
```
@@ -249,7 +249,7 @@ SELECT eql_v2.add_search_config(
249249
```sql
250250
SELECT * FROM users
251251
WHERE eql_v2.hmac_256(encrypted_email) = eql_v2.hmac_256(
252-
'{"v":1,"k":"pt","p":"[email protected]","i":{"t":"users","c":"encrypted_email"},"q":"hmac_256"}'
252+
'{"v":2,"k":"pt","p":"[email protected]","i":{"t":"users","c":"encrypted_email"},"q":"hmac_256"}'
253253
);
254254
```
255255

@@ -280,7 +280,7 @@ SELECT eql_v2.add_search_config(
280280
```sql
281281
SELECT * FROM users
282282
WHERE eql_v2.bloom_filter(encrypted_email) @> eql_v2.bloom_filter(
283-
'{"v":1,"k":"pt","p":"test","i":{"t":"users","c":"encrypted_email"},"q":"match"}'
283+
'{"v":2,"k":"pt","p":"test","i":{"t":"users","c":"encrypted_email"},"q":"match"}'
284284
);
285285
```
286286

@@ -302,7 +302,7 @@ Enable range queries on encrypted data using the `eql_v2.ore_block_u64_8_256`, `
302302
```sql
303303
SELECT * FROM users
304304
WHERE eql_v2.ore_block_u64_8_256(encrypted_date) < eql_v2.ore_block_u64_8_256(
305-
'{"v":1,"k":"pt","p":"2023-10-05","i":{"t":"users","c":"encrypted_date"},"q":"ore"}'
305+
'{"v":2,"k":"pt","p":"2023-10-05","i":{"t":"users","c":"encrypted_date"},"q":"ore"}'
306306
);
307307
```
308308

docs/reference/JSON.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The EQL payload would be:
7070

7171
```sql
7272
INSERT INTO users (encrypted_json) VALUES (
73-
'{"v":1,"k":"pt","p":"{\"name\":\"John Doe\",\"metadata\":{\"age\":42}}","i":{"t":"users","c":"encrypted_json"}}'
73+
'{"v":2,"k":"pt","p":"{\"name\":\"John Doe\",\"metadata\":{\"age\":42}}","i":{"t":"users","c":"encrypted_json"}}'
7474
);
7575
```
7676

@@ -83,7 +83,7 @@ Data is stored in the database as:
8383
"t": "users"
8484
},
8585
"k": "sv",
86-
"v": 1,
86+
"v": 2,
8787
"sv": [["ciphertext"]]
8888
}
8989
```
@@ -108,7 +108,7 @@ Data is returned as:
108108
"t": "users",
109109
"c": "encrypted_json"
110110
},
111-
"v": 1,
111+
"v": 2,
112112
"q": null
113113
}
114114
```
@@ -141,7 +141,7 @@ We can query records that contain a specific structure.
141141
SELECT * FROM examples
142142
WHERE cs_ste_vec_v2(encrypted_json) @> cs_ste_vec_v2(
143143
'{
144-
"v":1,
144+
"v":2,
145145
"k":"pt",
146146
"p":{"top":{"nested":["a"]}},
147147
"i":{"t":"examples","c":"encrypted_json"},
@@ -169,7 +169,7 @@ If we query for a value that does not exist in the data:
169169
SELECT * FROM examples
170170
WHERE cs_ste_vec_v2(encrypted_json) @> cs_ste_vec_v2(
171171
'{
172-
"v":1,
172+
"v":2,
173173
"k":"pt",
174174
"p":{"top":{"nested":["d"]}},
175175
"i":{"t":"examples","c":"encrypted_json"},
@@ -203,7 +203,7 @@ We can extract the value of the `"top"` key.
203203
```sql
204204
SELECT cs_ste_vec_value_v2(encrypted_json,
205205
'{
206-
"v":1,
206+
"v":2,
207207
"k":"pt",
208208
"p":"$.top",
209209
"i":{"t":"examples","c":"encrypted_json"},
@@ -250,15 +250,15 @@ We can query records where the `"num"` field is greater than `2`.
250250
SELECT * FROM examples
251251
WHERE cs_ste_vec_term_v2(encrypted_json,
252252
'{
253-
"v":1,
253+
"v":2,
254254
"k":"pt",
255255
"p":"$.num",
256256
"i":{"t":"examples","c":"encrypted_json"},
257257
"q":"ejson_path"
258258
}'
259259
) > cs_ste_vec_term_v2(
260260
'{
261-
"v":1,
261+
"v":2,
262262
"k":"pt",
263263
"p":"2",
264264
"i":{"t":"examples","c":"encrypted_json"},
@@ -298,7 +298,7 @@ We can group the data by the `"color"` field and count occurrences.
298298
```sql
299299
SELECT cs_grouped_value_v2(cs_ste_vec_value_v2(encrypted_json,
300300
'{
301-
"v":1,
301+
"v":2,
302302
"k":"pt",
303303
"p":"$.color",
304304
"i":{"t":"examples","c":"encrypted_json"},
@@ -308,7 +308,7 @@ SELECT cs_grouped_value_v2(cs_ste_vec_value_v2(encrypted_json,
308308
FROM examples
309309
GROUP BY cs_ste_vec_term_v2(encrypted_json,
310310
'{
311-
"v":1,
311+
"v":2,
312312
"k":"pt",
313313
"p":"$.color",
314314
"i":{"t":"examples","c":"encrypted_json"},
@@ -408,7 +408,7 @@ SELECT cs_ste_vec_value_v2(encrypted_json, $1) FROM examples;
408408
"t": "examples",
409409
"c": "encrypted_json"
410410
},
411-
"v": 1,
411+
"v": 2,
412412
"q": "ejson_path"
413413
}
414414
```
@@ -436,7 +436,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
436436
"t": "examples",
437437
"c": "encrypted_json"
438438
},
439-
"v": 1,
439+
"v": 2,
440440
"q": "ejson_path"
441441
}
442442

@@ -448,7 +448,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
448448
"t": "examples",
449449
"c": "encrypted_json"
450450
},
451-
"v": 1,
451+
"v": 2,
452452
"q": "ste_vec"
453453
}
454454
```
@@ -495,7 +495,7 @@ With the params:
495495
"t": "examples",
496496
"c": "encrypted_json"
497497
},
498-
"v": 1,
498+
"v": 2,
499499
"q": "ejson_path"
500500
}
501501
```
@@ -511,7 +511,7 @@ Would return the EQL plaintext payload with an array (`[1, 2, 3]` for example):
511511
"t": "examples",
512512
"c": "encrypted_json"
513513
},
514-
"v": 1,
514+
"v": 2,
515515
"q": null
516516
}
517517
```
@@ -547,7 +547,7 @@ WHERE (cs_ste_vec_terms_v2(examples.encrypted_json, $1))[1] > cs_ste_vec_term_v2
547547
"t": "examples",
548548
"c": "encrypted_json"
549549
},
550-
"v": 1,
550+
"v": 2,
551551
"q": "ejson_path"
552552
}
553553

@@ -559,7 +559,7 @@ WHERE (cs_ste_vec_terms_v2(examples.encrypted_json, $1))[1] > cs_ste_vec_term_v2
559559
"t": "examples",
560560
"c": "encrypted_json"
561561
},
562-
"v": 1,
562+
"v": 2,
563563
"q": "ste_vec"
564564
}
565565
```
@@ -607,7 +607,7 @@ SELECT cs_ste_vec_value_v2(encrypted_json, $1) FROM examples;
607607
"t": "examples",
608608
"c": "encrypted_json"
609609
},
610-
"v": 1,
610+
"v": 2,
611611
"q": "ejson_path"
612612
}
613613
```
@@ -637,7 +637,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
637637
"t": "examples",
638638
"c": "encrypted_json"
639639
},
640-
"v": 1,
640+
"v": 2,
641641
"q": "ejson_path"
642642
}
643643

@@ -649,7 +649,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
649649
"t": "examples",
650650
"c": "encrypted_json"
651651
},
652-
"v": 1,
652+
"v": 2,
653653
"q": "ste_vec"
654654
}
655655
```
@@ -700,7 +700,7 @@ Example params:
700700
"t": "examples",
701701
"c": "encrypted_json"
702702
},
703-
"v": 1,
703+
"v": 2,
704704
"q": "ste_vec"
705705
}
706706
```
@@ -755,7 +755,7 @@ With the params:
755755
"t": "examples",
756756
"c": "encrypted_json"
757757
},
758-
"v": 1,
758+
"v": 2,
759759
"q": "ejson_path"
760760
}
761761
```
@@ -771,7 +771,7 @@ Would return the EQL plaintext payload with an array (`[1, 2, 3]` for example):
771771
"t": "examples",
772772
"c": "encrypted_json"
773773
},
774-
"v": 1,
774+
"v": 2,
775775
"q": null
776776
}
777777
```
@@ -808,7 +808,7 @@ WHERE EXISTS (
808808
"t": "examples",
809809
"c": "encrypted_json"
810810
},
811-
"v": 1,
811+
"v": 2,
812812
"q": "ejson_path"
813813
}
814814

@@ -820,7 +820,7 @@ WHERE EXISTS (
820820
"t": "examples",
821821
"c": "encrypted_json"
822822
},
823-
"v": 1,
823+
"v": 2,
824824
"q": "ste_vec"
825825
}
826826
```
@@ -874,7 +874,7 @@ Example data and params:
874874
"t": "examples",
875875
"c": "encrypted_json"
876876
},
877-
"v": 1,
877+
"v": 2,
878878
"q": "ejson_path"
879879
}
880880
```

docs/reference/PAYLOAD.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The plaintext json payload that is sent from the client to CipherStash Proxy in
88

99
```json
1010
{
11-
"v": 1,
11+
"v": 2,
1212
"k": "pt",
1313
"p": "plaintext value",
1414
"i": {
@@ -25,7 +25,7 @@ CipherStash Proxy will handle the plaintext payload and create the encrypted pay
2525

2626
```json
2727
{
28-
"v": 1,
28+
"v": 2,
2929
"k": "ct",
3030
"c": "ciphertext value",
3131
"i": {

0 commit comments

Comments
 (0)