Skip to content

Commit 8c7f806

Browse files
authored
Merge pull request #63 from cipherstash/update-json-schemas
Update JSON schemas to reflect current implementation in Proxy
2 parents be8c2c8 + 678b50b commit 8c7f806

File tree

4 files changed

+226
-93
lines changed

4 files changed

+226
-93
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "The EQL encrypted JSON payload used for queries.",
4+
"type": "object",
5+
"properties": {
6+
"k": {
7+
"title": "kind",
8+
"type": "string",
9+
"enum": ["qm", "qo", "qu", "qsv", "qsvs"]
10+
}
11+
},
12+
"oneOf": [
13+
{
14+
"description": "match query",
15+
"properties": {
16+
"k": {
17+
"const": "qm"
18+
},
19+
"m": {
20+
"title": "match index",
21+
"type": "array",
22+
"minItems": 1,
23+
"items": {
24+
"type": "number"
25+
}
26+
}
27+
},
28+
"required": ["m"]
29+
},
30+
{
31+
"description": "ore query",
32+
"properties": {
33+
"k": {
34+
"const": "qo"
35+
},
36+
"o": {
37+
"title": "ore index",
38+
"type": "array",
39+
"minItems": 1,
40+
"items": {
41+
"type": "string"
42+
}
43+
}
44+
},
45+
"required": ["o"]
46+
},
47+
{
48+
"description": "unique query",
49+
"properties": {
50+
"k": {
51+
"const": "qu"
52+
},
53+
"u": {
54+
"title": "unique index",
55+
"type": "string"
56+
}
57+
},
58+
"required": ["u"]
59+
},
60+
{
61+
"description": "Structured Encryption vector query",
62+
"properties": {
63+
"k": {
64+
"const": "qsv"
65+
},
66+
"sv": {
67+
"type": "array",
68+
"items": {
69+
"type": "array",
70+
"items": {
71+
"type": "string",
72+
"minItems": 2,
73+
"maxItems": 2
74+
}
75+
}
76+
}
77+
},
78+
"required": ["sv"]
79+
},
80+
{
81+
"description": "Structured Encryption vector selector query",
82+
"properties": {
83+
"k": {
84+
"const": "qsvs"
85+
},
86+
"svs": {
87+
"type": "string"
88+
}
89+
},
90+
"required": ["svs"]
91+
}
92+
],
93+
"required": ["k"]
94+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "The EQL encrypted JSON payload used for storage.",
4+
"type": "object",
5+
"properties": {
6+
"v": {
7+
"title": "Schema version",
8+
"type": "integer"
9+
},
10+
"k": {
11+
"title": "kind",
12+
"type": "string",
13+
"enum": ["ct", "sv"]
14+
},
15+
"i": {
16+
"title": "ident",
17+
"type": "object",
18+
"properties": {
19+
"t": {
20+
"title": "table",
21+
"type": "string",
22+
"pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$"
23+
},
24+
"c": {
25+
"title": "column",
26+
"type": "string",
27+
"pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$"
28+
}
29+
},
30+
"required": ["t", "c"]
31+
}
32+
},
33+
"oneOf": [
34+
{
35+
"properties": {
36+
"k": {
37+
"const": "ct"
38+
},
39+
"c": {
40+
"title": "ciphertext",
41+
"type": "string"
42+
},
43+
"u": {
44+
"title": "unique index",
45+
"type": "string"
46+
},
47+
"o": {
48+
"title": "ore index",
49+
"type": "array",
50+
"minItems": 1,
51+
"items": {
52+
"type": "string"
53+
}
54+
},
55+
"m": {
56+
"title": "match index",
57+
"type": "array",
58+
"minItems": 1,
59+
"items": {
60+
"type": "number"
61+
}
62+
}
63+
},
64+
"required": ["c"]
65+
},
66+
{
67+
"properties": {
68+
"k": {
69+
"const": "sv"
70+
},
71+
"sv": {
72+
"title": "Structured Encryption vector",
73+
"type": "array",
74+
"items": {
75+
"type": "array",
76+
"items": {
77+
"type": "string",
78+
"minItems": 3,
79+
"maxItems": 3
80+
}
81+
}
82+
}
83+
},
84+
"required": ["sv"]
85+
}
86+
],
87+
"required": ["v", "k", "i"]
88+
}

sql/schemas/cs_encrypted_v1.schema.json

Lines changed: 0 additions & 93 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "The EQL plaintext JSON payload sent by a client (such as an application) to CipherStash Proxy.",
4+
"type": "object",
5+
"properties": {
6+
"v": {
7+
"title": "Schema version",
8+
"type": "integer"
9+
},
10+
"k": {
11+
"title": "kind",
12+
"type": "string",
13+
"const": "pt"
14+
},
15+
"i": {
16+
"title": "ident",
17+
"type": "object",
18+
"properties": {
19+
"t": {
20+
"title": "table",
21+
"type": "string",
22+
"pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$"
23+
},
24+
"c": {
25+
"title": "column",
26+
"type": "string",
27+
"pattern": "^[a-zA-Z_]{1}[0-9a-zA-Z_]*$"
28+
}
29+
},
30+
"required": ["t", "c"]
31+
},
32+
"p": {
33+
"title": "plaintext",
34+
"type": "string"
35+
},
36+
"q": {
37+
"title": "for query",
38+
"description": "Specifies that the plaintext should be encrypted for a specific query operation. If null, source encryption and encryption for all indexes will be performed.",
39+
"type": "string",
40+
"enum": ["match", "ore", "unique", "ste_vec", "ejson_path"]
41+
}
42+
},
43+
"required": ["v", "k", "i", "p"]
44+
}

0 commit comments

Comments
 (0)