diff --git a/authorizer.go b/authorizer.go index 5266f7c..f1a3d8c 100644 --- a/authorizer.go +++ b/authorizer.go @@ -114,7 +114,7 @@ func (v *authorizer) AddPolicy(policy Policy) { func (v *authorizer) Authorize() error { // if we load facts from the verifier before // the token's fact and rules, we might get inconsistent symbols - // token ements should first be converted to builder elements + // token elements should first be converted to builder elements // with the token's symbol table, then converted back // with the verifier's symbol table for _, fact := range *v.biscuit.authority.facts { @@ -141,21 +141,7 @@ func (v *authorizer) Authorize() error { var errs []error for i, check := range v.checks { - c := check.convert(v.symbols) - successful := false - for _, query := range c.Queries { - res := v.world.QueryRule(query, v.symbols) - if len(*res) != 0 { - successful = true - break - } - } - if !successful { - debug := datalog.SymbolDebugger{ - SymbolTable: v.symbols, - } - errs = append(errs, fmt.Errorf("failed to verify check #%d: %s", i, debug.Check(c))) - } + errs = v.applyCheck(&check, errs, v.world, "authorizer", i) } for i, check := range v.biscuit.authority.checks { @@ -163,22 +149,7 @@ func (v *authorizer) Authorize() error { if err != nil { return fmt.Errorf("biscuit: verification failed: %s", err) } - c := ch.convert(v.symbols) - - successful := false - for _, query := range c.Queries { - res := v.world.QueryRule(query, v.symbols) - if len(*res) != 0 { - successful = true - break - } - } - if !successful { - debug := datalog.SymbolDebugger{ - SymbolTable: v.symbols, - } - errs = append(errs, fmt.Errorf("failed to verify block 0 check #%d: %s", i, debug.Check(c))) - } + errs = v.applyCheck(ch, errs, v.world, "block 0", i) } policyMatched := false @@ -203,7 +174,7 @@ func (v *authorizer) Authorize() error { } } - // remove the rules from the vrifier and authority blocks + // remove the rules from the verifier and authority blocks // so they are not affected by facts created by later blocks v.world.ResetRules() @@ -235,23 +206,7 @@ func (v *authorizer) Authorize() error { if err != nil { return fmt.Errorf("biscuit: verification failed: %s", err) } - c := ch.convert(v.symbols) - - successful := false - for _, query := range c.Queries { - res := block_world.QueryRule(query, v.symbols) - - if len(*res) != 0 { - successful = true - break - } - } - if !successful { - debug := datalog.SymbolDebugger{ - SymbolTable: v.symbols, - } - errs = append(errs, fmt.Errorf("failed to verify block #%d check #%d: %s", i+1, j, debug.Check(c))) - } + errs = v.applyCheck(ch, errs, block_world, fmt.Sprintf("block %d", i+1), j) } block_world.ResetRules() @@ -277,6 +232,31 @@ func (v *authorizer) Authorize() error { } } +func (v *authorizer) applyCheck(ch *Check, errs []error, world *datalog.World, block string, idx int) []error { + c := ch.convert(v.symbols) + + successful := false + for _, query := range c.Queries { + res := world.QueryRuleExtended(query, v.symbols, c.CheckKind) + if len(*res) != 0 { + successful = true + debug := datalog.SymbolDebugger{SymbolTable: v.symbols} + querystr := debug.CheckQuery(query) + _ = querystr + resstr := debug.FactSet(res) + _ = resstr + break + } + } + if !successful { + debug := datalog.SymbolDebugger{ + SymbolTable: v.symbols, + } + errs = append(errs, fmt.Errorf("failed to verify block %s check #%d: %s", block, idx, debug.Check(c))) + } + return errs +} + func (v *authorizer) Query(rule Rule) (FactSet, error) { if err := v.world.Run(v.symbols); err != nil { return nil, err @@ -328,7 +308,7 @@ func (v *authorizer) LoadPolicies(authorizerPolicies []byte) error { } switch pbPolicies.GetVersion() { - case 3: + case 3, 4: return v.loadPoliciesV2(pbPolicies) default: return fmt.Errorf("verifier: unsupported policies version %d", pbPolicies.GetVersion()) diff --git a/converters.go b/converters.go index 7b1b359..08f1be7 100644 --- a/converters.go +++ b/converters.go @@ -77,7 +77,7 @@ func protoBlockToTokenBlock(input *pb.Block) (*Block, error) { } switch input.GetVersion() { - case 3: + case 3, 4: facts = make(datalog.FactSet, len(input.FactsV2)) rules = make([]datalog.Rule, len(input.RulesV2)) checks = make([]datalog.Check, len(input.ChecksV2)) diff --git a/converters_v2.go b/converters_v2.go index a1ec69c..b05b2fb 100644 --- a/converters_v2.go +++ b/converters_v2.go @@ -104,6 +104,8 @@ func tokenIDToProtoIDV2(input datalog.Term) (*pb.TermV2, error) { return nil, errors.New("biscuit: failed to convert token ID to proto ID: set cannot contains variable") case datalog.TermTypeSet: return nil, errors.New("biscuit: failed to convert token ID to proto ID: set cannot contains other sets") + default: + // Ignore and continue } protoSet := make([]*pb.TermV2, 0, len(datalogSet)) @@ -222,8 +224,8 @@ func tokenRuleToProtoRuleV2(input datalog.Rule) (*pb.RuleV2, error) { func protoRuleToTokenRuleV2(input *pb.RuleV2) (*datalog.Rule, error) { body := make([]datalog.Predicate, len(input.Body)) - for i, pb := range input.Body { - b, err := protoPredicateToTokenPredicateV2(pb) + for i, pred := range input.Body { + b, err := protoPredicateToTokenPredicateV2(pred) if err != nil { return nil, err } @@ -378,6 +380,14 @@ func tokenExprBinaryToProtoExprBinary(op datalog.BinaryOp) (*pb.OpBinary, error) pbBinaryKind = pb.OpBinary_Intersection case datalog.BinaryUnion: pbBinaryKind = pb.OpBinary_Union + case datalog.BinaryBitwiseAnd: + pbBinaryKind = pb.OpBinary_BitwiseAnd + case datalog.BinaryBitwiseOr: + pbBinaryKind = pb.OpBinary_BitwiseOr + case datalog.BinaryBitwiseXor: + pbBinaryKind = pb.OpBinary_BitwiseXor + case datalog.BinaryNotEqual: + pbBinaryKind = pb.OpBinary_NotEqual default: return nil, fmt.Errorf("biscuit: unsupported BinaryOpFunc type: %v", op.BinaryOpFunc.Type()) } @@ -397,6 +407,8 @@ func protoExprBinaryToTokenExprBinary(op *pb.OpBinary) (datalog.BinaryOpFunc, er binaryOp = datalog.GreaterOrEqual{} case pb.OpBinary_Equal: binaryOp = datalog.Equal{} + case pb.OpBinary_NotEqual: + binaryOp = datalog.NotEqual{} case pb.OpBinary_Contains: binaryOp = datalog.Contains{} case pb.OpBinary_Prefix: @@ -421,6 +433,12 @@ func protoExprBinaryToTokenExprBinary(op *pb.OpBinary) (datalog.BinaryOpFunc, er binaryOp = datalog.Intersection{} case pb.OpBinary_Union: binaryOp = datalog.Union{} + case pb.OpBinary_BitwiseAnd: + binaryOp = datalog.BitwiseAnd{} + case pb.OpBinary_BitwiseOr: + binaryOp = datalog.BitwiseOr{} + case pb.OpBinary_BitwiseXor: + binaryOp = datalog.BitwiseXor{} default: return nil, fmt.Errorf("biscuit: unsupported proto OpBinary type: %v", op.Kind) } @@ -437,7 +455,17 @@ func tokenCheckToProtoCheckV2(input datalog.Check) (*pb.CheckV2, error) { pbQueries[i] = q } + var kind pb.CheckV2_Kind + switch input.CheckKind { + case datalog.CheckKindOne: + kind = pb.CheckV2_One + case datalog.CheckKindAll: + kind = pb.CheckV2_All + default: + return nil, errors.New("unsupported check kind") + } return &pb.CheckV2{ + Kind: &kind, Queries: pbQueries, }, nil } @@ -452,7 +480,18 @@ func protoCheckToTokenCheckV2(input *pb.CheckV2) (*datalog.Check, error) { queries[i] = *q } + var kind datalog.CheckKind + switch input.GetKind() { + case pb.CheckV2_One: + kind = datalog.CheckKindOne + case pb.CheckV2_All: + kind = datalog.CheckKindAll + default: + return nil, errors.New("unsupported check kind") + } + return &datalog.Check{ - Queries: queries, + CheckKind: kind, + Queries: queries, }, nil } diff --git a/converters_v2_test.go b/converters_v2_test.go index ab15934..5383a7b 100644 --- a/converters_v2_test.go +++ b/converters_v2_test.go @@ -724,7 +724,7 @@ func TestBlockConvertV2(t *testing.T) { symbols: &datalog.SymbolTable{"a", "b", "c", "d"}, facts: &datalog.FactSet{datalog.Fact{Predicate: predicate}}, rules: []datalog.Rule{*rule}, - checks: []datalog.Check{{Queries: []datalog.Rule{*rule}}}, + checks: []datalog.Check{{CheckKind: datalog.CheckKindOne, Queries: []datalog.Rule{*rule}}}, context: "context", version: 3, } @@ -737,7 +737,7 @@ func TestBlockConvertV2(t *testing.T) { {Predicate: pbPredicate}, }, RulesV2: []*pb.RuleV2{pbRule}, - ChecksV2: []*pb.CheckV2{{Queries: []*pb.RuleV2{pbRule}}}, + ChecksV2: []*pb.CheckV2{{Kind: pb.CheckV2_One.Enum(), Queries: []*pb.RuleV2{pbRule}}}, Context: &ctx, Version: proto.Uint32(version), } diff --git a/datalog/datalog.go b/datalog/datalog.go index 72fc29b..4582689 100644 --- a/datalog/datalog.go +++ b/datalog/datalog.go @@ -200,19 +200,16 @@ func (e InvalidRuleError) Error() string { } func (r Rule) Apply(facts *FactSet, newFacts *FactSet, syms *SymbolTable) error { + return r.ApplyExtended(facts, newFacts, syms, CheckKindOne) +} + +func (r Rule) ApplyExtended(facts *FactSet, newFacts *FactSet, syms *SymbolTable, kind CheckKind) error { // extract all variables from the rule body - variables := make(MatchedVariables) - for _, predicate := range r.Body { - for _, term := range predicate.Terms { - v, ok := term.(Variable) - if !ok { - continue - } - variables[v] = nil - } - } + variables := r.collectVariables() + + matchAllExpr := kind == CheckKindAll - combinations := combine(variables, r.Body, r.Expressions, facts, syms) + combinations := combine(variables, r.Body, r.Expressions, facts, syms, matchAllExpr) for res := range combinations { if res.error != nil { @@ -238,8 +235,30 @@ func (r Rule) Apply(facts *FactSet, newFacts *FactSet, syms *SymbolTable) error return nil } +func (r Rule) collectVariables() MatchedVariables { + variables := make(MatchedVariables) + for _, predicate := range r.Body { + for _, term := range predicate.Terms { + v, ok := term.(Variable) + if !ok { + continue + } + variables[v] = nil + } + } + return variables +} + +type CheckKind byte + +const ( + CheckKindOne CheckKind = iota + CheckKindAll +) + type Check struct { - Queries []Rule + CheckKind CheckKind + Queries []Rule } type FactSet []Fact @@ -443,8 +462,15 @@ func (w *World) Query(pred Predicate) *FactSet { } func (w *World) QueryRule(rule Rule, syms *SymbolTable) *FactSet { + return w.QueryRuleExtended(rule, syms, CheckKindOne) +} + +func (w *World) QueryRuleExtended(rule Rule, syms *SymbolTable, kind CheckKind) *FactSet { newFacts := &FactSet{} - rule.Apply(w.facts, newFacts, syms) + err := rule.ApplyExtended(w.facts, newFacts, syms, kind) + if err != nil { // TODO: this check was missing from mainline code. + return &FactSet{} + } return newFacts } @@ -486,7 +512,7 @@ func (m MatchedVariables) Clone() MatchedVariables { return res } -func combine(variables MatchedVariables, predicates []Predicate, expressions []Expression, facts *FactSet, syms *SymbolTable) <-chan struct { +func combine(variables MatchedVariables, predicates []Predicate, expressions []Expression, facts *FactSet, syms *SymbolTable, matchAllExpr bool) <-chan struct { MatchedVariables error } { @@ -577,8 +603,17 @@ func combine(variables MatchedVariables, predicates []Predicate, expressions []E return } if !res.Equal(Bool(true)) { - valid = false - break + if !matchAllExpr { + valid = false + break + } else { + c <- struct { + MatchedVariables + error + }{complete_vars, fmt.Errorf("one or more expressions failed to match")} + + return + } } } diff --git a/datalog/expressions.go b/datalog/expressions.go index ed229c7..f295e5d 100644 --- a/datalog/expressions.go +++ b/datalog/expressions.go @@ -277,6 +277,8 @@ func (op BinaryOp) Print(left, right string) string { out = fmt.Sprintf("%s >= %s", left, right) case BinaryEqual: out = fmt.Sprintf("%s == %s", left, right) + case BinaryNotEqual: + out = fmt.Sprintf("%s != %s", left, right) case BinaryContains: out = fmt.Sprintf("%s.contains(%s)", left, right) case BinaryPrefix: @@ -301,6 +303,12 @@ func (op BinaryOp) Print(left, right string) string { out = fmt.Sprintf("%s.intersection(%s)", left, right) case BinaryUnion: out = fmt.Sprintf("%s.union(%s)", left, right) + case BinaryBitwiseAnd: + out = fmt.Sprintf("%s & %s", left, right) + case BinaryBitwiseOr: + out = fmt.Sprintf("%s | %s", left, right) + case BinaryBitwiseXor: + out = fmt.Sprintf("%s ^ %s", left, right) default: out = fmt.Sprintf("unknown(%s, %s)", left, right) } @@ -332,6 +340,10 @@ const ( BinaryOr BinaryIntersection BinaryUnion + BinaryBitwiseAnd + BinaryBitwiseOr + BinaryBitwiseXor + BinaryNotEqual ) // LessThan returns true when left is less than right. @@ -439,8 +451,7 @@ func (GreaterOrEqual) Eval(left Term, right Term, _ *SymbolTable) (Term, error) } // Equal returns true when left and right are equal. -// It requires left and right to have the same concrete type -// and only accepts Integer, Bytes or String. +// It requires left and right to have the same concrete type. type Equal struct{} func (Equal) Type() BinaryOpType { @@ -466,6 +477,33 @@ func (Equal) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { return Bool(left.Equal(right)), nil } +// NotEqual returns true when left and right are not equal. +// It requires left and right to have the same concrete type. +type NotEqual struct{} + +func (NotEqual) Type() BinaryOpType { + return BinaryNotEqual +} +func (NotEqual) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { + if g, w := left.Type(), right.Type(); g != w { + return nil, fmt.Errorf("datalog: Equal type mismatch: %d != %d", g, w) + } + + switch left.Type() { + case TermTypeInteger: + case TermTypeBytes: + case TermTypeString: + case TermTypeDate: + case TermTypeBool: + case TermTypeSet: + + default: + return nil, fmt.Errorf("datalog: unexpected Equal value type: %d", left.Type()) + } + + return Bool(!left.Equal(right)), nil +} + // Contains returns true when the right value exists in the left Set. // The right value must be an Integer, Bytes, String or Symbol. // The left value must be a Set, containing elements of right type. @@ -792,6 +830,69 @@ func (Or) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { return Bool(bleft || bright), nil } +// BitwiseAnd performs the bitwise and of left and right and returns the result. +// It requires left and right to be Integer. +type BitwiseAnd struct{} + +func (BitwiseAnd) Type() BinaryOpType { + return BinaryBitwiseAnd +} +func (BitwiseAnd) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { + ileft, ok := left.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseAnd requires left value to be an Integer, got %T", left) + } + iright, ok := right.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseAnd requires right value to be an Integer, got %T", right) + } + + res := ileft & iright + return res, nil +} + +// BitwiseOr performs the bitwise or of left and right and returns the result. +// It requires left and right to be Integer. +type BitwiseOr struct{} + +func (BitwiseOr) Type() BinaryOpType { + return BinaryBitwiseOr +} +func (BitwiseOr) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { + ileft, ok := left.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseOr requires left value to be an Integer, got %T", left) + } + iright, ok := right.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseOr requires right value to be an Integer, got %T", right) + } + + res := ileft | iright + return res, nil +} + +// BitwiseXor performs the bitwise xor of left and right and returns the result. +// It requires left and right to be Integer. +type BitwiseXor struct{} + +func (BitwiseXor) Type() BinaryOpType { + return BinaryBitwiseXor +} +func (BitwiseXor) Eval(left Term, right Term, _ *SymbolTable) (Term, error) { + ileft, ok := left.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseXor requires left value to be an Integer, got %T", left) + } + iright, ok := right.(Integer) + if !ok { + return nil, fmt.Errorf("datalog: BitwiseXor requires right value to be an Integer, got %T", right) + } + + res := ileft ^ iright + return res, nil +} + type stack []Term func (s *stack) Push(v Term) error { diff --git a/datalog/expressions_test.go b/datalog/expressions_test.go index 9531e14..c22b2bf 100644 --- a/datalog/expressions_test.go +++ b/datalog/expressions_test.go @@ -57,6 +57,19 @@ func TestUnaryParens(t *testing.T) { require.Equal(t, Integer(9), res) } +func TestUnaryLength(t *testing.T) { + syms := &SymbolTable{} + + ops := Expression{ + Value{syms.Insert("Саша")}, + UnaryOp{Length{}}, + } + + res, err := ops.Evaluate(nil, syms) + require.NoError(t, err) + require.Equal(t, Integer(8), res) // this is the number of bytes (the specification is vague on this point) +} + func TestBinaryLessThan(t *testing.T) { require.Equal(t, BinaryLessThan, LessThan{}.Type()) syms := &SymbolTable{} @@ -425,8 +438,9 @@ func TestBinaryGreaterOrEqual(t *testing.T) { } } -func TestBinaryEqual(t *testing.T) { +func TestBinaryEqualNotEqual(t *testing.T) { require.Equal(t, BinaryEqual, Equal{}.Type()) + require.Equal(t, BinaryNotEqual, NotEqual{}.Type()) syms := &SymbolTable{} testCases := []struct { @@ -488,18 +502,28 @@ func TestBinaryEqual(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - ops := Expression{ + ops1 := Expression{ Value{tc.left}, Value{tc.right}, BinaryOp{Equal{}}, } - res, err := ops.Evaluate(nil, syms) + ops2 := Expression{ + Value{tc.left}, + Value{tc.right}, + BinaryOp{NotEqual{}}, + } + + res1, err1 := ops1.Evaluate(nil, syms) + res2, err2 := ops2.Evaluate(nil, syms) if tc.expectedErr { - require.Error(t, err) + require.Error(t, err1) + require.Error(t, err2) } else { - require.NoError(t, err) - require.Equal(t, tc.res, res) + require.NoError(t, err1) + require.NoError(t, err2) + require.Equal(t, tc.res, res1) + require.Equal(t, !tc.res, res2) } }) } @@ -522,6 +546,12 @@ func TestBinaryContains(t *testing.T) { right: Integer(1), want: Bool(true), }, + { + name: "integer in set, negative", + left: Set{Integer(1), Integer(2), Integer(-3)}, + right: Integer(-3), + want: Bool(true), + }, { name: "string not in set", left: Set{syms.Insert("def"), syms.Insert("ijk")}, @@ -1189,6 +1219,204 @@ func TestBinaryOr(t *testing.T) { } } +func TestBinaryBitwiseAnd(t *testing.T) { + require.Equal(t, BinaryBitwiseAnd, BitwiseAnd{}.Type()) + syms := &SymbolTable{} + + testCases := []struct { + desc string + left Term + right Term + res Term + expectedErr bool + expectedErrType error + }{ + { + desc: "normal and", + left: Integer(5), + right: Integer(3), + res: Integer(1), + }, + { + desc: "16 bit and", + left: Integer(65535), + right: Integer(77), + res: Integer(77), + }, + { + desc: "negative 64-bit", + left: Integer(-1), + right: Integer(77), + res: Integer(77), + }, + { + desc: "invalid left type", + left: syms.Insert("abc"), + right: Integer(-3), + expectedErr: true, + }, + { + desc: "invalid right type", + left: Integer(-3), + right: syms.Insert("abc"), + expectedErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, func(t *testing.T) { + ops := Expression{ + Value{tc.left}, + Value{tc.right}, + BinaryOp{BitwiseAnd{}}, + } + + res, err := ops.Evaluate(nil, syms) + if tc.expectedErr { + if tc.expectedErrType != nil { + require.Equal(t, tc.expectedErrType, errors.Unwrap(err)) + } else { + require.Error(t, err) + } + } else { + require.Equal(t, tc.res, res) + } + }) + } +} + +func TestBinaryBitwiseOr(t *testing.T) { + require.Equal(t, BinaryBitwiseOr, BitwiseOr{}.Type()) + syms := &SymbolTable{} + + testCases := []struct { + desc string + left Term + right Term + res Term + expectedErr bool + expectedErrType error + }{ + { + desc: "normal or", + left: Integer(5), + right: Integer(3), + res: Integer(7), + }, + { + desc: "16 bit or", + left: Integer(65535), + right: Integer(77), + res: Integer(65535), + }, + { + desc: "negative 64-bit", + left: Integer(-1), + right: Integer(77), + res: Integer(-1), + }, + { + desc: "invalid left type", + left: syms.Insert("abc"), + right: Integer(-3), + expectedErr: true, + }, + { + desc: "invalid right type", + left: Integer(-3), + right: syms.Insert("abc"), + expectedErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, func(t *testing.T) { + ops := Expression{ + Value{tc.left}, + Value{tc.right}, + BinaryOp{BitwiseOr{}}, + } + + res, err := ops.Evaluate(nil, syms) + if tc.expectedErr { + if tc.expectedErrType != nil { + require.Equal(t, tc.expectedErrType, errors.Unwrap(err)) + } else { + require.Error(t, err) + } + } else { + require.Equal(t, tc.res, res) + } + }) + } +} + +func TestBinaryBitwiseXor(t *testing.T) { + require.Equal(t, BinaryBitwiseXor, BitwiseXor{}.Type()) + syms := &SymbolTable{} + + testCases := []struct { + desc string + left Term + right Term + res Term + expectedErr bool + expectedErrType error + }{ + { + desc: "normal xor", + left: Integer(5), + right: Integer(3), + res: Integer(6), + }, + { + desc: "16 bit xor", + left: Integer(0xffff), + right: Integer(0x004d), + res: Integer(0xffb2), + }, + { + desc: "negative 64-bit", + left: Integer(-1), + right: Integer(0x004d), + res: Integer(-78), + }, + { + desc: "invalid left type", + left: syms.Insert("abc"), + right: Integer(-3), + expectedErr: true, + }, + { + desc: "invalid right type", + left: Integer(-3), + right: syms.Insert("abc"), + expectedErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, func(t *testing.T) { + ops := Expression{ + Value{tc.left}, + Value{tc.right}, + BinaryOp{BitwiseXor{}}, + } + + res, err := ops.Evaluate(nil, syms) + if tc.expectedErr { + if tc.expectedErrType != nil { + require.Equal(t, tc.expectedErrType, errors.Unwrap(err)) + } else { + require.Error(t, err) + } + } else { + require.Equal(t, tc.res, res) + } + }) + } +} + func TestPrint(t *testing.T) { syms := SymbolTable{} syms.Insert("abc") @@ -1217,6 +1445,11 @@ func TestPrint(t *testing.T) { expr: Expression{Value{Integer(9)}, Value{Integer(4)}, BinaryOp{Mul{}}}, res: "9 * 4", }, + { + desc: "bitwise", + expr: Expression{Value{Integer(9)}, Value{Integer(4)}, BinaryOp{BitwiseXor{}}}, + res: "9 ^ 4", + }, { desc: "parens", expr: Expression{ diff --git a/datalog/symbol.go b/datalog/symbol.go index a0349ce..a56f2a3 100644 --- a/datalog/symbol.go +++ b/datalog/symbol.go @@ -129,12 +129,12 @@ func (t *SymbolTable) SplitOff(at int) *SymbolTable { panic("split index out of bound") } - new := make(SymbolTable, len(*t)-at) - copy(new, (*t)[at:]) + newSlice := make(SymbolTable, len(*t)-at) + copy(newSlice, (*t)[at:]) *t = (*t)[:at] - return &new + return &newSlice } func (t *SymbolTable) Len() int { @@ -178,6 +178,16 @@ func (d SymbolDebugger) Predicate(p Predicate) string { s = "\"" + d.Str(sym) + "\"" } else if variable, ok := id.(Variable); ok { s = "$" + d.Var(variable) + } else if set, ok := id.(Set); ok { + mbrs := make([]string, len(set)) + for j, mbr := range set { + if sym, ok := mbr.(String); ok { + mbrs[j] = "\"" + d.Str(sym) + "\"" + } else { + mbrs[j] = fmt.Sprintf("%v", mbr) + } + } + s = "[" + strings.Join(mbrs, ", ") + "]" } else { s = fmt.Sprintf("%v", id) } @@ -232,7 +242,16 @@ func (d SymbolDebugger) Check(c Check) string { for i, q := range c.Queries { queries[i] = d.CheckQuery(q) } - return fmt.Sprintf("check if %s", strings.Join(queries, " or ")) + var formatStr string + switch c.CheckKind { + case CheckKindOne: + formatStr = "check if %s" + case CheckKindAll: + formatStr = "check all %s" + default: + formatStr = "Error: unknown check %s" + } + return fmt.Sprintf(formatStr, strings.Join(queries, " or ")) } func (d SymbolDebugger) World(w *World) string { diff --git a/example_test.go b/example_test.go index 07aeb31..1168b68 100644 --- a/example_test.go +++ b/example_test.go @@ -118,7 +118,7 @@ func ExampleBiscuit() { } // Output: Token1 length: 251 - // Token2 length: 433 + // Token2 length: 435 // allowed to read /a/file1.txt // forbidden to write /a/file1.txt } diff --git a/parser/GRAMMAR.md b/parser/GRAMMAR.md index 4097819..9564654 100644 --- a/parser/GRAMMAR.md +++ b/parser/GRAMMAR.md @@ -9,7 +9,7 @@ Represents a Datalog type, can be one of: parameter, variable, integer, string, - parameter is delimited by curly brackets: `{param}`. Those are replaced by actual values before evaluation. - variable is prefixed with a `$` sign followed by a string or an unsigned 32bit base-10 integer, e.g. `$0` or `$variable1` - integer is any base-10 int64 -- string is any utf8 character sequence, between double quotes, e.g. `"/path/to/file.txt"` +- string is any utf8 character sequence, between double quotes, e.g. `"/path/to/file.txt"`. A double-quote may be included if preceded by a backslash, `\"` - date is RFC3339 encoded, e.g. `2006-01-02T15:04:05Z` - bytes is an hexadecimal encoded string, prefixed with a `hex:` sequence - boolean is either `true` or `false` @@ -26,21 +26,25 @@ Constraints allows performing checks on a variable, below is the list of availab ### Boolean - Equal: `$b == true` +- Not equal: `$b != false` - Negation: `!$b` - And / Or: `$b || $c && $d` ### Integer - Equal: `$i == 1` +- Not equal: `$i != 1` - Greater than: `$i > 1` - Greater than or equal: `$i >= 1` - Less than: `$i < 1` - Less than or equal: `$i <= 1` - Arithmetic (`*`, `/`, `+`, `-`) +- Bitwise (`&`, `|`, `^`) ### String - Equal: `$s == "abc"` +- Not equal: `$s != "abc"` - Starts with: `$s.starts_with("abc")` - Ends with: `$s.ends_with("abc")` - Regular expression: `$s.matches("^abc\s+def$") ` @@ -50,6 +54,7 @@ Constraints allows performing checks on a variable, below is the list of availab ### Date - Equal: `$date == "2006-01-02T15:04:05Z07:00"` +- Not equal: `$date != "2006-01-02T15:04:05Z07:00"` - Before (strict): `$date < "2006-01-02T15:04:05Z07:00"` - Before: `$date <= "2006-01-02T15:04:05Z07:00"` - After (strict): `$date > "2006-01-02T15:04:05Z07:00"` @@ -58,11 +63,13 @@ Constraints allows performing checks on a variable, below is the list of availab ### Bytes - Equal: `$b == "hex:3df97fb5"` +- Not equal: `$b != "hex:3df97fb5"` - Length: `$b.length()` ### Set - Equal: `$set == ["a", "b"]` +- Not equal: `$set != ["a", "b"]` - Contains (element membership): `$set.contains("a")` - Contains (set inclusion): `$set.contains([a])` - Union: `$set.union(["a"])` @@ -74,14 +81,17 @@ Constraints allows performing checks on a variable, below is the list of availab The operators have the following precedence (highest to lowest): -| Operators | Associativity | -|-----------------------------|------------------| -| `!` (prefix) | not associative | -| `*`, `/` | left-associative | -| `+`, `-` | left-associative | -| `>`, `>=`, `<`, `<=`, `==` | not associative | -| `&&` | left-associative | -| `||` | left-associative | +| Operators | Associativity | +|----------------------------------|-----------------| +| `!` (prefix) | not associative | +| `*`, `/` | left-associative | +| `+`, `-` | left-associative | +| `&` | left-associative | +| `\|` | left-associative | +| `^` | left-associative | +| `>`, `>=`, `<`, `<=`, `==`, `!=` | not associative | +| `&&` | left-associative | +| `\|\|` | left-associative | Parentheses can be used to force precedence (or to make it explicit). diff --git a/parser/grammar.go b/parser/grammar.go index 3c48fcd..0ba5b0e 100644 --- a/parser/grammar.go +++ b/parser/grammar.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "errors" "fmt" + "github.com/biscuit-auth/biscuit-go/v2/datalog" "strconv" "strings" "time" @@ -185,8 +186,23 @@ type Predicate struct { IDs []*Term `"(" (@@ ("," @@)*)* ")"` } +type CheckKind byte + type Check struct { - Queries []*CheckQuery `"check if" @@ ( "or" @@ )*` + CheckKind CheckKind `@("check if" | "check all")` + Queries []*CheckQuery `@@ ( "or" @@ )*` +} + +func (c *CheckKind) Capture(values []string) error { + switch values[0] { + case "check if": + *c = CheckKind(datalog.CheckKindOne) + case "check all": + *c = CheckKind(datalog.CheckKindAll) + default: + return errors.New("check must start with check if or check all") + } + return nil } type CheckQuery struct { @@ -213,6 +229,7 @@ type Term struct { String *string `| @String` Date *string `| @DateTime` Integer *int64 `| @Int` + NegInt *int64 `| "-" @Int` Bool *Bool `| @Bool` Set []*Term `| "[" @@ ("," @@)* "]"` } @@ -238,6 +255,7 @@ const ( OpLessThan OpGreaterThan OpEqual + OpNotEqual OpContains OpPrefix OpSuffix @@ -246,15 +264,19 @@ const ( OpUnion OpLength OpNegate + OpBitwiseAnd + OpBitwiseOr + OpBitwiseXor ) var operatorMap = map[string]Operator{ "+": OpAdd, "-": OpSub, "*": OpMul, "/": OpDiv, "&&": OpAnd, "||": OpOr, "<=": OpLessOrEqual, ">=": OpGreaterOrEqual, "<": OpLessThan, ">": OpGreaterThan, - "==": OpEqual, "!": OpNegate, "contains": OpContains, "starts_with": OpPrefix, "ends_with": OpSuffix, "matches": OpMatches, "intersection": OpIntersection, "union": OpUnion, "length": OpLength} + "==": OpEqual, "!=": OpNotEqual, "!": OpNegate, "contains": OpContains, "starts_with": OpPrefix, "ends_with": OpSuffix, "matches": OpMatches, "intersection": OpIntersection, "union": OpUnion, "length": OpLength, + "&": OpBitwiseAnd, "|": OpBitwiseOr, "^": OpBitwiseXor} -func (o *Operator) Capture(s []string) error { - *o = operatorMap[s[0]] +func (op *Operator) Capture(s []string) error { + *op = operatorMap[s[0]] return nil } @@ -284,7 +306,7 @@ type Expr2 struct { } type OpExpr3 struct { - Operator Operator `@("<=" | ">=" | "<" | ">" | "==")` + Operator Operator `@("<=" | ">=" | "<" | ">" | "==" | "!=")` Expr3 *Expr3 `@@` } @@ -294,7 +316,7 @@ type Expr3 struct { } type OpExpr4 struct { - Operator Operator `@("+" | "-")` + Operator Operator `@("^")` Expr4 *Expr4 `@@` } @@ -304,21 +326,51 @@ type Expr4 struct { } type OpExpr5 struct { - Operator Operator `@("*" | "/")` + Operator Operator `@("|")` Expr5 *Expr5 `@@` } type Expr5 struct { - Operator *Operator `@("!")?` - Expr6 *Expr6 `@@` + Left *Expr6 `@@` + Right []*OpExpr6 `@@*` +} + +type OpExpr6 struct { + Operator Operator `@("&")` + Expr6 *Expr6 `@@` } type Expr6 struct { - Left *ExprTerm `@@` + Left *Expr7 `@@` Right []*OpExpr7 `@@*` } type OpExpr7 struct { + Operator Operator `@("+" | "-")` + Expr7 *Expr7 `@@` +} + +type Expr7 struct { + Left *Expr8 `@@` + Right []*OpExpr8 `@@*` +} + +type OpExpr8 struct { + Operator Operator `@("*" | "/")` + Expr8 *Expr8 `@@` +} + +type Expr8 struct { + Operator *Operator `@("!")?` + Expr9 *Expr9 `@@` +} + +type Expr9 struct { + Left *ExprTerm `@@` + Right []*OpExpr10 `@@*` +} + +type OpExpr10 struct { Operator Operator `Dot @("matches" | "starts_with" | "ends_with" | "contains" | "union" | "intersection" | "length")` Expression *Expression `"(" @@? ")"` } @@ -369,13 +421,37 @@ func (e *Expr4) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { } func (e *Expr5) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { - e.Expr6.ToExpr(expr, parameters) + e.Left.ToExpr(expr, parameters) + + for _, op := range e.Right { + op.ToExpr(expr, parameters) + } +} + +func (e *Expr6) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Left.ToExpr(expr, parameters) + + for _, op := range e.Right { + op.ToExpr(expr, parameters) + } +} + +func (e *Expr7) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Left.ToExpr(expr, parameters) + + for _, op := range e.Right { + op.ToExpr(expr, parameters) + } +} + +func (e *Expr8) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Expr9.ToExpr(expr, parameters) if e.Operator != nil { *expr = append(*expr, biscuit.UnaryNegate) } } -func (e *Expr6) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { +func (e *Expr9) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { e.Left.ToExpr(expr, parameters) for _, op := range e.Right { op.ToExpr(expr, parameters) @@ -421,7 +497,22 @@ func (e *OpExpr5) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { e.Operator.ToExpr(expr) } +func (e *OpExpr6) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Expr6.ToExpr(expr, parameters) + e.Operator.ToExpr(expr) +} + func (e *OpExpr7) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Expr7.ToExpr(expr, parameters) + e.Operator.ToExpr(expr) +} + +func (e *OpExpr8) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { + e.Expr8.ToExpr(expr, parameters) + e.Operator.ToExpr(expr) +} + +func (e *OpExpr10) ToExpr(expr *biscuit.Expression, parameters ParametersMap) { if e.Expression != nil { e.Expression.ToExpr(expr, parameters) } @@ -454,6 +545,8 @@ func (op *Operator) ToExpr(expr *biscuit.Expression) { biscuit_op = biscuit.BinaryGreaterThan case OpEqual: biscuit_op = biscuit.BinaryEqual + case OpNotEqual: + biscuit_op = biscuit.BinaryNotEqual case OpContains: biscuit_op = biscuit.BinaryContains case OpPrefix: @@ -468,6 +561,14 @@ func (op *Operator) ToExpr(expr *biscuit.Expression) { biscuit_op = biscuit.BinaryIntersection case OpUnion: biscuit_op = biscuit.BinaryUnion + case OpBitwiseAnd: + biscuit_op = biscuit.BinaryBitwiseAnd + case OpBitwiseOr: + biscuit_op = biscuit.BinaryBitwiseOr + case OpBitwiseXor: + biscuit_op = biscuit.BinaryBitwiseXor + case OpNegate: + biscuit_op = biscuit.UnaryNegate } *expr = append(*expr, biscuit_op) @@ -521,6 +622,8 @@ func (a *Term) ToBiscuit(parameters ParametersMap) (biscuit.Term, error) { switch { case a.Integer != nil: biscuitTerm = biscuit.Integer(*a.Integer) + case a.NegInt != nil: + biscuitTerm = biscuit.Integer(-*a.Integer) case a.String != nil: biscuitTerm = biscuit.String(*a.String) case a.Variable != nil: @@ -616,7 +719,8 @@ func (c *Check) ToBiscuit(parameters ParametersMap) (*biscuit.Check, error) { } return &biscuit.Check{ - Queries: queries, + CheckKind: datalog.CheckKind(c.CheckKind), + Queries: queries, }, nil } diff --git a/parser/grammar_test.go b/parser/grammar_test.go index b3ce48e..8244481 100644 --- a/parser/grammar_test.go +++ b/parser/grammar_test.go @@ -1,6 +1,7 @@ package parser import ( + "github.com/biscuit-auth/biscuit-go/v2/datalog" "testing" "time" @@ -95,6 +96,16 @@ func TestGrammarPredicate(t *testing.T) { }, }, }, + { + Input: `right($1, [33, -5])`, + Expected: &Predicate{ + Name: sptr("right"), + IDs: []*Term{ + {Variable: varptr("1")}, + {Set: []*Term{{Integer: i64ptr(33)}, {NegInt: i64ptr(5)}}}, + }, + }, + }, { Input: `right($1, true, false)`, Expected: &Predicate{ @@ -130,6 +141,46 @@ func TestExprTerm(t *testing.T) { }, parsed) } +func TestGrammarTerm(t *testing.T) { + parser, err := participle.Build[Term](DefaultParserOptions...) + require.NoError(t, err) + + testCases := []struct { + Title string + Input string + Expected *Term + }{ + { + Title: "integer", + Input: `33`, + Expected: &Term{Integer: i64ptr(33)}, + }, + { + Title: "string", + Input: `"abc"`, + Expected: &Term{String: sptr("abc")}, + }, + { + Title: "Unicode string", + Input: `"Миша"`, + Expected: &Term{String: sptr("Миша")}, + }, + { + Title: "quoted double quotes", + Input: `"before \" after"`, + Expected: &Term{String: sptr("before \" after")}, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.Input, func(t *testing.T) { + parsed, err := parser.ParseString("test", testCase.Input) + require.NoError(t, err) + require.Equal(t, testCase.Expected, parsed) + }) + } +} + func TestGrammarExpression(t *testing.T) { parser, err := participle.Build[Expression](DefaultParserOptions...) require.NoError(t, err) @@ -174,6 +225,26 @@ func TestGrammarExpression(t *testing.T) { biscuit.BinaryLessThan, }, }, + { + Input: `$0 < 1 + 2`, + Expected: &biscuit.Expression{ + biscuit.Value{Term: biscuit.Variable("0")}, + biscuit.Value{Term: biscuit.Integer(1)}, + biscuit.Value{Term: biscuit.Integer(2)}, + biscuit.BinaryAdd, + biscuit.BinaryLessThan, + }, + }, + { + Input: `$0 < 1 & 2`, + Expected: &biscuit.Expression{ + biscuit.Value{Term: biscuit.Variable("0")}, + biscuit.Value{Term: biscuit.Integer(1)}, + biscuit.Value{Term: biscuit.Integer(2)}, + biscuit.BinaryBitwiseAnd, + biscuit.BinaryLessThan, + }, + }, { Input: `$0 <= 1`, Expected: &biscuit.Expression{ @@ -238,6 +309,13 @@ func TestGrammarExpression(t *testing.T) { biscuit.BinaryRegex, }, }, + { + Input: `$0.length() `, + Expected: &biscuit.Expression{ + biscuit.Value{Term: biscuit.Variable("0")}, + biscuit.UnaryLength, + }, + }, { Input: `["abc", "def"].contains($0)`, Expected: &biscuit.Expression{ @@ -311,6 +389,14 @@ func TestGrammarExpression(t *testing.T) { biscuit.BinaryEqual, }, }, + { + Input: `hex:12ab != hex:ab`, + Expected: &biscuit.Expression{ + biscuit.Value{Term: biscuit.Bytes([]byte{0x12, 0xab})}, + biscuit.Value{Term: biscuit.Bytes([]byte{0xab})}, + biscuit.BinaryNotEqual, + }, + }, { Input: `{param1} + {param2} * {param3} == {param4} || {param5}`, Params: map[string]biscuit.Term{ @@ -358,6 +444,39 @@ func TestGrammarCheck(t *testing.T) { { Input: `check if parent("a", "b"), parent("b", "c")`, Expected: &Check{ + CheckKind: CheckKind(datalog.CheckKindOne), + Queries: []*CheckQuery{ + { + Body: []*RuleElement{ + { + Predicate: &Predicate{ + + Name: sptr("parent"), + IDs: []*Term{ + {String: sptr("a")}, + {String: sptr("b")}, + }, + }, + }, + { + Predicate: &Predicate{ + + Name: sptr("parent"), + IDs: []*Term{ + {String: sptr("b")}, + {String: sptr("c")}, + }, + }, + }, + }, + }, + }, + }, + }, + { + Input: `check all parent("a", "b"), parent("b", "c")`, + Expected: &Check{ + CheckKind: CheckKind(datalog.CheckKindAll), Queries: []*CheckQuery{ { Body: []*RuleElement{ @@ -389,6 +508,7 @@ func TestGrammarCheck(t *testing.T) { { Input: `check if parent("a", "b"), parent("b", "c")`, Expected: &Check{ + CheckKind: CheckKind(datalog.CheckKindOne), Queries: []*CheckQuery{ { Body: []*RuleElement{ @@ -418,6 +538,7 @@ func TestGrammarCheck(t *testing.T) { { Input: `check if parent("a", "b"), parent("b", "c") or parent("a", "b"), parent("b", "c"), $0 > 42, $1.starts_with("test")`, Expected: &Check{ + CheckKind: CheckKind(datalog.CheckKindOne), Queries: []*CheckQuery{ { Body: []*RuleElement{ @@ -468,10 +589,16 @@ func TestGrammarCheck(t *testing.T) { Left: &Expr3{ Left: &Expr4{ Left: &Expr5{ - Expr6: &Expr6{ - Left: &ExprTerm{ - Term: &Term{ - Variable: varptr("0"), + Left: &Expr6{ + Left: &Expr7{ + Left: &Expr8{ + Expr9: &Expr9{ + Left: &ExprTerm{ + Term: &Term{ + Variable: varptr("0"), + }, + }, + }, }, }, }, @@ -483,10 +610,16 @@ func TestGrammarCheck(t *testing.T) { Expr3: &Expr3{ Left: &Expr4{ Left: &Expr5{ - Expr6: &Expr6{ - Left: &ExprTerm{ - Term: &Term{ - Integer: i64ptr(42), + Left: &Expr6{ + Left: &Expr7{ + Left: &Expr8{ + Expr9: &Expr9{ + Left: &ExprTerm{ + Term: &Term{ + Integer: i64ptr(42), + }, + }, + }, }, }, }, @@ -505,25 +638,37 @@ func TestGrammarCheck(t *testing.T) { Left: &Expr3{ Left: &Expr4{ Left: &Expr5{ - Expr6: &Expr6{ - Left: &ExprTerm{ - Term: &Term{ - Variable: varptr("1"), - }, - }, - Right: []*OpExpr7{ - { - Operator: OpPrefix, - Expression: &Expression{ - Left: &Expr1{ - Left: &Expr2{ - Left: &Expr3{ - Left: &Expr4{ - Left: &Expr5{ - Expr6: &Expr6{ - Left: &ExprTerm{ - Term: &Term{ - String: sptr("test"), + Left: &Expr6{ + Left: &Expr7{ + Left: &Expr8{ + Expr9: &Expr9{ + Left: &ExprTerm{ + Term: &Term{ + Variable: varptr("1"), + }, + }, + Right: []*OpExpr10{ + { + Operator: OpPrefix, + Expression: &Expression{ + Left: &Expr1{ + Left: &Expr2{ + Left: &Expr3{ + Left: &Expr4{ + Left: &Expr5{ + Left: &Expr6{ + Left: &Expr7{ + Left: &Expr8{ + Expr9: &Expr9{ + Left: &ExprTerm{ + Term: &Term{ + String: sptr("test"), + }, + }, + }, + }, + }, + }, }, }, }, @@ -558,6 +703,25 @@ func TestGrammarCheck(t *testing.T) { } } +func TestGrammarCheckMinimal(t *testing.T) { + parser, err := participle.Build[Check](DefaultParserOptions...) + require.NoError(t, err) + + testCases := []struct { + Input string + }{ + {Input: "check if -922 != 0"}, + {Input: "check if 100-200 != 0"}, + } + for _, testCase := range testCases { + t.Run(testCase.Input, func(t *testing.T) { + parsed, err := parser.ParseString("test", testCase.Input) + _ = parsed + require.NoError(t, err) + }) + } +} + func TestGrammarBlock(t *testing.T) { parser, err := participle.Build[Block](DefaultParserOptions...) require.NoError(t, err) diff --git a/parser/parser.go b/parser/parser.go index 7571cde..dce58ca 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -14,16 +14,16 @@ var ( ) var BiscuitLexerRules = []lexer.SimpleRule{ - {Name: "Keyword", Pattern: `check if|allow if|deny if`}, + {Name: "Keyword", Pattern: `check if|check all|allow if|deny if`}, {Name: "Function", Pattern: `prefix|suffix|matches|length|contains`}, {Name: "Hex", Pattern: `hex:([0-9a-fA-F]{2})*`}, {Name: "Dot", Pattern: `\.`}, {Name: "Arrow", Pattern: `<-`}, {Name: "Or", Pattern: `\|\|`}, {Name: "And", Pattern: `&&`}, - {Name: "Operator", Pattern: `==|>=|<=|>|<|\+|-|\*`}, + {Name: "Operator", Pattern: `==|!=|>=|<=|>|<|\+|-|\*|&|\||\^`}, {Name: "Comment", Pattern: `//[^\n]*`}, - {Name: "String", Pattern: `\"[^\"]*\"`}, + {Name: "String", Pattern: `\"(\\"|[^\"])*\"`}, {Name: "Variable", Pattern: `\$[a-zA-Z0-9_:]+`}, {Name: "Parameter", Pattern: `\{[a-zA-Z0-9_:]+\}`}, {Name: "DateTime", Pattern: `\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(Z|([-+]\d\d:\d\d))?`}, diff --git a/pb/biscuit.pb.go b/pb/biscuit.pb.go index ccc6fa4..894bec1 100644 --- a/pb/biscuit.pb.go +++ b/pb/biscuit.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.4 +// protoc-gen-go v1.33.0 +// protoc v5.26.1 // source: biscuit.proto package pb @@ -70,7 +70,119 @@ func (x *PublicKey_Algorithm) UnmarshalJSON(b []byte) error { // Deprecated: Use PublicKey_Algorithm.Descriptor instead. func (PublicKey_Algorithm) EnumDescriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{2, 0} + return file_biscuit_proto_rawDescGZIP(), []int{3, 0} +} + +type Scope_ScopeType int32 + +const ( + Scope_Authority Scope_ScopeType = 0 + Scope_Previous Scope_ScopeType = 1 +) + +// Enum value maps for Scope_ScopeType. +var ( + Scope_ScopeType_name = map[int32]string{ + 0: "Authority", + 1: "Previous", + } + Scope_ScopeType_value = map[string]int32{ + "Authority": 0, + "Previous": 1, + } +) + +func (x Scope_ScopeType) Enum() *Scope_ScopeType { + p := new(Scope_ScopeType) + *p = x + return p +} + +func (x Scope_ScopeType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Scope_ScopeType) Descriptor() protoreflect.EnumDescriptor { + return file_biscuit_proto_enumTypes[1].Descriptor() +} + +func (Scope_ScopeType) Type() protoreflect.EnumType { + return &file_biscuit_proto_enumTypes[1] +} + +func (x Scope_ScopeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Scope_ScopeType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Scope_ScopeType(num) + return nil +} + +// Deprecated: Use Scope_ScopeType.Descriptor instead. +func (Scope_ScopeType) EnumDescriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{6, 0} +} + +type CheckV2_Kind int32 + +const ( + CheckV2_One CheckV2_Kind = 0 + CheckV2_All CheckV2_Kind = 1 +) + +// Enum value maps for CheckV2_Kind. +var ( + CheckV2_Kind_name = map[int32]string{ + 0: "One", + 1: "All", + } + CheckV2_Kind_value = map[string]int32{ + "One": 0, + "All": 1, + } +) + +func (x CheckV2_Kind) Enum() *CheckV2_Kind { + p := new(CheckV2_Kind) + *p = x + return p +} + +func (x CheckV2_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CheckV2_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_biscuit_proto_enumTypes[2].Descriptor() +} + +func (CheckV2_Kind) Type() protoreflect.EnumType { + return &file_biscuit_proto_enumTypes[2] +} + +func (x CheckV2_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *CheckV2_Kind) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = CheckV2_Kind(num) + return nil +} + +// Deprecated: Use CheckV2_Kind.Descriptor instead. +func (CheckV2_Kind) EnumDescriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{9, 0} } type OpUnary_Kind int32 @@ -106,11 +218,11 @@ func (x OpUnary_Kind) String() string { } func (OpUnary_Kind) Descriptor() protoreflect.EnumDescriptor { - return file_biscuit_proto_enumTypes[1].Descriptor() + return file_biscuit_proto_enumTypes[3].Descriptor() } func (OpUnary_Kind) Type() protoreflect.EnumType { - return &file_biscuit_proto_enumTypes[1] + return &file_biscuit_proto_enumTypes[3] } func (x OpUnary_Kind) Number() protoreflect.EnumNumber { @@ -129,7 +241,7 @@ func (x *OpUnary_Kind) UnmarshalJSON(b []byte) error { // Deprecated: Use OpUnary_Kind.Descriptor instead. func (OpUnary_Kind) EnumDescriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{13, 0} + return file_biscuit_proto_rawDescGZIP(), []int{15, 0} } type OpBinary_Kind int32 @@ -152,6 +264,10 @@ const ( OpBinary_Or OpBinary_Kind = 14 OpBinary_Intersection OpBinary_Kind = 15 OpBinary_Union OpBinary_Kind = 16 + OpBinary_BitwiseAnd OpBinary_Kind = 17 + OpBinary_BitwiseOr OpBinary_Kind = 18 + OpBinary_BitwiseXor OpBinary_Kind = 19 + OpBinary_NotEqual OpBinary_Kind = 20 ) // Enum value maps for OpBinary_Kind. @@ -174,6 +290,10 @@ var ( 14: "Or", 15: "Intersection", 16: "Union", + 17: "BitwiseAnd", + 18: "BitwiseOr", + 19: "BitwiseXor", + 20: "NotEqual", } OpBinary_Kind_value = map[string]int32{ "LessThan": 0, @@ -193,6 +313,10 @@ var ( "Or": 14, "Intersection": 15, "Union": 16, + "BitwiseAnd": 17, + "BitwiseOr": 18, + "BitwiseXor": 19, + "NotEqual": 20, } ) @@ -207,11 +331,11 @@ func (x OpBinary_Kind) String() string { } func (OpBinary_Kind) Descriptor() protoreflect.EnumDescriptor { - return file_biscuit_proto_enumTypes[2].Descriptor() + return file_biscuit_proto_enumTypes[4].Descriptor() } func (OpBinary_Kind) Type() protoreflect.EnumType { - return &file_biscuit_proto_enumTypes[2] + return &file_biscuit_proto_enumTypes[4] } func (x OpBinary_Kind) Number() protoreflect.EnumNumber { @@ -230,7 +354,7 @@ func (x *OpBinary_Kind) UnmarshalJSON(b []byte) error { // Deprecated: Use OpBinary_Kind.Descriptor instead. func (OpBinary_Kind) EnumDescriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{14, 0} + return file_biscuit_proto_rawDescGZIP(), []int{16, 0} } type Policy_Kind int32 @@ -263,11 +387,11 @@ func (x Policy_Kind) String() string { } func (Policy_Kind) Descriptor() protoreflect.EnumDescriptor { - return file_biscuit_proto_enumTypes[3].Descriptor() + return file_biscuit_proto_enumTypes[5].Descriptor() } func (Policy_Kind) Type() protoreflect.EnumType { - return &file_biscuit_proto_enumTypes[3] + return &file_biscuit_proto_enumTypes[5] } func (x Policy_Kind) Number() protoreflect.EnumNumber { @@ -286,7 +410,7 @@ func (x *Policy_Kind) UnmarshalJSON(b []byte) error { // Deprecated: Use Policy_Kind.Descriptor instead. func (Policy_Kind) EnumDescriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{15, 0} + return file_biscuit_proto_rawDescGZIP(), []int{17, 0} } type Biscuit struct { @@ -365,9 +489,10 @@ type SignedBlock struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Block []byte `protobuf:"bytes,1,req,name=block" json:"block,omitempty"` - NextKey *PublicKey `protobuf:"bytes,2,req,name=nextKey" json:"nextKey,omitempty"` - Signature []byte `protobuf:"bytes,3,req,name=signature" json:"signature,omitempty"` + Block []byte `protobuf:"bytes,1,req,name=block" json:"block,omitempty"` + NextKey *PublicKey `protobuf:"bytes,2,req,name=nextKey" json:"nextKey,omitempty"` + Signature []byte `protobuf:"bytes,3,req,name=signature" json:"signature,omitempty"` + ExternalSignature *ExternalSignature `protobuf:"bytes,4,opt,name=externalSignature" json:"externalSignature,omitempty"` } func (x *SignedBlock) Reset() { @@ -423,19 +548,81 @@ func (x *SignedBlock) GetSignature() []byte { return nil } +func (x *SignedBlock) GetExternalSignature() *ExternalSignature { + if x != nil { + return x.ExternalSignature + } + return nil +} + +type ExternalSignature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signature []byte `protobuf:"bytes,1,req,name=signature" json:"signature,omitempty"` + PublicKey *PublicKey `protobuf:"bytes,2,req,name=publicKey" json:"publicKey,omitempty"` +} + +func (x *ExternalSignature) Reset() { + *x = ExternalSignature{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalSignature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalSignature) ProtoMessage() {} + +func (x *ExternalSignature) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalSignature.ProtoReflect.Descriptor instead. +func (*ExternalSignature) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{2} +} + +func (x *ExternalSignature) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *ExternalSignature) GetPublicKey() *PublicKey { + if x != nil { + return x.PublicKey + } + return nil +} + type PublicKey struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Algorithm *PublicKey_Algorithm `protobuf:"varint,1,req,name=algorithm,enum=PublicKey_Algorithm" json:"algorithm,omitempty"` + Algorithm *PublicKey_Algorithm `protobuf:"varint,1,req,name=algorithm,enum=biscuit.format.schema.PublicKey_Algorithm" json:"algorithm,omitempty"` Key []byte `protobuf:"bytes,2,req,name=key" json:"key,omitempty"` } func (x *PublicKey) Reset() { *x = PublicKey{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[2] + mi := &file_biscuit_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -448,7 +635,7 @@ func (x *PublicKey) String() string { func (*PublicKey) ProtoMessage() {} func (x *PublicKey) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[2] + mi := &file_biscuit_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -461,7 +648,7 @@ func (x *PublicKey) ProtoReflect() protoreflect.Message { // Deprecated: Use PublicKey.ProtoReflect.Descriptor instead. func (*PublicKey) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{2} + return file_biscuit_proto_rawDescGZIP(), []int{3} } func (x *PublicKey) GetAlgorithm() PublicKey_Algorithm { @@ -484,6 +671,7 @@ type Proof struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Content: + // // *Proof_NextSecret // *Proof_FinalSignature Content isProof_Content `protobuf_oneof:"Content"` @@ -492,7 +680,7 @@ type Proof struct { func (x *Proof) Reset() { *x = Proof{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[3] + mi := &file_biscuit_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -505,7 +693,7 @@ func (x *Proof) String() string { func (*Proof) ProtoMessage() {} func (x *Proof) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[3] + mi := &file_biscuit_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -518,7 +706,7 @@ func (x *Proof) ProtoReflect() protoreflect.Message { // Deprecated: Use Proof.ProtoReflect.Descriptor instead. func (*Proof) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{3} + return file_biscuit_proto_rawDescGZIP(), []int{4} } func (m *Proof) GetContent() isProof_Content { @@ -563,18 +751,20 @@ type Block struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Symbols []string `protobuf:"bytes,1,rep,name=symbols" json:"symbols,omitempty"` - Context *string `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` - Version *uint32 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"` - FactsV2 []*FactV2 `protobuf:"bytes,4,rep,name=facts_v2,json=factsV2" json:"facts_v2,omitempty"` - RulesV2 []*RuleV2 `protobuf:"bytes,5,rep,name=rules_v2,json=rulesV2" json:"rules_v2,omitempty"` - ChecksV2 []*CheckV2 `protobuf:"bytes,6,rep,name=checks_v2,json=checksV2" json:"checks_v2,omitempty"` + Symbols []string `protobuf:"bytes,1,rep,name=symbols" json:"symbols,omitempty"` + Context *string `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` + Version *uint32 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"` + FactsV2 []*FactV2 `protobuf:"bytes,4,rep,name=facts_v2,json=factsV2" json:"facts_v2,omitempty"` + RulesV2 []*RuleV2 `protobuf:"bytes,5,rep,name=rules_v2,json=rulesV2" json:"rules_v2,omitempty"` + ChecksV2 []*CheckV2 `protobuf:"bytes,6,rep,name=checks_v2,json=checksV2" json:"checks_v2,omitempty"` + Scope []*Scope `protobuf:"bytes,7,rep,name=scope" json:"scope,omitempty"` + PublicKeys []*PublicKey `protobuf:"bytes,8,rep,name=publicKeys" json:"publicKeys,omitempty"` } func (x *Block) Reset() { *x = Block{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[4] + mi := &file_biscuit_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -587,7 +777,7 @@ func (x *Block) String() string { func (*Block) ProtoMessage() {} func (x *Block) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[4] + mi := &file_biscuit_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -600,7 +790,7 @@ func (x *Block) ProtoReflect() protoreflect.Message { // Deprecated: Use Block.ProtoReflect.Descriptor instead. func (*Block) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{4} + return file_biscuit_proto_rawDescGZIP(), []int{5} } func (x *Block) GetSymbols() []string { @@ -645,6 +835,101 @@ func (x *Block) GetChecksV2() []*CheckV2 { return nil } +func (x *Block) GetScope() []*Scope { + if x != nil { + return x.Scope + } + return nil +} + +func (x *Block) GetPublicKeys() []*PublicKey { + if x != nil { + return x.PublicKeys + } + return nil +} + +type Scope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Content: + // + // *Scope_ScopeType_ + // *Scope_PublicKey + Content isScope_Content `protobuf_oneof:"Content"` +} + +func (x *Scope) Reset() { + *x = Scope{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Scope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scope) ProtoMessage() {} + +func (x *Scope) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Scope.ProtoReflect.Descriptor instead. +func (*Scope) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{6} +} + +func (m *Scope) GetContent() isScope_Content { + if m != nil { + return m.Content + } + return nil +} + +func (x *Scope) GetScopeType() Scope_ScopeType { + if x, ok := x.GetContent().(*Scope_ScopeType_); ok { + return x.ScopeType + } + return Scope_Authority +} + +func (x *Scope) GetPublicKey() int64 { + if x, ok := x.GetContent().(*Scope_PublicKey); ok { + return x.PublicKey + } + return 0 +} + +type isScope_Content interface { + isScope_Content() +} + +type Scope_ScopeType_ struct { + ScopeType Scope_ScopeType `protobuf:"varint,1,opt,name=scopeType,enum=biscuit.format.schema.Scope_ScopeType,oneof"` +} + +type Scope_PublicKey struct { + PublicKey int64 `protobuf:"varint,2,opt,name=publicKey,oneof"` +} + +func (*Scope_ScopeType_) isScope_Content() {} + +func (*Scope_PublicKey) isScope_Content() {} + type FactV2 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -656,7 +941,7 @@ type FactV2 struct { func (x *FactV2) Reset() { *x = FactV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[5] + mi := &file_biscuit_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -669,7 +954,7 @@ func (x *FactV2) String() string { func (*FactV2) ProtoMessage() {} func (x *FactV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[5] + mi := &file_biscuit_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -682,7 +967,7 @@ func (x *FactV2) ProtoReflect() protoreflect.Message { // Deprecated: Use FactV2.ProtoReflect.Descriptor instead. func (*FactV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{5} + return file_biscuit_proto_rawDescGZIP(), []int{7} } func (x *FactV2) GetPredicate() *PredicateV2 { @@ -700,12 +985,13 @@ type RuleV2 struct { Head *PredicateV2 `protobuf:"bytes,1,req,name=head" json:"head,omitempty"` Body []*PredicateV2 `protobuf:"bytes,2,rep,name=body" json:"body,omitempty"` Expressions []*ExpressionV2 `protobuf:"bytes,3,rep,name=expressions" json:"expressions,omitempty"` + Scope []*Scope `protobuf:"bytes,4,rep,name=scope" json:"scope,omitempty"` } func (x *RuleV2) Reset() { *x = RuleV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[6] + mi := &file_biscuit_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -718,7 +1004,7 @@ func (x *RuleV2) String() string { func (*RuleV2) ProtoMessage() {} func (x *RuleV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[6] + mi := &file_biscuit_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -731,7 +1017,7 @@ func (x *RuleV2) ProtoReflect() protoreflect.Message { // Deprecated: Use RuleV2.ProtoReflect.Descriptor instead. func (*RuleV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{6} + return file_biscuit_proto_rawDescGZIP(), []int{8} } func (x *RuleV2) GetHead() *PredicateV2 { @@ -755,18 +1041,26 @@ func (x *RuleV2) GetExpressions() []*ExpressionV2 { return nil } +func (x *RuleV2) GetScope() []*Scope { + if x != nil { + return x.Scope + } + return nil +} + type CheckV2 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Queries []*RuleV2 `protobuf:"bytes,1,rep,name=queries" json:"queries,omitempty"` + Queries []*RuleV2 `protobuf:"bytes,1,rep,name=queries" json:"queries,omitempty"` + Kind *CheckV2_Kind `protobuf:"varint,2,opt,name=kind,enum=biscuit.format.schema.CheckV2_Kind" json:"kind,omitempty"` } func (x *CheckV2) Reset() { *x = CheckV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[7] + mi := &file_biscuit_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -779,7 +1073,7 @@ func (x *CheckV2) String() string { func (*CheckV2) ProtoMessage() {} func (x *CheckV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[7] + mi := &file_biscuit_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -792,7 +1086,7 @@ func (x *CheckV2) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckV2.ProtoReflect.Descriptor instead. func (*CheckV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{7} + return file_biscuit_proto_rawDescGZIP(), []int{9} } func (x *CheckV2) GetQueries() []*RuleV2 { @@ -802,6 +1096,13 @@ func (x *CheckV2) GetQueries() []*RuleV2 { return nil } +func (x *CheckV2) GetKind() CheckV2_Kind { + if x != nil && x.Kind != nil { + return *x.Kind + } + return CheckV2_One +} + type PredicateV2 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -814,7 +1115,7 @@ type PredicateV2 struct { func (x *PredicateV2) Reset() { *x = PredicateV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[8] + mi := &file_biscuit_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -827,7 +1128,7 @@ func (x *PredicateV2) String() string { func (*PredicateV2) ProtoMessage() {} func (x *PredicateV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[8] + mi := &file_biscuit_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -840,7 +1141,7 @@ func (x *PredicateV2) ProtoReflect() protoreflect.Message { // Deprecated: Use PredicateV2.ProtoReflect.Descriptor instead. func (*PredicateV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{8} + return file_biscuit_proto_rawDescGZIP(), []int{10} } func (x *PredicateV2) GetName() uint64 { @@ -863,6 +1164,7 @@ type TermV2 struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Content: + // // *TermV2_Variable // *TermV2_Integer // *TermV2_String_ @@ -876,7 +1178,7 @@ type TermV2 struct { func (x *TermV2) Reset() { *x = TermV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[9] + mi := &file_biscuit_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -889,7 +1191,7 @@ func (x *TermV2) String() string { func (*TermV2) ProtoMessage() {} func (x *TermV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[9] + mi := &file_biscuit_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -902,7 +1204,7 @@ func (x *TermV2) ProtoReflect() protoreflect.Message { // Deprecated: Use TermV2.ProtoReflect.Descriptor instead. func (*TermV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{9} + return file_biscuit_proto_rawDescGZIP(), []int{11} } func (m *TermV2) GetContent() isTermV2_Content { @@ -1018,7 +1320,7 @@ type TermSet struct { func (x *TermSet) Reset() { *x = TermSet{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[10] + mi := &file_biscuit_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1031,7 +1333,7 @@ func (x *TermSet) String() string { func (*TermSet) ProtoMessage() {} func (x *TermSet) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[10] + mi := &file_biscuit_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1044,7 +1346,7 @@ func (x *TermSet) ProtoReflect() protoreflect.Message { // Deprecated: Use TermSet.ProtoReflect.Descriptor instead. func (*TermSet) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{10} + return file_biscuit_proto_rawDescGZIP(), []int{12} } func (x *TermSet) GetSet() []*TermV2 { @@ -1065,7 +1367,7 @@ type ExpressionV2 struct { func (x *ExpressionV2) Reset() { *x = ExpressionV2{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[11] + mi := &file_biscuit_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1078,7 +1380,7 @@ func (x *ExpressionV2) String() string { func (*ExpressionV2) ProtoMessage() {} func (x *ExpressionV2) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[11] + mi := &file_biscuit_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1091,7 +1393,7 @@ func (x *ExpressionV2) ProtoReflect() protoreflect.Message { // Deprecated: Use ExpressionV2.ProtoReflect.Descriptor instead. func (*ExpressionV2) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{11} + return file_biscuit_proto_rawDescGZIP(), []int{13} } func (x *ExpressionV2) GetOps() []*Op { @@ -1107,6 +1409,7 @@ type Op struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Content: + // // *Op_Value // *Op_Unary // *Op_Binary @@ -1116,7 +1419,7 @@ type Op struct { func (x *Op) Reset() { *x = Op{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[12] + mi := &file_biscuit_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1129,7 +1432,7 @@ func (x *Op) String() string { func (*Op) ProtoMessage() {} func (x *Op) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[12] + mi := &file_biscuit_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1142,7 +1445,7 @@ func (x *Op) ProtoReflect() protoreflect.Message { // Deprecated: Use Op.ProtoReflect.Descriptor instead. func (*Op) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{12} + return file_biscuit_proto_rawDescGZIP(), []int{14} } func (m *Op) GetContent() isOp_Content { @@ -1195,31 +1498,610 @@ func (*Op_Unary) isOp_Content() {} func (*Op_Binary) isOp_Content() {} -type OpUnary struct { +type OpUnary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kind *OpUnary_Kind `protobuf:"varint,1,req,name=kind,enum=biscuit.format.schema.OpUnary_Kind" json:"kind,omitempty"` +} + +func (x *OpUnary) Reset() { + *x = OpUnary{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpUnary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpUnary) ProtoMessage() {} + +func (x *OpUnary) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpUnary.ProtoReflect.Descriptor instead. +func (*OpUnary) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{15} +} + +func (x *OpUnary) GetKind() OpUnary_Kind { + if x != nil && x.Kind != nil { + return *x.Kind + } + return OpUnary_Negate +} + +type OpBinary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kind *OpBinary_Kind `protobuf:"varint,1,req,name=kind,enum=biscuit.format.schema.OpBinary_Kind" json:"kind,omitempty"` +} + +func (x *OpBinary) Reset() { + *x = OpBinary{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpBinary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpBinary) ProtoMessage() {} + +func (x *OpBinary) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OpBinary.ProtoReflect.Descriptor instead. +func (*OpBinary) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{16} +} + +func (x *OpBinary) GetKind() OpBinary_Kind { + if x != nil && x.Kind != nil { + return *x.Kind + } + return OpBinary_LessThan +} + +type Policy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Queries []*RuleV2 `protobuf:"bytes,1,rep,name=queries" json:"queries,omitempty"` + Kind *Policy_Kind `protobuf:"varint,2,req,name=kind,enum=biscuit.format.schema.Policy_Kind" json:"kind,omitempty"` +} + +func (x *Policy) Reset() { + *x = Policy{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Policy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Policy) ProtoMessage() {} + +func (x *Policy) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Policy.ProtoReflect.Descriptor instead. +func (*Policy) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{17} +} + +func (x *Policy) GetQueries() []*RuleV2 { + if x != nil { + return x.Queries + } + return nil +} + +func (x *Policy) GetKind() Policy_Kind { + if x != nil && x.Kind != nil { + return *x.Kind + } + return Policy_Allow +} + +type AuthorizerPolicies struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Symbols []string `protobuf:"bytes,1,rep,name=symbols" json:"symbols,omitempty"` + Version *uint32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"` + Facts []*FactV2 `protobuf:"bytes,3,rep,name=facts" json:"facts,omitempty"` + Rules []*RuleV2 `protobuf:"bytes,4,rep,name=rules" json:"rules,omitempty"` + Checks []*CheckV2 `protobuf:"bytes,5,rep,name=checks" json:"checks,omitempty"` + Policies []*Policy `protobuf:"bytes,6,rep,name=policies" json:"policies,omitempty"` +} + +func (x *AuthorizerPolicies) Reset() { + *x = AuthorizerPolicies{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthorizerPolicies) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthorizerPolicies) ProtoMessage() {} + +func (x *AuthorizerPolicies) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthorizerPolicies.ProtoReflect.Descriptor instead. +func (*AuthorizerPolicies) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{18} +} + +func (x *AuthorizerPolicies) GetSymbols() []string { + if x != nil { + return x.Symbols + } + return nil +} + +func (x *AuthorizerPolicies) GetVersion() uint32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *AuthorizerPolicies) GetFacts() []*FactV2 { + if x != nil { + return x.Facts + } + return nil +} + +func (x *AuthorizerPolicies) GetRules() []*RuleV2 { + if x != nil { + return x.Rules + } + return nil +} + +func (x *AuthorizerPolicies) GetChecks() []*CheckV2 { + if x != nil { + return x.Checks + } + return nil +} + +func (x *AuthorizerPolicies) GetPolicies() []*Policy { + if x != nil { + return x.Policies + } + return nil +} + +type ThirdPartyBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PreviousKey *PublicKey `protobuf:"bytes,1,req,name=previousKey" json:"previousKey,omitempty"` + PublicKeys []*PublicKey `protobuf:"bytes,2,rep,name=publicKeys" json:"publicKeys,omitempty"` +} + +func (x *ThirdPartyBlockRequest) Reset() { + *x = ThirdPartyBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ThirdPartyBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ThirdPartyBlockRequest) ProtoMessage() {} + +func (x *ThirdPartyBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ThirdPartyBlockRequest.ProtoReflect.Descriptor instead. +func (*ThirdPartyBlockRequest) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{19} +} + +func (x *ThirdPartyBlockRequest) GetPreviousKey() *PublicKey { + if x != nil { + return x.PreviousKey + } + return nil +} + +func (x *ThirdPartyBlockRequest) GetPublicKeys() []*PublicKey { + if x != nil { + return x.PublicKeys + } + return nil +} + +type ThirdPartyBlockContents struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Payload []byte `protobuf:"bytes,1,req,name=payload" json:"payload,omitempty"` + ExternalSignature *ExternalSignature `protobuf:"bytes,2,req,name=externalSignature" json:"externalSignature,omitempty"` +} + +func (x *ThirdPartyBlockContents) Reset() { + *x = ThirdPartyBlockContents{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ThirdPartyBlockContents) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ThirdPartyBlockContents) ProtoMessage() {} + +func (x *ThirdPartyBlockContents) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ThirdPartyBlockContents.ProtoReflect.Descriptor instead. +func (*ThirdPartyBlockContents) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{20} +} + +func (x *ThirdPartyBlockContents) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *ThirdPartyBlockContents) GetExternalSignature() *ExternalSignature { + if x != nil { + return x.ExternalSignature + } + return nil +} + +type AuthorizerSnapshot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Limits *RunLimits `protobuf:"bytes,1,req,name=limits" json:"limits,omitempty"` + ExecutionTime *uint64 `protobuf:"varint,2,req,name=executionTime" json:"executionTime,omitempty"` + World *AuthorizerWorld `protobuf:"bytes,3,req,name=world" json:"world,omitempty"` +} + +func (x *AuthorizerSnapshot) Reset() { + *x = AuthorizerSnapshot{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthorizerSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthorizerSnapshot) ProtoMessage() {} + +func (x *AuthorizerSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthorizerSnapshot.ProtoReflect.Descriptor instead. +func (*AuthorizerSnapshot) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{21} +} + +func (x *AuthorizerSnapshot) GetLimits() *RunLimits { + if x != nil { + return x.Limits + } + return nil +} + +func (x *AuthorizerSnapshot) GetExecutionTime() uint64 { + if x != nil && x.ExecutionTime != nil { + return *x.ExecutionTime + } + return 0 +} + +func (x *AuthorizerSnapshot) GetWorld() *AuthorizerWorld { + if x != nil { + return x.World + } + return nil +} + +type RunLimits struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MaxFacts *uint64 `protobuf:"varint,1,req,name=maxFacts" json:"maxFacts,omitempty"` + MaxIterations *uint64 `protobuf:"varint,2,req,name=maxIterations" json:"maxIterations,omitempty"` + MaxTime *uint64 `protobuf:"varint,3,req,name=maxTime" json:"maxTime,omitempty"` +} + +func (x *RunLimits) Reset() { + *x = RunLimits{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunLimits) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunLimits) ProtoMessage() {} + +func (x *RunLimits) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunLimits.ProtoReflect.Descriptor instead. +func (*RunLimits) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{22} +} + +func (x *RunLimits) GetMaxFacts() uint64 { + if x != nil && x.MaxFacts != nil { + return *x.MaxFacts + } + return 0 +} + +func (x *RunLimits) GetMaxIterations() uint64 { + if x != nil && x.MaxIterations != nil { + return *x.MaxIterations + } + return 0 +} + +func (x *RunLimits) GetMaxTime() uint64 { + if x != nil && x.MaxTime != nil { + return *x.MaxTime + } + return 0 +} + +type AuthorizerWorld struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + Symbols []string `protobuf:"bytes,2,rep,name=symbols" json:"symbols,omitempty"` + PublicKeys []*PublicKey `protobuf:"bytes,3,rep,name=publicKeys" json:"publicKeys,omitempty"` + Blocks []*SnapshotBlock `protobuf:"bytes,4,rep,name=blocks" json:"blocks,omitempty"` + AuthorizerBlock *SnapshotBlock `protobuf:"bytes,5,req,name=authorizerBlock" json:"authorizerBlock,omitempty"` + AuthorizerPolicies []*Policy `protobuf:"bytes,6,rep,name=authorizerPolicies" json:"authorizerPolicies,omitempty"` + GeneratedFacts []*GeneratedFacts `protobuf:"bytes,7,rep,name=generatedFacts" json:"generatedFacts,omitempty"` + Iterations *uint64 `protobuf:"varint,8,req,name=iterations" json:"iterations,omitempty"` +} + +func (x *AuthorizerWorld) Reset() { + *x = AuthorizerWorld{} + if protoimpl.UnsafeEnabled { + mi := &file_biscuit_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthorizerWorld) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthorizerWorld) ProtoMessage() {} + +func (x *AuthorizerWorld) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthorizerWorld.ProtoReflect.Descriptor instead. +func (*AuthorizerWorld) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{23} +} + +func (x *AuthorizerWorld) GetVersion() uint32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *AuthorizerWorld) GetSymbols() []string { + if x != nil { + return x.Symbols + } + return nil +} + +func (x *AuthorizerWorld) GetPublicKeys() []*PublicKey { + if x != nil { + return x.PublicKeys + } + return nil +} + +func (x *AuthorizerWorld) GetBlocks() []*SnapshotBlock { + if x != nil { + return x.Blocks + } + return nil +} + +func (x *AuthorizerWorld) GetAuthorizerBlock() *SnapshotBlock { + if x != nil { + return x.AuthorizerBlock + } + return nil +} + +func (x *AuthorizerWorld) GetAuthorizerPolicies() []*Policy { + if x != nil { + return x.AuthorizerPolicies + } + return nil +} + +func (x *AuthorizerWorld) GetGeneratedFacts() []*GeneratedFacts { + if x != nil { + return x.GeneratedFacts + } + return nil +} + +func (x *AuthorizerWorld) GetIterations() uint64 { + if x != nil && x.Iterations != nil { + return *x.Iterations + } + return 0 +} + +type Origin struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Kind *OpUnary_Kind `protobuf:"varint,1,req,name=kind,enum=OpUnary_Kind" json:"kind,omitempty"` + // Types that are assignable to Content: + // + // *Origin_Authorizer + // *Origin_Origin + Content isOrigin_Content `protobuf_oneof:"Content"` } -func (x *OpUnary) Reset() { - *x = OpUnary{} +func (x *Origin) Reset() { + *x = Origin{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[13] + mi := &file_biscuit_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *OpUnary) String() string { +func (x *Origin) String() string { return protoimpl.X.MessageStringOf(x) } -func (*OpUnary) ProtoMessage() {} +func (*Origin) ProtoMessage() {} -func (x *OpUnary) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[13] +func (x *Origin) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1230,43 +2112,71 @@ func (x *OpUnary) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use OpUnary.ProtoReflect.Descriptor instead. -func (*OpUnary) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{13} +// Deprecated: Use Origin.ProtoReflect.Descriptor instead. +func (*Origin) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{24} } -func (x *OpUnary) GetKind() OpUnary_Kind { - if x != nil && x.Kind != nil { - return *x.Kind +func (m *Origin) GetContent() isOrigin_Content { + if m != nil { + return m.Content } - return OpUnary_Negate + return nil } -type OpBinary struct { +func (x *Origin) GetAuthorizer() *Empty { + if x, ok := x.GetContent().(*Origin_Authorizer); ok { + return x.Authorizer + } + return nil +} + +func (x *Origin) GetOrigin() uint32 { + if x, ok := x.GetContent().(*Origin_Origin); ok { + return x.Origin + } + return 0 +} + +type isOrigin_Content interface { + isOrigin_Content() +} + +type Origin_Authorizer struct { + Authorizer *Empty `protobuf:"bytes,1,opt,name=authorizer,oneof"` +} + +type Origin_Origin struct { + Origin uint32 `protobuf:"varint,2,opt,name=origin,oneof"` +} + +func (*Origin_Authorizer) isOrigin_Content() {} + +func (*Origin_Origin) isOrigin_Content() {} + +type Empty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Kind *OpBinary_Kind `protobuf:"varint,1,req,name=kind,enum=OpBinary_Kind" json:"kind,omitempty"` } -func (x *OpBinary) Reset() { - *x = OpBinary{} +func (x *Empty) Reset() { + *x = Empty{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[14] + mi := &file_biscuit_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *OpBinary) String() string { +func (x *Empty) String() string { return protoimpl.X.MessageStringOf(x) } -func (*OpBinary) ProtoMessage() {} +func (*Empty) ProtoMessage() {} -func (x *OpBinary) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[14] +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1277,44 +2187,37 @@ func (x *OpBinary) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use OpBinary.ProtoReflect.Descriptor instead. -func (*OpBinary) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{14} -} - -func (x *OpBinary) GetKind() OpBinary_Kind { - if x != nil && x.Kind != nil { - return *x.Kind - } - return OpBinary_LessThan +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{25} } -type Policy struct { +type GeneratedFacts struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Queries []*RuleV2 `protobuf:"bytes,1,rep,name=queries" json:"queries,omitempty"` - Kind *Policy_Kind `protobuf:"varint,2,req,name=kind,enum=Policy_Kind" json:"kind,omitempty"` + Origins []*Origin `protobuf:"bytes,1,rep,name=origins" json:"origins,omitempty"` + Facts []*FactV2 `protobuf:"bytes,2,rep,name=facts" json:"facts,omitempty"` } -func (x *Policy) Reset() { - *x = Policy{} +func (x *GeneratedFacts) Reset() { + *x = GeneratedFacts{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[15] + mi := &file_biscuit_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Policy) String() string { +func (x *GeneratedFacts) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Policy) ProtoMessage() {} +func (*GeneratedFacts) ProtoMessage() {} -func (x *Policy) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[15] +func (x *GeneratedFacts) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1325,55 +2228,56 @@ func (x *Policy) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Policy.ProtoReflect.Descriptor instead. -func (*Policy) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{15} +// Deprecated: Use GeneratedFacts.ProtoReflect.Descriptor instead. +func (*GeneratedFacts) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{26} } -func (x *Policy) GetQueries() []*RuleV2 { +func (x *GeneratedFacts) GetOrigins() []*Origin { if x != nil { - return x.Queries + return x.Origins } return nil } -func (x *Policy) GetKind() Policy_Kind { - if x != nil && x.Kind != nil { - return *x.Kind +func (x *GeneratedFacts) GetFacts() []*FactV2 { + if x != nil { + return x.Facts } - return Policy_Allow + return nil } -type AuthorizerPolicies struct { +type SnapshotBlock struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Symbols []string `protobuf:"bytes,1,rep,name=symbols" json:"symbols,omitempty"` - Version *uint32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"` - Facts []*FactV2 `protobuf:"bytes,3,rep,name=facts" json:"facts,omitempty"` - Rules []*RuleV2 `protobuf:"bytes,4,rep,name=rules" json:"rules,omitempty"` - Checks []*CheckV2 `protobuf:"bytes,5,rep,name=checks" json:"checks,omitempty"` - Policies []*Policy `protobuf:"bytes,6,rep,name=policies" json:"policies,omitempty"` + Context *string `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Version *uint32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"` + FactsV2 []*FactV2 `protobuf:"bytes,3,rep,name=facts_v2,json=factsV2" json:"facts_v2,omitempty"` + RulesV2 []*RuleV2 `protobuf:"bytes,4,rep,name=rules_v2,json=rulesV2" json:"rules_v2,omitempty"` + ChecksV2 []*CheckV2 `protobuf:"bytes,5,rep,name=checks_v2,json=checksV2" json:"checks_v2,omitempty"` + Scope []*Scope `protobuf:"bytes,6,rep,name=scope" json:"scope,omitempty"` + ExternalKey *PublicKey `protobuf:"bytes,7,opt,name=externalKey" json:"externalKey,omitempty"` } -func (x *AuthorizerPolicies) Reset() { - *x = AuthorizerPolicies{} +func (x *SnapshotBlock) Reset() { + *x = SnapshotBlock{} if protoimpl.UnsafeEnabled { - mi := &file_biscuit_proto_msgTypes[16] + mi := &file_biscuit_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *AuthorizerPolicies) String() string { +func (x *SnapshotBlock) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AuthorizerPolicies) ProtoMessage() {} +func (*SnapshotBlock) ProtoMessage() {} -func (x *AuthorizerPolicies) ProtoReflect() protoreflect.Message { - mi := &file_biscuit_proto_msgTypes[16] +func (x *SnapshotBlock) ProtoReflect() protoreflect.Message { + mi := &file_biscuit_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1384,49 +2288,56 @@ func (x *AuthorizerPolicies) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AuthorizerPolicies.ProtoReflect.Descriptor instead. -func (*AuthorizerPolicies) Descriptor() ([]byte, []int) { - return file_biscuit_proto_rawDescGZIP(), []int{16} +// Deprecated: Use SnapshotBlock.ProtoReflect.Descriptor instead. +func (*SnapshotBlock) Descriptor() ([]byte, []int) { + return file_biscuit_proto_rawDescGZIP(), []int{27} } -func (x *AuthorizerPolicies) GetSymbols() []string { - if x != nil { - return x.Symbols +func (x *SnapshotBlock) GetContext() string { + if x != nil && x.Context != nil { + return *x.Context } - return nil + return "" } -func (x *AuthorizerPolicies) GetVersion() uint32 { +func (x *SnapshotBlock) GetVersion() uint32 { if x != nil && x.Version != nil { return *x.Version } return 0 } -func (x *AuthorizerPolicies) GetFacts() []*FactV2 { +func (x *SnapshotBlock) GetFactsV2() []*FactV2 { if x != nil { - return x.Facts + return x.FactsV2 } return nil } -func (x *AuthorizerPolicies) GetRules() []*RuleV2 { +func (x *SnapshotBlock) GetRulesV2() []*RuleV2 { if x != nil { - return x.Rules + return x.RulesV2 } return nil } -func (x *AuthorizerPolicies) GetChecks() []*CheckV2 { +func (x *SnapshotBlock) GetChecksV2() []*CheckV2 { if x != nil { - return x.Checks + return x.ChecksV2 } return nil } -func (x *AuthorizerPolicies) GetPolicies() []*Policy { +func (x *SnapshotBlock) GetScope() []*Scope { if x != nil { - return x.Policies + return x.Scope + } + return nil +} + +func (x *SnapshotBlock) GetExternalKey() *PublicKey { + if x != nil { + return x.ExternalKey } return nil } @@ -1434,135 +2345,323 @@ func (x *AuthorizerPolicies) GetPolicies() []*Policy { var File_biscuit_proto protoreflect.FileDescriptor var file_biscuit_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x97, 0x01, 0x0a, 0x07, 0x42, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, - 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, - 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x52, 0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1c, 0x0a, 0x05, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x50, 0x72, 0x6f, - 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x0b, 0x53, 0x69, 0x67, - 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x24, - 0x0a, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x6e, 0x65, 0x78, + 0x0a, 0x0d, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x15, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0xd9, 0x01, 0x0a, 0x07, 0x42, 0x69, 0x73, 0x63, 0x75, + 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x49, 0x64, + 0x12, 0x40, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x02, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, + 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x32, + 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x22, 0xd5, 0x01, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x3a, 0x0a, 0x07, 0x6e, 0x65, 0x78, 0x74, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x22, 0x6b, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, - 0x32, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x2e, 0x41, - 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, - 0x74, 0x68, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0c, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, - 0x68, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x10, 0x00, 0x22, - 0x5e, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x20, 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, - 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, - 0x6e, 0x65, 0x78, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x28, 0x0a, 0x0e, 0x66, 0x69, - 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, - 0xc4, 0x01, 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x79, 0x6d, - 0x62, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x79, 0x6d, 0x62, - 0x6f, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x08, 0x66, 0x61, 0x63, 0x74, 0x73, - 0x5f, 0x76, 0x32, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x61, 0x63, 0x74, - 0x56, 0x32, 0x52, 0x07, 0x66, 0x61, 0x63, 0x74, 0x73, 0x56, 0x32, 0x12, 0x22, 0x0a, 0x08, 0x72, - 0x75, 0x6c, 0x65, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, - 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x56, 0x32, 0x12, - 0x25, 0x0a, 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, 0x52, 0x08, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x56, 0x32, 0x22, 0x34, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x74, 0x56, 0x32, - 0x12, 0x2a, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, - 0x32, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x22, 0x7d, 0x0a, 0x06, - 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x12, 0x20, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x01, - 0x20, 0x02, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x56, 0x32, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x56, 0x32, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2f, 0x0a, 0x0b, 0x65, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x32, 0x52, 0x0b, - 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2c, 0x0a, 0x07, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, 0x12, 0x21, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, - 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x22, 0x40, 0x0a, 0x0b, 0x50, 0x72, 0x65, - 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x02, 0x28, 0x04, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x05, - 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x54, 0x65, - 0x72, 0x6d, 0x56, 0x32, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x06, - 0x54, 0x65, 0x72, 0x6d, 0x56, 0x32, 0x12, 0x1c, 0x0a, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, - 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, - 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, - 0x12, 0x16, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x48, - 0x00, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x1c, - 0x0a, 0x03, 0x73, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x54, 0x65, - 0x72, 0x6d, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x03, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x24, 0x0a, 0x07, 0x54, 0x65, 0x72, 0x6d, 0x53, - 0x65, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x07, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x56, 0x32, 0x52, 0x03, 0x73, 0x65, 0x74, 0x22, 0x25, 0x0a, - 0x0c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x32, 0x12, 0x15, 0x0a, - 0x03, 0x6f, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x03, 0x2e, 0x4f, 0x70, 0x52, - 0x03, 0x6f, 0x70, 0x73, 0x22, 0x77, 0x0a, 0x02, 0x4f, 0x70, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x54, 0x65, 0x72, 0x6d, - 0x56, 0x32, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x75, - 0x6e, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4f, 0x70, 0x55, - 0x6e, 0x61, 0x72, 0x79, 0x48, 0x00, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x23, 0x0a, - 0x06, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, - 0x4f, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x48, 0x00, 0x52, 0x06, 0x42, 0x69, 0x6e, 0x61, - 0x72, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x58, 0x0a, - 0x07, 0x4f, 0x70, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x21, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, - 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x4f, 0x70, 0x55, 0x6e, 0x61, 0x72, 0x79, - 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x4b, - 0x69, 0x6e, 0x64, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x65, 0x10, 0x00, 0x12, - 0x0a, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x73, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x10, 0x02, 0x22, 0x89, 0x02, 0x0a, 0x08, 0x4f, 0x70, 0x42, 0x69, - 0x6e, 0x61, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x4f, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2e, 0x4b, 0x69, - 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xd8, 0x01, 0x0a, 0x04, 0x4b, 0x69, 0x6e, - 0x64, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x65, 0x73, 0x73, 0x54, 0x68, 0x61, 0x6e, 0x10, 0x00, 0x12, - 0x0f, 0x0a, 0x0b, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x54, 0x68, 0x61, 0x6e, 0x10, 0x01, - 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x10, - 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x45, 0x71, - 0x75, 0x61, 0x6c, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x10, 0x04, - 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x10, 0x05, 0x12, 0x0a, - 0x0a, 0x06, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, - 0x08, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x10, 0x09, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x75, - 0x62, 0x10, 0x0a, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x75, 0x6c, 0x10, 0x0b, 0x12, 0x07, 0x0a, 0x03, - 0x44, 0x69, 0x76, 0x10, 0x0c, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x64, 0x10, 0x0d, 0x12, 0x06, - 0x0a, 0x02, 0x4f, 0x72, 0x10, 0x0e, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x73, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x0f, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, - 0x6e, 0x10, 0x10, 0x22, 0x6a, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x21, 0x0a, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, - 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, - 0x12, 0x20, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x0c, - 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x22, 0x1b, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x6c, - 0x6c, 0x6f, 0x77, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x65, 0x6e, 0x79, 0x10, 0x01, 0x22, - 0xcd, 0x01, 0x0a, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x05, 0x66, 0x61, - 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x61, 0x63, 0x74, - 0x56, 0x32, 0x52, 0x05, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x05, 0x72, 0x75, 0x6c, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x56, - 0x32, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x06, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x56, 0x32, 0x52, 0x06, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x23, 0x0a, 0x08, 0x70, 0x6f, - 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x72, 0x65, 0x12, 0x56, 0x0a, 0x11, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x11, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x71, 0x0a, 0x11, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x02, + 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3e, 0x0a, + 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x81, 0x01, + 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x48, 0x0a, 0x09, 0x61, + 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x2a, + 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, + 0x69, 0x74, 0x68, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x10, + 0x00, 0x22, 0x5e, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x20, 0x0a, 0x0a, 0x6e, 0x65, + 0x78, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, + 0x52, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x28, 0x0a, 0x0e, + 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x22, 0xfc, 0x02, 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x79, + 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x08, 0x66, 0x61, 0x63, + 0x74, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, + 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x61, 0x63, 0x74, 0x56, 0x32, 0x52, 0x07, 0x66, 0x61, 0x63, 0x74, + 0x73, 0x56, 0x32, 0x12, 0x38, 0x0a, 0x08, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x5f, 0x76, 0x32, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x75, + 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x56, 0x32, 0x12, 0x3b, 0x0a, + 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, + 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x56, 0x32, 0x12, 0x32, 0x0a, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x69, 0x73, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x40, + 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, + 0x22, 0xa4, 0x01, 0x0a, 0x05, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x09, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, + 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x53, 0x63, 0x6f, 0x70, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x22, 0x28, 0x0a, 0x09, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0d, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x10, 0x00, 0x12, 0x0c, + 0x0a, 0x08, 0x50, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x10, 0x01, 0x42, 0x09, 0x0a, 0x07, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4a, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x74, 0x56, + 0x32, 0x12, 0x40, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, + 0x20, 0x02, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x32, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x12, 0x36, + 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, + 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x32, + 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x32, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, + 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x70, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x32, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x63, 0x6f, + 0x70, 0x65, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x07, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x56, 0x32, 0x12, 0x37, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, + 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, + 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x37, + 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x62, + 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, 0x2e, 0x4b, 0x69, 0x6e, + 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x18, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x12, + 0x07, 0x0a, 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6c, 0x6c, 0x10, + 0x01, 0x22, 0x56, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x56, 0x32, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x04, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x65, 0x72, 0x6d, + 0x56, 0x32, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0xdf, 0x01, 0x0a, 0x06, 0x54, 0x65, + 0x72, 0x6d, 0x56, 0x32, 0x12, 0x1c, 0x0a, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, + 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x12, 0x18, + 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, + 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, + 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, + 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x32, 0x0a, 0x03, + 0x73, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x69, 0x73, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x03, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x3a, 0x0a, 0x07, 0x54, + 0x65, 0x72, 0x6d, 0x53, 0x65, 0x74, 0x12, 0x2f, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x65, 0x72, 0x6d, + 0x56, 0x32, 0x52, 0x03, 0x73, 0x65, 0x74, 0x22, 0x3b, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x72, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x32, 0x12, 0x2b, 0x0a, 0x03, 0x6f, 0x70, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4f, 0x70, 0x52, + 0x03, 0x6f, 0x70, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x02, 0x4f, 0x70, 0x12, 0x35, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, + 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x56, 0x32, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4f, 0x70, 0x55, 0x6e, 0x61, 0x72, + 0x79, 0x48, 0x00, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x39, 0x0a, 0x06, 0x42, 0x69, + 0x6e, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x69, 0x73, + 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x2e, 0x4f, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x48, 0x00, 0x52, 0x06, 0x42, + 0x69, 0x6e, 0x61, 0x72, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x22, 0x6e, 0x0a, 0x07, 0x4f, 0x70, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x04, 0x6b, + 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x62, 0x69, 0x73, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x4f, 0x70, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, + 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x0a, 0x0a, 0x06, + 0x4e, 0x65, 0x67, 0x61, 0x74, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x65, + 0x6e, 0x73, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x10, 0x02, + 0x22, 0xdc, 0x02, 0x0a, 0x08, 0x4f, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x38, 0x0a, + 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x69, + 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x2e, 0x4f, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x2e, 0x4b, 0x69, 0x6e, + 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x95, 0x02, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, + 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x65, 0x73, 0x73, 0x54, 0x68, 0x61, 0x6e, 0x10, 0x00, 0x12, 0x0f, + 0x0a, 0x0b, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x54, 0x68, 0x61, 0x6e, 0x10, 0x01, 0x12, + 0x0f, 0x0a, 0x0b, 0x4c, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x10, 0x02, + 0x12, 0x12, 0x0a, 0x0e, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x45, 0x71, 0x75, + 0x61, 0x6c, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x10, 0x04, 0x12, + 0x0c, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x10, 0x05, 0x12, 0x0a, 0x0a, + 0x06, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x75, 0x66, + 0x66, 0x69, 0x78, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x08, + 0x12, 0x07, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x10, 0x09, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x75, 0x62, + 0x10, 0x0a, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x75, 0x6c, 0x10, 0x0b, 0x12, 0x07, 0x0a, 0x03, 0x44, + 0x69, 0x76, 0x10, 0x0c, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x64, 0x10, 0x0d, 0x12, 0x06, 0x0a, + 0x02, 0x4f, 0x72, 0x10, 0x0e, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x0f, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, + 0x10, 0x10, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x69, 0x74, 0x77, 0x69, 0x73, 0x65, 0x41, 0x6e, 0x64, + 0x10, 0x11, 0x12, 0x0d, 0x0a, 0x09, 0x42, 0x69, 0x74, 0x77, 0x69, 0x73, 0x65, 0x4f, 0x72, 0x10, + 0x12, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x69, 0x74, 0x77, 0x69, 0x73, 0x65, 0x58, 0x6f, 0x72, 0x10, + 0x13, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x10, 0x14, 0x22, + 0x96, 0x01, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x71, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, + 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, + 0x69, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, + 0x0e, 0x32, 0x22, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x1b, 0x0a, 0x04, 0x4b, + 0x69, 0x6e, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x10, 0x00, 0x12, 0x08, + 0x0a, 0x04, 0x44, 0x65, 0x6e, 0x79, 0x10, 0x01, 0x22, 0xa5, 0x02, 0x0a, 0x12, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x05, 0x66, 0x61, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x61, 0x63, 0x74, 0x56, + 0x32, 0x52, 0x05, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, + 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, + 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x36, 0x0a, + 0x06, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, 0x52, 0x06, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x39, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, + 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, + 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, + 0x22, 0x9e, 0x01, 0x0a, 0x16, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x0b, 0x70, + 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x4b, 0x65, 0x79, 0x12, + 0x40, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x17, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x56, 0x0a, 0x11, 0x65, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x11, 0x65, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, + 0xb2, 0x01, 0x0a, 0x12, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x53, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x38, 0x0a, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, + 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, + 0x75, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x06, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x73, + 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3c, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x18, + 0x03, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x52, 0x05, 0x77, + 0x6f, 0x72, 0x6c, 0x64, 0x22, 0x67, 0x0a, 0x09, 0x52, 0x75, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x46, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x46, 0x61, 0x63, 0x74, 0x73, 0x12, 0x24, 0x0a, + 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x02, 0x28, 0x04, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x02, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xd3, 0x03, + 0x0a, 0x0f, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6c, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x79, + 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, 0x73, 0x63, + 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0a, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x3c, 0x0a, 0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, + 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, + 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x06, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x4e, 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x4d, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x69, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x0e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x46, 0x61, 0x63, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x62, + 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x61, + 0x63, 0x74, 0x73, 0x52, 0x0e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x61, + 0x63, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x08, 0x20, 0x02, 0x28, 0x04, 0x52, 0x0a, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x6d, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x3e, 0x0a, + 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, + 0x00, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x18, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x7e, 0x0a, 0x0e, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x61, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, + 0x07, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x07, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x66, 0x61, 0x63, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x61, + 0x63, 0x74, 0x56, 0x32, 0x52, 0x05, 0x66, 0x61, 0x63, 0x74, 0x73, 0x22, 0xec, 0x02, 0x0a, 0x0d, + 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x38, 0x0a, 0x08, 0x66, 0x61, 0x63, 0x74, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x61, 0x63, 0x74, + 0x56, 0x32, 0x52, 0x07, 0x66, 0x61, 0x63, 0x74, 0x73, 0x56, 0x32, 0x12, 0x38, 0x0a, 0x08, 0x72, + 0x75, 0x6c, 0x65, 0x73, 0x5f, 0x76, 0x32, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x56, 0x32, 0x52, 0x07, 0x72, 0x75, + 0x6c, 0x65, 0x73, 0x56, 0x32, 0x12, 0x3b, 0x0a, 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x5f, + 0x76, 0x32, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, + 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x56, 0x32, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x56, 0x32, 0x12, 0x32, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x69, 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x52, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x69, + 0x73, 0x63, 0x75, 0x69, 0x74, 0x2e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x65, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4b, 0x65, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, } var ( @@ -1577,65 +2676,103 @@ func file_biscuit_proto_rawDescGZIP() []byte { return file_biscuit_proto_rawDescData } -var file_biscuit_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_biscuit_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_biscuit_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_biscuit_proto_msgTypes = make([]protoimpl.MessageInfo, 28) var file_biscuit_proto_goTypes = []interface{}{ - (PublicKey_Algorithm)(0), // 0: PublicKey.Algorithm - (OpUnary_Kind)(0), // 1: OpUnary.Kind - (OpBinary_Kind)(0), // 2: OpBinary.Kind - (Policy_Kind)(0), // 3: Policy.Kind - (*Biscuit)(nil), // 4: Biscuit - (*SignedBlock)(nil), // 5: SignedBlock - (*PublicKey)(nil), // 6: PublicKey - (*Proof)(nil), // 7: Proof - (*Block)(nil), // 8: Block - (*FactV2)(nil), // 9: FactV2 - (*RuleV2)(nil), // 10: RuleV2 - (*CheckV2)(nil), // 11: CheckV2 - (*PredicateV2)(nil), // 12: PredicateV2 - (*TermV2)(nil), // 13: TermV2 - (*TermSet)(nil), // 14: TermSet - (*ExpressionV2)(nil), // 15: ExpressionV2 - (*Op)(nil), // 16: Op - (*OpUnary)(nil), // 17: OpUnary - (*OpBinary)(nil), // 18: OpBinary - (*Policy)(nil), // 19: Policy - (*AuthorizerPolicies)(nil), // 20: AuthorizerPolicies + (PublicKey_Algorithm)(0), // 0: biscuit.format.schema.PublicKey.Algorithm + (Scope_ScopeType)(0), // 1: biscuit.format.schema.Scope.ScopeType + (CheckV2_Kind)(0), // 2: biscuit.format.schema.CheckV2.Kind + (OpUnary_Kind)(0), // 3: biscuit.format.schema.OpUnary.Kind + (OpBinary_Kind)(0), // 4: biscuit.format.schema.OpBinary.Kind + (Policy_Kind)(0), // 5: biscuit.format.schema.Policy.Kind + (*Biscuit)(nil), // 6: biscuit.format.schema.Biscuit + (*SignedBlock)(nil), // 7: biscuit.format.schema.SignedBlock + (*ExternalSignature)(nil), // 8: biscuit.format.schema.ExternalSignature + (*PublicKey)(nil), // 9: biscuit.format.schema.PublicKey + (*Proof)(nil), // 10: biscuit.format.schema.Proof + (*Block)(nil), // 11: biscuit.format.schema.Block + (*Scope)(nil), // 12: biscuit.format.schema.Scope + (*FactV2)(nil), // 13: biscuit.format.schema.FactV2 + (*RuleV2)(nil), // 14: biscuit.format.schema.RuleV2 + (*CheckV2)(nil), // 15: biscuit.format.schema.CheckV2 + (*PredicateV2)(nil), // 16: biscuit.format.schema.PredicateV2 + (*TermV2)(nil), // 17: biscuit.format.schema.TermV2 + (*TermSet)(nil), // 18: biscuit.format.schema.TermSet + (*ExpressionV2)(nil), // 19: biscuit.format.schema.ExpressionV2 + (*Op)(nil), // 20: biscuit.format.schema.Op + (*OpUnary)(nil), // 21: biscuit.format.schema.OpUnary + (*OpBinary)(nil), // 22: biscuit.format.schema.OpBinary + (*Policy)(nil), // 23: biscuit.format.schema.Policy + (*AuthorizerPolicies)(nil), // 24: biscuit.format.schema.AuthorizerPolicies + (*ThirdPartyBlockRequest)(nil), // 25: biscuit.format.schema.ThirdPartyBlockRequest + (*ThirdPartyBlockContents)(nil), // 26: biscuit.format.schema.ThirdPartyBlockContents + (*AuthorizerSnapshot)(nil), // 27: biscuit.format.schema.AuthorizerSnapshot + (*RunLimits)(nil), // 28: biscuit.format.schema.RunLimits + (*AuthorizerWorld)(nil), // 29: biscuit.format.schema.AuthorizerWorld + (*Origin)(nil), // 30: biscuit.format.schema.Origin + (*Empty)(nil), // 31: biscuit.format.schema.Empty + (*GeneratedFacts)(nil), // 32: biscuit.format.schema.GeneratedFacts + (*SnapshotBlock)(nil), // 33: biscuit.format.schema.SnapshotBlock } var file_biscuit_proto_depIdxs = []int32{ - 5, // 0: Biscuit.authority:type_name -> SignedBlock - 5, // 1: Biscuit.blocks:type_name -> SignedBlock - 7, // 2: Biscuit.proof:type_name -> Proof - 6, // 3: SignedBlock.nextKey:type_name -> PublicKey - 0, // 4: PublicKey.algorithm:type_name -> PublicKey.Algorithm - 9, // 5: Block.facts_v2:type_name -> FactV2 - 10, // 6: Block.rules_v2:type_name -> RuleV2 - 11, // 7: Block.checks_v2:type_name -> CheckV2 - 12, // 8: FactV2.predicate:type_name -> PredicateV2 - 12, // 9: RuleV2.head:type_name -> PredicateV2 - 12, // 10: RuleV2.body:type_name -> PredicateV2 - 15, // 11: RuleV2.expressions:type_name -> ExpressionV2 - 10, // 12: CheckV2.queries:type_name -> RuleV2 - 13, // 13: PredicateV2.terms:type_name -> TermV2 - 14, // 14: TermV2.set:type_name -> TermSet - 13, // 15: TermSet.set:type_name -> TermV2 - 16, // 16: ExpressionV2.ops:type_name -> Op - 13, // 17: Op.value:type_name -> TermV2 - 17, // 18: Op.unary:type_name -> OpUnary - 18, // 19: Op.Binary:type_name -> OpBinary - 1, // 20: OpUnary.kind:type_name -> OpUnary.Kind - 2, // 21: OpBinary.kind:type_name -> OpBinary.Kind - 10, // 22: Policy.queries:type_name -> RuleV2 - 3, // 23: Policy.kind:type_name -> Policy.Kind - 9, // 24: AuthorizerPolicies.facts:type_name -> FactV2 - 10, // 25: AuthorizerPolicies.rules:type_name -> RuleV2 - 11, // 26: AuthorizerPolicies.checks:type_name -> CheckV2 - 19, // 27: AuthorizerPolicies.policies:type_name -> Policy - 28, // [28:28] is the sub-list for method output_type - 28, // [28:28] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name + 7, // 0: biscuit.format.schema.Biscuit.authority:type_name -> biscuit.format.schema.SignedBlock + 7, // 1: biscuit.format.schema.Biscuit.blocks:type_name -> biscuit.format.schema.SignedBlock + 10, // 2: biscuit.format.schema.Biscuit.proof:type_name -> biscuit.format.schema.Proof + 9, // 3: biscuit.format.schema.SignedBlock.nextKey:type_name -> biscuit.format.schema.PublicKey + 8, // 4: biscuit.format.schema.SignedBlock.externalSignature:type_name -> biscuit.format.schema.ExternalSignature + 9, // 5: biscuit.format.schema.ExternalSignature.publicKey:type_name -> biscuit.format.schema.PublicKey + 0, // 6: biscuit.format.schema.PublicKey.algorithm:type_name -> biscuit.format.schema.PublicKey.Algorithm + 13, // 7: biscuit.format.schema.Block.facts_v2:type_name -> biscuit.format.schema.FactV2 + 14, // 8: biscuit.format.schema.Block.rules_v2:type_name -> biscuit.format.schema.RuleV2 + 15, // 9: biscuit.format.schema.Block.checks_v2:type_name -> biscuit.format.schema.CheckV2 + 12, // 10: biscuit.format.schema.Block.scope:type_name -> biscuit.format.schema.Scope + 9, // 11: biscuit.format.schema.Block.publicKeys:type_name -> biscuit.format.schema.PublicKey + 1, // 12: biscuit.format.schema.Scope.scopeType:type_name -> biscuit.format.schema.Scope.ScopeType + 16, // 13: biscuit.format.schema.FactV2.predicate:type_name -> biscuit.format.schema.PredicateV2 + 16, // 14: biscuit.format.schema.RuleV2.head:type_name -> biscuit.format.schema.PredicateV2 + 16, // 15: biscuit.format.schema.RuleV2.body:type_name -> biscuit.format.schema.PredicateV2 + 19, // 16: biscuit.format.schema.RuleV2.expressions:type_name -> biscuit.format.schema.ExpressionV2 + 12, // 17: biscuit.format.schema.RuleV2.scope:type_name -> biscuit.format.schema.Scope + 14, // 18: biscuit.format.schema.CheckV2.queries:type_name -> biscuit.format.schema.RuleV2 + 2, // 19: biscuit.format.schema.CheckV2.kind:type_name -> biscuit.format.schema.CheckV2.Kind + 17, // 20: biscuit.format.schema.PredicateV2.terms:type_name -> biscuit.format.schema.TermV2 + 18, // 21: biscuit.format.schema.TermV2.set:type_name -> biscuit.format.schema.TermSet + 17, // 22: biscuit.format.schema.TermSet.set:type_name -> biscuit.format.schema.TermV2 + 20, // 23: biscuit.format.schema.ExpressionV2.ops:type_name -> biscuit.format.schema.Op + 17, // 24: biscuit.format.schema.Op.value:type_name -> biscuit.format.schema.TermV2 + 21, // 25: biscuit.format.schema.Op.unary:type_name -> biscuit.format.schema.OpUnary + 22, // 26: biscuit.format.schema.Op.Binary:type_name -> biscuit.format.schema.OpBinary + 3, // 27: biscuit.format.schema.OpUnary.kind:type_name -> biscuit.format.schema.OpUnary.Kind + 4, // 28: biscuit.format.schema.OpBinary.kind:type_name -> biscuit.format.schema.OpBinary.Kind + 14, // 29: biscuit.format.schema.Policy.queries:type_name -> biscuit.format.schema.RuleV2 + 5, // 30: biscuit.format.schema.Policy.kind:type_name -> biscuit.format.schema.Policy.Kind + 13, // 31: biscuit.format.schema.AuthorizerPolicies.facts:type_name -> biscuit.format.schema.FactV2 + 14, // 32: biscuit.format.schema.AuthorizerPolicies.rules:type_name -> biscuit.format.schema.RuleV2 + 15, // 33: biscuit.format.schema.AuthorizerPolicies.checks:type_name -> biscuit.format.schema.CheckV2 + 23, // 34: biscuit.format.schema.AuthorizerPolicies.policies:type_name -> biscuit.format.schema.Policy + 9, // 35: biscuit.format.schema.ThirdPartyBlockRequest.previousKey:type_name -> biscuit.format.schema.PublicKey + 9, // 36: biscuit.format.schema.ThirdPartyBlockRequest.publicKeys:type_name -> biscuit.format.schema.PublicKey + 8, // 37: biscuit.format.schema.ThirdPartyBlockContents.externalSignature:type_name -> biscuit.format.schema.ExternalSignature + 28, // 38: biscuit.format.schema.AuthorizerSnapshot.limits:type_name -> biscuit.format.schema.RunLimits + 29, // 39: biscuit.format.schema.AuthorizerSnapshot.world:type_name -> biscuit.format.schema.AuthorizerWorld + 9, // 40: biscuit.format.schema.AuthorizerWorld.publicKeys:type_name -> biscuit.format.schema.PublicKey + 33, // 41: biscuit.format.schema.AuthorizerWorld.blocks:type_name -> biscuit.format.schema.SnapshotBlock + 33, // 42: biscuit.format.schema.AuthorizerWorld.authorizerBlock:type_name -> biscuit.format.schema.SnapshotBlock + 23, // 43: biscuit.format.schema.AuthorizerWorld.authorizerPolicies:type_name -> biscuit.format.schema.Policy + 32, // 44: biscuit.format.schema.AuthorizerWorld.generatedFacts:type_name -> biscuit.format.schema.GeneratedFacts + 31, // 45: biscuit.format.schema.Origin.authorizer:type_name -> biscuit.format.schema.Empty + 30, // 46: biscuit.format.schema.GeneratedFacts.origins:type_name -> biscuit.format.schema.Origin + 13, // 47: biscuit.format.schema.GeneratedFacts.facts:type_name -> biscuit.format.schema.FactV2 + 13, // 48: biscuit.format.schema.SnapshotBlock.facts_v2:type_name -> biscuit.format.schema.FactV2 + 14, // 49: biscuit.format.schema.SnapshotBlock.rules_v2:type_name -> biscuit.format.schema.RuleV2 + 15, // 50: biscuit.format.schema.SnapshotBlock.checks_v2:type_name -> biscuit.format.schema.CheckV2 + 12, // 51: biscuit.format.schema.SnapshotBlock.scope:type_name -> biscuit.format.schema.Scope + 9, // 52: biscuit.format.schema.SnapshotBlock.externalKey:type_name -> biscuit.format.schema.PublicKey + 53, // [53:53] is the sub-list for method output_type + 53, // [53:53] is the sub-list for method input_type + 53, // [53:53] is the sub-list for extension type_name + 53, // [53:53] is the sub-list for extension extendee + 0, // [0:53] is the sub-list for field type_name } func init() { file_biscuit_proto_init() } @@ -1669,7 +2806,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublicKey); i { + switch v := v.(*ExternalSignature); i { case 0: return &v.state case 1: @@ -1681,7 +2818,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Proof); i { + switch v := v.(*PublicKey); i { case 0: return &v.state case 1: @@ -1693,7 +2830,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Block); i { + switch v := v.(*Proof); i { case 0: return &v.state case 1: @@ -1705,7 +2842,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FactV2); i { + switch v := v.(*Block); i { case 0: return &v.state case 1: @@ -1717,7 +2854,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RuleV2); i { + switch v := v.(*Scope); i { case 0: return &v.state case 1: @@ -1729,7 +2866,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckV2); i { + switch v := v.(*FactV2); i { case 0: return &v.state case 1: @@ -1741,7 +2878,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PredicateV2); i { + switch v := v.(*RuleV2); i { case 0: return &v.state case 1: @@ -1753,7 +2890,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TermV2); i { + switch v := v.(*CheckV2); i { case 0: return &v.state case 1: @@ -1765,7 +2902,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TermSet); i { + switch v := v.(*PredicateV2); i { case 0: return &v.state case 1: @@ -1777,7 +2914,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExpressionV2); i { + switch v := v.(*TermV2); i { case 0: return &v.state case 1: @@ -1789,7 +2926,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Op); i { + switch v := v.(*TermSet); i { case 0: return &v.state case 1: @@ -1801,7 +2938,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OpUnary); i { + switch v := v.(*ExpressionV2); i { case 0: return &v.state case 1: @@ -1813,7 +2950,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OpBinary); i { + switch v := v.(*Op); i { case 0: return &v.state case 1: @@ -1825,7 +2962,7 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Policy); i { + switch v := v.(*OpUnary); i { case 0: return &v.state case 1: @@ -1837,6 +2974,30 @@ func file_biscuit_proto_init() { } } file_biscuit_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OpBinary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Policy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AuthorizerPolicies); i { case 0: return &v.state @@ -1848,12 +3009,124 @@ func file_biscuit_proto_init() { return nil } } + file_biscuit_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ThirdPartyBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ThirdPartyBlockContents); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthorizerSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RunLimits); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthorizerWorld); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Origin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Empty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeneratedFacts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_biscuit_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SnapshotBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - file_biscuit_proto_msgTypes[3].OneofWrappers = []interface{}{ + file_biscuit_proto_msgTypes[4].OneofWrappers = []interface{}{ (*Proof_NextSecret)(nil), (*Proof_FinalSignature)(nil), } - file_biscuit_proto_msgTypes[9].OneofWrappers = []interface{}{ + file_biscuit_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*Scope_ScopeType_)(nil), + (*Scope_PublicKey)(nil), + } + file_biscuit_proto_msgTypes[11].OneofWrappers = []interface{}{ (*TermV2_Variable)(nil), (*TermV2_Integer)(nil), (*TermV2_String_)(nil), @@ -1862,18 +3135,22 @@ func file_biscuit_proto_init() { (*TermV2_Bool)(nil), (*TermV2_Set)(nil), } - file_biscuit_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_biscuit_proto_msgTypes[14].OneofWrappers = []interface{}{ (*Op_Value)(nil), (*Op_Unary)(nil), (*Op_Binary)(nil), } + file_biscuit_proto_msgTypes[24].OneofWrappers = []interface{}{ + (*Origin_Authorizer)(nil), + (*Origin_Origin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_biscuit_proto_rawDesc, - NumEnums: 4, - NumMessages: 17, + NumEnums: 6, + NumMessages: 28, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/biscuit.proto b/pb/biscuit.proto index b443c32..0f9816d 100644 --- a/pb/biscuit.proto +++ b/pb/biscuit.proto @@ -2,6 +2,8 @@ syntax = "proto2"; option go_package = ".;pb"; +package biscuit.format.schema; + message Biscuit { optional uint32 rootKeyId = 1; required SignedBlock authority = 2; @@ -13,6 +15,12 @@ message SignedBlock { required bytes block = 1; required PublicKey nextKey = 2; required bytes signature = 3; + optional ExternalSignature externalSignature = 4; +} + +message ExternalSignature { + required bytes signature = 1; + required PublicKey publicKey = 2; } message PublicKey { @@ -40,6 +48,20 @@ message Block { repeated FactV2 facts_v2 = 4; repeated RuleV2 rules_v2 = 5; repeated CheckV2 checks_v2 = 6; + repeated Scope scope = 7; + repeated PublicKey publicKeys = 8; +} + +message Scope { + enum ScopeType { + Authority = 0; + Previous = 1; + } + + oneof Content { + ScopeType scopeType = 1; + int64 publicKey = 2; + } } message FactV2 { @@ -50,10 +72,17 @@ message RuleV2 { required PredicateV2 head = 1; repeated PredicateV2 body = 2; repeated ExpressionV2 expressions = 3; + repeated Scope scope = 4; } message CheckV2 { repeated RuleV2 queries = 1; + optional Kind kind = 2; + + enum Kind { + One = 0; + All = 1; + } } message PredicateV2 { @@ -118,6 +147,10 @@ message OpBinary { Or = 14; Intersection = 15; Union = 16; + BitwiseAnd = 17; + BitwiseOr = 18; + BitwiseXor = 19; + NotEqual = 20; } required Kind kind = 1; @@ -141,3 +174,60 @@ message AuthorizerPolicies { repeated CheckV2 checks = 5; repeated Policy policies = 6; } + +message ThirdPartyBlockRequest { + required PublicKey previousKey = 1; + repeated PublicKey publicKeys = 2; +} + +message ThirdPartyBlockContents { + required bytes payload = 1; + required ExternalSignature externalSignature = 2; +} + +message AuthorizerSnapshot { + required RunLimits limits = 1; + required uint64 executionTime = 2; + required AuthorizerWorld world = 3; +} + +message RunLimits { + required uint64 maxFacts = 1; + required uint64 maxIterations = 2; + required uint64 maxTime = 3; +} + +message AuthorizerWorld { + optional uint32 version = 1; + repeated string symbols = 2; + repeated PublicKey publicKeys = 3; + repeated SnapshotBlock blocks = 4; + required SnapshotBlock authorizerBlock = 5; + repeated Policy authorizerPolicies = 6; + repeated GeneratedFacts generatedFacts = 7; + required uint64 iterations = 8; +} + +message Origin { + oneof Content { + Empty authorizer = 1; + uint32 origin = 2; + } +} + +message Empty {} + +message GeneratedFacts { + repeated Origin origins = 1; + repeated FactV2 facts = 2; +} + +message SnapshotBlock { + optional string context = 1; + optional uint32 version = 2; + repeated FactV2 facts_v2 = 3; + repeated RuleV2 rules_v2 = 4; + repeated CheckV2 checks_v2 = 5; + repeated Scope scope = 6; + optional PublicKey externalKey = 7; +} \ No newline at end of file diff --git a/samples/samples_test.go b/samples/samples_test.go index 78bb2a5..f2d33f9 100644 --- a/samples/samples_test.go +++ b/samples/samples_test.go @@ -141,13 +141,13 @@ type Validation struct { func CheckSample(root_key ed25519.PublicKey, c TestCase, t *testing.T) { // all these contain v4 blocks, which are not supported yet - if c.Filename == "test024_third_party.bc" || - c.Filename == "test025_check_all.bc" || - c.Filename == "test026_public_keys_interning.bc" || - c.Filename == "test027_integer_wraparound.bc" || - c.Filename == "test028_expressions_v4.bc" { - t.SkipNow() - } + // if c.Filename == "test024_third_party.bc" || + // c.Filename == "test025_check_all.bc" || + // c.Filename == "test026_public_keys_interning.bc" || + // c.Filename == "test027_integer_wraparound.bc" || + // c.Filename == "test028_expressions_v4.bc" { + // t.SkipNow() + // } fmt.Printf("Checking sample %s\n", c.Filename) b, err := os.ReadFile("./data/current/" + c.Filename) require.NoError(t, err) @@ -161,12 +161,13 @@ func CheckSample(root_key ed25519.PublicKey, c TestCase, t *testing.T) { } for _, v := range c.Validations { - CompareResult(root_key, c.Filename, *token, v, t) + CompareResult(root_key, *token, v, t) } } else { fmt.Println(err) fmt.Println(" Parsing failed, all validations must be errors") + // TODO: fix this logic, parsing may fail for the "wrong" reason and we should still detect it. See test027. for _, v := range c.Validations { require.Nil(t, v.Result.Ok) } @@ -182,7 +183,8 @@ func CompareBlocks(token biscuit.Biscuit, blocks []Block, t *testing.T) { authority, err := p.Block(blocks[0].Code, nil) require.NoError(t, err) builder := biscuit.NewBuilder(privateRoot) - builder.AddBlock(authority) + err = builder.AddBlock(authority) + require.NoError(t, err) r, err := builder.Build() require.NoError(t, err) rebuilt := *r @@ -191,7 +193,8 @@ func CompareBlocks(token biscuit.Biscuit, blocks []Block, t *testing.T) { parsed, err := p.Block(b.Code, nil) require.NoError(t, err) builder := rebuilt.CreateBlock() - builder.AddBlock(parsed) + err = builder.AddBlock(parsed) + require.NoError(t, err) r, err := rebuilt.Append(rng, builder.Build()) require.NoError(t, err) rebuilt = *r @@ -200,7 +203,7 @@ func CompareBlocks(token biscuit.Biscuit, blocks []Block, t *testing.T) { require.Equal(t, sample, rebuilt.Code()) } -func CompareResult(root_key ed25519.PublicKey, filename string, token biscuit.Biscuit, v Validation, t *testing.T) { +func CompareResult(root_key ed25519.PublicKey, token biscuit.Biscuit, v Validation, t *testing.T) { p := parser.New() authorizer_code, err := p.Authorizer(v.AuthorizerCode, nil) require.NoError(t, err) @@ -222,7 +225,9 @@ func CompareResult(root_key ed25519.PublicKey, filename string, token biscuit.Bi func CompareError(authorization_error error, sample_error *BiscuitError, t *testing.T) { error_string := authorization_error.Error() - if sample_error.Format != nil { + if sample_error == nil { + require.Fail(t, error_string) + } else if sample_error.Format != nil { require.Equal(t, error_string, "biscuit: invalid signature") } else if sample_error.FailedLogic != nil { if sample_error.FailedLogic.Unauthorized != nil { diff --git a/types.go b/types.go index 6c22ba9..dd0c418 100644 --- a/types.go +++ b/types.go @@ -11,7 +11,7 @@ import ( ) const MinSchemaVersion uint32 = 3 -const MaxSchemaVersion uint32 = 3 +const MaxSchemaVersion uint32 = 4 // defaultSymbolTable predefines some symbols available in every implementation, to avoid // transmitting them with every token @@ -324,7 +324,7 @@ const ( func (UnaryOp) Type() OpType { return OpTypeUnary } -func (op UnaryOp) convert(symbols *datalog.SymbolTable) datalog.Op { +func (op UnaryOp) convert(_ *datalog.SymbolTable) datalog.Op { switch op { case UnaryNegate: return datalog.UnaryOp{UnaryOpFunc: datalog.Negate{}} @@ -337,7 +337,7 @@ func (op UnaryOp) convert(symbols *datalog.SymbolTable) datalog.Op { } } -func fromDatalogUnaryOp(symbols *datalog.SymbolTable, dlUnary datalog.UnaryOp) (Op, error) { +func fromDatalogUnaryOp(_ *datalog.SymbolTable, dlUnary datalog.UnaryOp) (Op, error) { switch dlUnary.UnaryOpFunc.Type() { case datalog.UnaryNegate: return UnaryNegate, nil @@ -373,12 +373,16 @@ const ( BinaryOr BinaryIntersection BinaryUnion + BinaryBitwiseAnd + BinaryBitwiseOr + BinaryBitwiseXor + BinaryNotEqual ) func (BinaryOp) Type() OpType { return OpTypeBinary } -func (op BinaryOp) convert(symbols *datalog.SymbolTable) datalog.Op { +func (op BinaryOp) convert(_ *datalog.SymbolTable) datalog.Op { switch op { case BinaryLessThan: return datalog.BinaryOp{BinaryOpFunc: datalog.LessThan{}} @@ -414,12 +418,20 @@ func (op BinaryOp) convert(symbols *datalog.SymbolTable) datalog.Op { return datalog.BinaryOp{BinaryOpFunc: datalog.Intersection{}} case BinaryUnion: return datalog.BinaryOp{BinaryOpFunc: datalog.Union{}} + case BinaryBitwiseAnd: + return datalog.BinaryOp{BinaryOpFunc: datalog.BitwiseAnd{}} + case BinaryBitwiseOr: + return datalog.BinaryOp{BinaryOpFunc: datalog.BitwiseOr{}} + case BinaryBitwiseXor: + return datalog.BinaryOp{BinaryOpFunc: datalog.BitwiseXor{}} + case BinaryNotEqual: + return datalog.BinaryOp{BinaryOpFunc: datalog.NotEqual{}} default: panic(fmt.Sprintf("biscuit: cannot convert invalid binary op type: %v", op)) } } -func fromDatalogBinaryOp(symbols *datalog.SymbolTable, dbBinary datalog.BinaryOp) (Op, error) { +func fromDatalogBinaryOp(_ *datalog.SymbolTable, dbBinary datalog.BinaryOp) (Op, error) { switch dbBinary.BinaryOpFunc.Type() { case datalog.BinaryLessThan: return BinaryLessThan, nil @@ -455,13 +467,22 @@ func fromDatalogBinaryOp(symbols *datalog.SymbolTable, dbBinary datalog.BinaryOp return BinaryIntersection, nil case datalog.BinaryUnion: return BinaryUnion, nil + case datalog.BinaryBitwiseAnd: + return BinaryBitwiseAnd, nil + case datalog.BinaryBitwiseOr: + return BinaryBitwiseOr, nil + case datalog.BinaryBitwiseXor: + return BinaryBitwiseXor, nil + case datalog.BinaryNotEqual: + return BinaryNotEqual, nil default: return BinaryUndefined, fmt.Errorf("unsupported datalog binary op: %v", dbBinary.BinaryOpFunc.Type()) } } type Check struct { - Queries []Rule + CheckKind datalog.CheckKind + Queries []Rule } func (c Check) convert(symbols *datalog.SymbolTable) datalog.Check { @@ -471,7 +492,8 @@ func (c Check) convert(symbols *datalog.SymbolTable) datalog.Check { } return datalog.Check{ - Queries: queries, + CheckKind: c.CheckKind, + Queries: queries, } } @@ -486,7 +508,8 @@ func fromDatalogCheck(symbols *datalog.SymbolTable, dlCheck datalog.Check) (*Che } return &Check{ - Queries: queries, + CheckKind: dlCheck.CheckKind, + Queries: queries, }, nil } @@ -544,7 +567,7 @@ func (a Variable) String() string { return fmt.Sprintf("$%s", string(a)) } type Integer int64 func (a Integer) Type() TermType { return TermTypeInteger } -func (a Integer) convert(symbols *datalog.SymbolTable) datalog.Term { +func (a Integer) convert(_ *datalog.SymbolTable) datalog.Term { return datalog.Integer(a) } func (a Integer) String() string { return fmt.Sprintf("%d", a) } @@ -560,7 +583,7 @@ func (a String) String() string { return fmt.Sprintf("%q", string(a)) } type Date time.Time func (a Date) Type() TermType { return TermTypeDate } -func (a Date) convert(symbols *datalog.SymbolTable) datalog.Term { +func (a Date) convert(_ *datalog.SymbolTable) datalog.Term { return datalog.Date(time.Time(a).Unix()) } func (a Date) String() string { return time.Time(a).Format(time.RFC3339) } @@ -568,7 +591,7 @@ func (a Date) String() string { return time.Time(a).Format(time.RFC3339) } type Bytes []byte func (a Bytes) Type() TermType { return TermTypeBytes } -func (a Bytes) convert(symbols *datalog.SymbolTable) datalog.Term { +func (a Bytes) convert(_ *datalog.SymbolTable) datalog.Term { return datalog.Bytes(a) } func (a Bytes) String() string { return fmt.Sprintf("hex:%s", hex.EncodeToString(a)) } @@ -576,7 +599,7 @@ func (a Bytes) String() string { return fmt.Sprintf("hex:%s", hex.EncodeToString type Bool bool func (b Bool) Type() TermType { return TermTypeBool } -func (b Bool) convert(symbols *datalog.SymbolTable) datalog.Term { +func (b Bool) convert(_ *datalog.SymbolTable) datalog.Term { return datalog.Bool(b) } func (b Bool) String() string { return fmt.Sprintf("%t", b) }