biscuit/schema.proto

282 lines
4.8 KiB
Protocol Buffer
Raw Normal View History

2019-04-01 18:41:20 +03:00
syntax = "proto2";
package biscuit.format.schema;
message Biscuit {
required bytes authority = 1;
repeated bytes blocks = 2;
repeated bytes keys = 3;
required Signature signature = 4;
}
message SealedBiscuit {
required bytes authority = 1;
repeated bytes blocks = 2;
required bytes signature = 3;
}
message Signature {
repeated bytes parameters = 1;
required bytes z = 2;
2019-04-01 18:41:20 +03:00
}
message Block {
required uint32 index = 1;
repeated string symbols = 2;
repeated FactV0 facts_v0 = 3;
repeated RuleV0 rules_v0 = 4;
repeated CaveatV0 caveats_v0 = 5;
2019-11-25 13:04:08 +03:00
optional string context = 6;
optional uint32 version = 7;
repeated FactV1 facts_v1 = 8;
repeated RuleV1 rules_v1 = 9;
repeated CaveatV1 caveats_v1 = 10;
2019-04-01 18:41:20 +03:00
}
message FactV0 {
required PredicateV0 predicate = 1;
2019-04-01 18:41:20 +03:00
}
message RuleV0 {
required PredicateV0 head = 1;
repeated PredicateV0 body = 2;
repeated ConstraintV0 constraints = 3;
2019-04-01 18:41:20 +03:00
}
message CaveatV0 {
repeated RuleV0 queries = 1;
}
message PredicateV0 {
2019-04-01 18:41:20 +03:00
required uint64 name = 1;
repeated IDV0 ids = 2;
2019-04-01 18:41:20 +03:00
}
message IDV0 {
enum Kind {
SYMBOL = 0;
VARIABLE = 1;
INTEGER = 2;
STR = 3;
DATE = 4;
BYTES = 5;
}
required Kind kind = 1;
optional uint64 symbol = 2;
optional uint32 variable = 3;
optional int64 integer = 4;
optional string str = 5;
optional uint64 date = 6;
optional bytes bytes = 7;
}
message ConstraintV0 {
required uint32 id = 1;
enum Kind {
INT = 0;
STRING = 1;
DATE = 2;
SYMBOL = 3;
BYTES = 4;
}
required Kind kind = 2;
optional IntConstraintV0 int = 3;
optional StringConstraintV0 str = 4;
optional DateConstraintV0 date = 5;
optional SymbolConstraintV0 symbol = 6;
optional BytesConstraintV0 bytes = 7;
}
message IntConstraintV0 {
enum Kind {
LOWER = 0;
LARGER = 1;
LOWER_OR_EQUAL = 2;
LARGER_OR_EQUAL = 3;
EQUAL = 4;
IN = 5;
NOT_IN = 6;
}
required Kind kind = 1;
optional int64 lower = 2;
optional int64 larger = 3;
optional int64 lower_or_equal = 4;
optional int64 larger_or_equal = 5;
optional int64 equal = 6;
repeated int64 in_set = 7 [packed=true];
repeated int64 not_in_set = 8 [packed=true];
}
message StringConstraintV0 {
enum Kind {
PREFIX = 0;
SUFFIX = 1;
EQUAL = 2;
IN = 3;
NOT_IN = 4;
REGEX = 5;
}
required Kind kind = 1;
optional string prefix = 2;
optional string suffix = 3;
optional string equal = 4;
repeated string in_set = 5;
repeated string not_in_set = 6;
optional string regex = 7;
}
message DateConstraintV0 {
enum Kind {
BEFORE = 0;
AFTER = 1;
}
required Kind kind = 1;
optional uint64 before = 2;
optional uint64 after = 3;
}
message SymbolConstraintV0 {
enum Kind {
IN = 0;
NOT_IN = 1;
}
required Kind kind = 1;
repeated uint64 in_set = 2;
repeated uint64 not_in_set = 3;
}
message BytesConstraintV0 {
enum Kind {
EQUAL = 0;
IN = 1;
NOT_IN = 2;
}
required Kind kind = 1;
optional bytes equal = 2;
repeated bytes in_set = 3;
repeated bytes not_in_set = 4;
}
message FactV1 {
required PredicateV1 predicate = 1;
}
message RuleV1 {
required PredicateV1 head = 1;
repeated PredicateV1 body = 2;
repeated ConstraintV1 constraints = 3;
}
message CaveatV1 {
repeated RuleV1 queries = 1;
}
message PredicateV1 {
required uint64 name = 1;
repeated IDV1 ids = 2;
}
2019-04-01 18:41:20 +03:00
message IDV1 {
oneof Content {
uint64 symbol = 1;
uint32 variable = 2;
int64 integer = 3;
string string = 4;
uint64 date = 5;
bytes bytes = 6;
2021-01-08 17:30:13 +03:00
bool bool = 7;
2021-01-08 18:42:36 +03:00
IDSet set = 8;
2019-04-01 18:41:20 +03:00
}
}
2021-01-08 18:42:36 +03:00
message IDSet {
repeated IDV1 set = 1;
}
message ConstraintV1 {
2019-04-01 18:41:20 +03:00
required uint32 id = 1;
oneof Constraint {
IntConstraintV1 int = 2;
StringConstraintV1 string = 3;
DateConstraintV1 date = 4;
SymbolConstraintV1 symbol = 5;
BytesConstraintV1 bytes = 6;
2019-04-01 18:41:20 +03:00
}
}
message IntConstraintV1 {
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
}
}
2019-04-01 18:41:20 +03:00
message IntSet {
repeated int64 set = 7 [packed=true];
2019-04-01 18:41:20 +03:00
}
message StringConstraintV1 {
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
}
}
2019-04-01 18:41:20 +03:00
message StringSet {
repeated string set = 1;
2019-04-01 18:41:20 +03:00
}
message DateConstraintV1 {
oneof Constraint {
uint64 before = 1;
uint64 after = 2;
2019-04-01 18:41:20 +03:00
}
}
message SymbolConstraintV1 {
oneof Constraint {
SymbolSet in_set = 1;
SymbolSet not_in_set = 2;
2019-04-01 18:41:20 +03:00
}
}
2019-04-01 18:41:20 +03:00
message SymbolSet {
repeated uint64 set = 1 [packed=true];
2019-04-01 18:41:20 +03:00
}
message BytesConstraintV1 {
oneof Constraint {
bytes equal = 1;
BytesSet in_set = 2;
BytesSet not_in_set = 3;
}
}
message BytesSet {
repeated bytes set = 1;
}