2019-04-01 18:41:20 +03:00
|
|
|
syntax = "proto2";
|
|
|
|
|
|
|
|
package biscuit.format.schema;
|
|
|
|
|
|
|
|
message Biscuit {
|
2021-09-03 00:04:46 +03:00
|
|
|
optional uint32 rootKeyId = 1;
|
|
|
|
required SignedBlock authority = 2;
|
|
|
|
repeated SignedBlock blocks = 3;
|
|
|
|
required Proof proof = 4;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 00:04:46 +03:00
|
|
|
message SignedBlock {
|
|
|
|
required bytes block = 1;
|
|
|
|
required bytes nextKey = 2;
|
2019-04-01 18:41:20 +03:00
|
|
|
required bytes signature = 3;
|
|
|
|
}
|
|
|
|
|
2021-09-03 00:04:46 +03:00
|
|
|
message Proof {
|
|
|
|
oneof Content {
|
|
|
|
bytes nextSecret = 1;
|
|
|
|
bytes finalSignature = 2;
|
|
|
|
}
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message Block {
|
2021-09-03 22:58:14 +03:00
|
|
|
repeated string symbols = 1;
|
|
|
|
optional string context = 2;
|
|
|
|
optional uint32 version = 3;
|
|
|
|
repeated FactV2 facts_v2 = 4;
|
|
|
|
repeated RuleV2 rules_v2 = 5;
|
|
|
|
repeated CheckV2 checks_v2 = 6;
|
2021-01-05 17:02:44 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message FactV2 {
|
|
|
|
required PredicateV2 predicate = 1;
|
2021-01-05 17:02:44 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message RuleV2 {
|
|
|
|
required PredicateV2 head = 1;
|
|
|
|
repeated PredicateV2 body = 2;
|
|
|
|
repeated ExpressionV2 expressions = 3;
|
2021-01-05 17:02:44 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message CheckV2 {
|
|
|
|
repeated RuleV2 queries = 1;
|
2021-01-05 17:02:44 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message PredicateV2 {
|
2021-01-05 17:02:44 +03:00
|
|
|
required uint64 name = 1;
|
2021-09-03 22:58:14 +03:00
|
|
|
repeated IDV2 ids = 2;
|
2021-01-05 17:02:44 +03:00
|
|
|
}
|
2019-04-01 18:41:20 +03:00
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message IDV2 {
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Content {
|
2021-09-06 22:54:32 +03:00
|
|
|
uint32 variable = 1;
|
|
|
|
int64 integer = 2;
|
|
|
|
uint64 string = 3;
|
|
|
|
uint64 date = 4;
|
|
|
|
bytes bytes = 5;
|
|
|
|
bool bool = 6;
|
|
|
|
IDSet set = 7;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-08 18:42:36 +03:00
|
|
|
message IDSet {
|
2021-09-03 22:58:14 +03:00
|
|
|
repeated IDV2 set = 1;
|
2021-01-08 18:42:36 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message ConstraintV2 {
|
2019-04-01 18:41:20 +03:00
|
|
|
required uint32 id = 1;
|
|
|
|
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Constraint {
|
2021-09-03 22:58:14 +03:00
|
|
|
IntConstraintV2 int = 2;
|
|
|
|
StringConstraintV2 string = 3;
|
|
|
|
DateConstraintV2 date = 4;
|
2021-09-06 22:54:32 +03:00
|
|
|
BytesConstraintV2 bytes = 5;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message IntConstraintV2 {
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Constraint {
|
|
|
|
int64 less_than = 1;
|
|
|
|
int64 greater_than = 2;
|
|
|
|
int64 less_or_equal = 3;
|
|
|
|
int64 greater_or_equal = 4;
|
|
|
|
int64 equal = 5;
|
|
|
|
IntSet in_set = 6;
|
|
|
|
IntSet not_in_set = 7;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
2021-01-06 13:23:15 +03:00
|
|
|
}
|
2019-04-01 18:41:20 +03:00
|
|
|
|
2021-01-06 13:23:15 +03:00
|
|
|
message IntSet {
|
|
|
|
repeated int64 set = 7 [packed=true];
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message StringConstraintV2 {
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Constraint {
|
|
|
|
string prefix = 1;
|
|
|
|
string suffix = 2;
|
|
|
|
string equal = 3;
|
|
|
|
StringSet in_set = 4;
|
|
|
|
StringSet not_in_set = 5;
|
|
|
|
string regex = 6;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
2021-01-06 13:23:15 +03:00
|
|
|
}
|
2019-04-01 18:41:20 +03:00
|
|
|
|
2021-01-06 13:23:15 +03:00
|
|
|
message StringSet {
|
2021-09-06 22:54:32 +03:00
|
|
|
repeated uint64 set = 1 [packed=true];
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message DateConstraintV2 {
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Constraint {
|
|
|
|
uint64 before = 1;
|
|
|
|
uint64 after = 2;
|
2019-04-01 18:41:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message BytesConstraintV2 {
|
2021-01-06 13:23:15 +03:00
|
|
|
oneof Constraint {
|
|
|
|
bytes equal = 1;
|
|
|
|
BytesSet in_set = 2;
|
|
|
|
BytesSet not_in_set = 3;
|
2020-09-11 17:45:46 +03:00
|
|
|
}
|
2021-01-06 13:23:15 +03:00
|
|
|
}
|
2020-09-11 17:45:46 +03:00
|
|
|
|
2021-01-06 13:23:15 +03:00
|
|
|
message BytesSet {
|
|
|
|
repeated bytes set = 1;
|
2020-09-11 17:45:46 +03:00
|
|
|
}
|
2021-01-22 18:00:19 +03:00
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
message ExpressionV2 {
|
2021-01-22 18:00:19 +03:00
|
|
|
repeated Op ops = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Op {
|
|
|
|
oneof Content {
|
2021-09-03 22:58:14 +03:00
|
|
|
IDV2 value = 1;
|
2021-01-22 18:00:19 +03:00
|
|
|
OpUnary unary = 2;
|
|
|
|
OpBinary Binary = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message OpUnary {
|
|
|
|
enum Kind {
|
|
|
|
Negate = 0;
|
2021-01-26 12:52:39 +03:00
|
|
|
Parens = 1;
|
2021-02-26 19:55:27 +03:00
|
|
|
Length = 2;
|
2021-01-22 18:00:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
required Kind kind = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message OpBinary {
|
|
|
|
enum Kind {
|
|
|
|
LessThan = 0;
|
|
|
|
GreaterThan = 1;
|
|
|
|
LessOrEqual = 2;
|
|
|
|
GreaterOrEqual = 3;
|
|
|
|
Equal = 4;
|
2021-01-26 16:41:15 +03:00
|
|
|
Contains = 5;
|
|
|
|
Prefix = 6;
|
|
|
|
Suffix = 7;
|
|
|
|
Regex = 8;
|
|
|
|
Add = 9;
|
|
|
|
Sub = 10;
|
|
|
|
Mul = 11;
|
|
|
|
Div = 12;
|
|
|
|
And = 13;
|
|
|
|
Or = 14;
|
2021-02-26 19:55:27 +03:00
|
|
|
Intersection = 15;
|
|
|
|
Union = 16;
|
2021-01-22 18:00:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
required Kind kind = 1;
|
|
|
|
}
|
2021-03-04 16:21:06 +03:00
|
|
|
|
|
|
|
message Policy {
|
|
|
|
enum Kind {
|
|
|
|
Allow = 0;
|
|
|
|
Deny = 1;
|
|
|
|
}
|
|
|
|
|
2021-09-03 22:58:14 +03:00
|
|
|
repeated RuleV2 queries = 1;
|
2021-03-04 16:21:06 +03:00
|
|
|
required Kind kind = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message VerifierPolicies {
|
|
|
|
repeated string symbols = 1;
|
|
|
|
optional uint32 version = 2;
|
2021-09-03 22:58:14 +03:00
|
|
|
repeated FactV2 facts = 3;
|
|
|
|
repeated RuleV2 rules = 4;
|
|
|
|
repeated CheckV2 checks = 5;
|
2021-03-04 16:21:06 +03:00
|
|
|
repeated Policy policies = 6;
|
|
|
|
}
|