Skip to content

Update eql json version #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ When inserting data into the encrypted column, wrap the plaintext in the appropr

```sql
INSERT INTO users (encrypted_email) VALUES (
'{"v":1,"k":"pt","p":"test@example.com","i":{"t":"users","c":"encrypted_email"}}'
'{"v":2,"k":"pt","p":"test@example.com","i":{"t":"users","c":"encrypted_email"}}'
);
```

Expand All @@ -151,7 +151,7 @@ Data is stored in the PostgreSQL database as:
"bf": null,
"ob": null,
"u": null,
"v": 1
"v": 2
}
```

Expand All @@ -175,7 +175,7 @@ Data is returned as:
"t": "users",
"c": "encrypted_email"
},
"v": 1,
"v": 2,
"q": null
}
```
Expand Down Expand Up @@ -249,7 +249,7 @@ SELECT eql_v2.add_search_config(
```sql
SELECT * FROM users
WHERE eql_v2.hmac_256(encrypted_email) = eql_v2.hmac_256(
'{"v":1,"k":"pt","p":"test@example.com","i":{"t":"users","c":"encrypted_email"},"q":"hmac_256"}'
'{"v":2,"k":"pt","p":"test@example.com","i":{"t":"users","c":"encrypted_email"},"q":"hmac_256"}'
);
```

Expand Down Expand Up @@ -280,7 +280,7 @@ SELECT eql_v2.add_search_config(
```sql
SELECT * FROM users
WHERE eql_v2.bloom_filter(encrypted_email) @> eql_v2.bloom_filter(
'{"v":1,"k":"pt","p":"test","i":{"t":"users","c":"encrypted_email"},"q":"match"}'
'{"v":2,"k":"pt","p":"test","i":{"t":"users","c":"encrypted_email"},"q":"match"}'
);
```

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

Expand Down
52 changes: 26 additions & 26 deletions docs/reference/JSON.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The EQL payload would be:

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

Expand All @@ -83,7 +83,7 @@ Data is stored in the database as:
"t": "users"
},
"k": "sv",
"v": 1,
"v": 2,
"sv": [["ciphertext"]]
}
```
Expand All @@ -108,7 +108,7 @@ Data is returned as:
"t": "users",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": null
}
```
Expand Down Expand Up @@ -141,7 +141,7 @@ We can query records that contain a specific structure.
SELECT * FROM examples
WHERE cs_ste_vec_v2(encrypted_json) @> cs_ste_vec_v2(
'{
"v":1,
"v":2,
"k":"pt",
"p":{"top":{"nested":["a"]}},
"i":{"t":"examples","c":"encrypted_json"},
Expand Down Expand Up @@ -169,7 +169,7 @@ If we query for a value that does not exist in the data:
SELECT * FROM examples
WHERE cs_ste_vec_v2(encrypted_json) @> cs_ste_vec_v2(
'{
"v":1,
"v":2,
"k":"pt",
"p":{"top":{"nested":["d"]}},
"i":{"t":"examples","c":"encrypted_json"},
Expand Down Expand Up @@ -203,7 +203,7 @@ We can extract the value of the `"top"` key.
```sql
SELECT cs_ste_vec_value_v2(encrypted_json,
'{
"v":1,
"v":2,
"k":"pt",
"p":"$.top",
"i":{"t":"examples","c":"encrypted_json"},
Expand Down Expand Up @@ -250,15 +250,15 @@ We can query records where the `"num"` field is greater than `2`.
SELECT * FROM examples
WHERE cs_ste_vec_term_v2(encrypted_json,
'{
"v":1,
"v":2,
"k":"pt",
"p":"$.num",
"i":{"t":"examples","c":"encrypted_json"},
"q":"ejson_path"
}'
) > cs_ste_vec_term_v2(
'{
"v":1,
"v":2,
"k":"pt",
"p":"2",
"i":{"t":"examples","c":"encrypted_json"},
Expand Down Expand Up @@ -298,7 +298,7 @@ We can group the data by the `"color"` field and count occurrences.
```sql
SELECT cs_grouped_value_v2(cs_ste_vec_value_v2(encrypted_json,
'{
"v":1,
"v":2,
"k":"pt",
"p":"$.color",
"i":{"t":"examples","c":"encrypted_json"},
Expand All @@ -308,7 +308,7 @@ SELECT cs_grouped_value_v2(cs_ste_vec_value_v2(encrypted_json,
FROM examples
GROUP BY cs_ste_vec_term_v2(encrypted_json,
'{
"v":1,
"v":2,
"k":"pt",
"p":"$.color",
"i":{"t":"examples","c":"encrypted_json"},
Expand Down Expand Up @@ -408,7 +408,7 @@ SELECT cs_ste_vec_value_v2(encrypted_json, $1) FROM examples;
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}
```
Expand Down Expand Up @@ -436,7 +436,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}

Expand All @@ -448,7 +448,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ste_vec"
}
```
Expand Down Expand Up @@ -495,7 +495,7 @@ With the params:
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}
```
Expand All @@ -511,7 +511,7 @@ Would return the EQL plaintext payload with an array (`[1, 2, 3]` for example):
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": null
}
```
Expand Down Expand Up @@ -547,7 +547,7 @@ WHERE (cs_ste_vec_terms_v2(examples.encrypted_json, $1))[1] > cs_ste_vec_term_v2
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}

Expand All @@ -559,7 +559,7 @@ WHERE (cs_ste_vec_terms_v2(examples.encrypted_json, $1))[1] > cs_ste_vec_term_v2
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ste_vec"
}
```
Expand Down Expand Up @@ -607,7 +607,7 @@ SELECT cs_ste_vec_value_v2(encrypted_json, $1) FROM examples;
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}
```
Expand Down Expand Up @@ -637,7 +637,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}

Expand All @@ -649,7 +649,7 @@ WHERE cs_ste_vec_term_v2(examples.encrypted_json, $1) > cs_ste_vec_term_v2($2)
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ste_vec"
}
```
Expand Down Expand Up @@ -700,7 +700,7 @@ Example params:
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ste_vec"
}
```
Expand Down Expand Up @@ -755,7 +755,7 @@ With the params:
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}
```
Expand All @@ -771,7 +771,7 @@ Would return the EQL plaintext payload with an array (`[1, 2, 3]` for example):
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": null
}
```
Expand Down Expand Up @@ -808,7 +808,7 @@ WHERE EXISTS (
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}

Expand All @@ -820,7 +820,7 @@ WHERE EXISTS (
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ste_vec"
}
```
Expand Down Expand Up @@ -874,7 +874,7 @@ Example data and params:
"t": "examples",
"c": "encrypted_json"
},
"v": 1,
"v": 2,
"q": "ejson_path"
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/PAYLOAD.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The plaintext json payload that is sent from the client to CipherStash Proxy in

```json
{
"v": 1,
"v": 2,
"k": "pt",
"p": "plaintext value",
"i": {
Expand All @@ -25,7 +25,7 @@ CipherStash Proxy will handle the plaintext payload and create the encrypted pay

```json
{
"v": 1,
"v": 2,
"k": "ct",
"c": "ciphertext value",
"i": {
Expand Down
Loading