biscuit_auth/format/
schema.rs

1#[derive(Clone, PartialEq, ::prost::Message)]
2pub struct Biscuit {
3    #[prost(uint32, optional, tag="1")]
4    pub root_key_id: ::core::option::Option<u32>,
5    #[prost(message, required, tag="2")]
6    pub authority: SignedBlock,
7    #[prost(message, repeated, tag="3")]
8    pub blocks: ::prost::alloc::vec::Vec<SignedBlock>,
9    #[prost(message, required, tag="4")]
10    pub proof: Proof,
11}
12#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct SignedBlock {
14    #[prost(bytes="vec", required, tag="1")]
15    pub block: ::prost::alloc::vec::Vec<u8>,
16    #[prost(message, required, tag="2")]
17    pub next_key: PublicKey,
18    #[prost(bytes="vec", required, tag="3")]
19    pub signature: ::prost::alloc::vec::Vec<u8>,
20    #[prost(message, optional, tag="4")]
21    pub external_signature: ::core::option::Option<ExternalSignature>,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct ExternalSignature {
25    #[prost(bytes="vec", required, tag="1")]
26    pub signature: ::prost::alloc::vec::Vec<u8>,
27    #[prost(message, required, tag="2")]
28    pub public_key: PublicKey,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct PublicKey {
32    #[prost(enumeration="public_key::Algorithm", required, tag="1")]
33    pub algorithm: i32,
34    #[prost(bytes="vec", required, tag="2")]
35    pub key: ::prost::alloc::vec::Vec<u8>,
36}
37/// Nested message and enum types in `PublicKey`.
38pub mod public_key {
39    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
40    #[repr(i32)]
41    pub enum Algorithm {
42        Ed25519 = 0,
43    }
44}
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct Proof {
47    #[prost(oneof="proof::Content", tags="1, 2")]
48    pub content: ::core::option::Option<proof::Content>,
49}
50/// Nested message and enum types in `Proof`.
51pub mod proof {
52    #[derive(Clone, PartialEq, ::prost::Oneof)]
53    pub enum Content {
54        #[prost(bytes, tag="1")]
55        NextSecret(::prost::alloc::vec::Vec<u8>),
56        #[prost(bytes, tag="2")]
57        FinalSignature(::prost::alloc::vec::Vec<u8>),
58    }
59}
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct Block {
62    #[prost(string, repeated, tag="1")]
63    pub symbols: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
64    #[prost(string, optional, tag="2")]
65    pub context: ::core::option::Option<::prost::alloc::string::String>,
66    #[prost(uint32, optional, tag="3")]
67    pub version: ::core::option::Option<u32>,
68    #[prost(message, repeated, tag="4")]
69    pub facts_v2: ::prost::alloc::vec::Vec<FactV2>,
70    #[prost(message, repeated, tag="5")]
71    pub rules_v2: ::prost::alloc::vec::Vec<RuleV2>,
72    #[prost(message, repeated, tag="6")]
73    pub checks_v2: ::prost::alloc::vec::Vec<CheckV2>,
74    #[prost(message, repeated, tag="7")]
75    pub scope: ::prost::alloc::vec::Vec<Scope>,
76    #[prost(message, repeated, tag="8")]
77    pub public_keys: ::prost::alloc::vec::Vec<PublicKey>,
78}
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct Scope {
81    #[prost(oneof="scope::Content", tags="1, 2")]
82    pub content: ::core::option::Option<scope::Content>,
83}
84/// Nested message and enum types in `Scope`.
85pub mod scope {
86    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
87    #[repr(i32)]
88    pub enum ScopeType {
89        Authority = 0,
90        Previous = 1,
91    }
92    #[derive(Clone, PartialEq, ::prost::Oneof)]
93    pub enum Content {
94        #[prost(enumeration="ScopeType", tag="1")]
95        ScopeType(i32),
96        #[prost(int64, tag="2")]
97        PublicKey(i64),
98    }
99}
100#[derive(Clone, PartialEq, ::prost::Message)]
101pub struct FactV2 {
102    #[prost(message, required, tag="1")]
103    pub predicate: PredicateV2,
104}
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct RuleV2 {
107    #[prost(message, required, tag="1")]
108    pub head: PredicateV2,
109    #[prost(message, repeated, tag="2")]
110    pub body: ::prost::alloc::vec::Vec<PredicateV2>,
111    #[prost(message, repeated, tag="3")]
112    pub expressions: ::prost::alloc::vec::Vec<ExpressionV2>,
113    #[prost(message, repeated, tag="4")]
114    pub scope: ::prost::alloc::vec::Vec<Scope>,
115}
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct CheckV2 {
118    #[prost(message, repeated, tag="1")]
119    pub queries: ::prost::alloc::vec::Vec<RuleV2>,
120    #[prost(enumeration="check_v2::Kind", optional, tag="2")]
121    pub kind: ::core::option::Option<i32>,
122}
123/// Nested message and enum types in `CheckV2`.
124pub mod check_v2 {
125    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
126    #[repr(i32)]
127    pub enum Kind {
128        One = 0,
129        All = 1,
130    }
131}
132#[derive(Clone, PartialEq, ::prost::Message)]
133pub struct PredicateV2 {
134    #[prost(uint64, required, tag="1")]
135    pub name: u64,
136    #[prost(message, repeated, tag="2")]
137    pub terms: ::prost::alloc::vec::Vec<TermV2>,
138}
139#[derive(Clone, PartialEq, ::prost::Message)]
140pub struct TermV2 {
141    #[prost(oneof="term_v2::Content", tags="1, 2, 3, 4, 5, 6, 7")]
142    pub content: ::core::option::Option<term_v2::Content>,
143}
144/// Nested message and enum types in `TermV2`.
145pub mod term_v2 {
146    #[derive(Clone, PartialEq, ::prost::Oneof)]
147    pub enum Content {
148        #[prost(uint32, tag="1")]
149        Variable(u32),
150        #[prost(int64, tag="2")]
151        Integer(i64),
152        #[prost(uint64, tag="3")]
153        String(u64),
154        #[prost(uint64, tag="4")]
155        Date(u64),
156        #[prost(bytes, tag="5")]
157        Bytes(::prost::alloc::vec::Vec<u8>),
158        #[prost(bool, tag="6")]
159        Bool(bool),
160        #[prost(message, tag="7")]
161        Set(super::TermSet),
162    }
163}
164#[derive(Clone, PartialEq, ::prost::Message)]
165pub struct TermSet {
166    #[prost(message, repeated, tag="1")]
167    pub set: ::prost::alloc::vec::Vec<TermV2>,
168}
169#[derive(Clone, PartialEq, ::prost::Message)]
170pub struct ExpressionV2 {
171    #[prost(message, repeated, tag="1")]
172    pub ops: ::prost::alloc::vec::Vec<Op>,
173}
174#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct Op {
176    #[prost(oneof="op::Content", tags="1, 2, 3")]
177    pub content: ::core::option::Option<op::Content>,
178}
179/// Nested message and enum types in `Op`.
180pub mod op {
181    #[derive(Clone, PartialEq, ::prost::Oneof)]
182    pub enum Content {
183        #[prost(message, tag="1")]
184        Value(super::TermV2),
185        #[prost(message, tag="2")]
186        Unary(super::OpUnary),
187        #[prost(message, tag="3")]
188        Binary(super::OpBinary),
189    }
190}
191#[derive(Clone, PartialEq, ::prost::Message)]
192pub struct OpUnary {
193    #[prost(enumeration="op_unary::Kind", required, tag="1")]
194    pub kind: i32,
195}
196/// Nested message and enum types in `OpUnary`.
197pub mod op_unary {
198    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
199    #[repr(i32)]
200    pub enum Kind {
201        Negate = 0,
202        Parens = 1,
203        Length = 2,
204    }
205}
206#[derive(Clone, PartialEq, ::prost::Message)]
207pub struct OpBinary {
208    #[prost(enumeration="op_binary::Kind", required, tag="1")]
209    pub kind: i32,
210}
211/// Nested message and enum types in `OpBinary`.
212pub mod op_binary {
213    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
214    #[repr(i32)]
215    pub enum Kind {
216        LessThan = 0,
217        GreaterThan = 1,
218        LessOrEqual = 2,
219        GreaterOrEqual = 3,
220        Equal = 4,
221        Contains = 5,
222        Prefix = 6,
223        Suffix = 7,
224        Regex = 8,
225        Add = 9,
226        Sub = 10,
227        Mul = 11,
228        Div = 12,
229        And = 13,
230        Or = 14,
231        Intersection = 15,
232        Union = 16,
233        BitwiseAnd = 17,
234        BitwiseOr = 18,
235        BitwiseXor = 19,
236        NotEqual = 20,
237    }
238}
239#[derive(Clone, PartialEq, ::prost::Message)]
240pub struct Policy {
241    #[prost(message, repeated, tag="1")]
242    pub queries: ::prost::alloc::vec::Vec<RuleV2>,
243    #[prost(enumeration="policy::Kind", required, tag="2")]
244    pub kind: i32,
245}
246/// Nested message and enum types in `Policy`.
247pub mod policy {
248    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
249    #[repr(i32)]
250    pub enum Kind {
251        Allow = 0,
252        Deny = 1,
253    }
254}
255#[derive(Clone, PartialEq, ::prost::Message)]
256pub struct AuthorizerPolicies {
257    #[prost(string, repeated, tag="1")]
258    pub symbols: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
259    #[prost(uint32, optional, tag="2")]
260    pub version: ::core::option::Option<u32>,
261    #[prost(message, repeated, tag="3")]
262    pub facts: ::prost::alloc::vec::Vec<FactV2>,
263    #[prost(message, repeated, tag="4")]
264    pub rules: ::prost::alloc::vec::Vec<RuleV2>,
265    #[prost(message, repeated, tag="5")]
266    pub checks: ::prost::alloc::vec::Vec<CheckV2>,
267    #[prost(message, repeated, tag="6")]
268    pub policies: ::prost::alloc::vec::Vec<Policy>,
269}
270#[derive(Clone, PartialEq, ::prost::Message)]
271pub struct ThirdPartyBlockRequest {
272    #[prost(message, required, tag="1")]
273    pub previous_key: PublicKey,
274    #[prost(message, repeated, tag="2")]
275    pub public_keys: ::prost::alloc::vec::Vec<PublicKey>,
276}
277#[derive(Clone, PartialEq, ::prost::Message)]
278pub struct ThirdPartyBlockContents {
279    #[prost(bytes="vec", required, tag="1")]
280    pub payload: ::prost::alloc::vec::Vec<u8>,
281    #[prost(message, required, tag="2")]
282    pub external_signature: ExternalSignature,
283}
284#[derive(Clone, PartialEq, ::prost::Message)]
285pub struct AuthorizerSnapshot {
286    #[prost(message, required, tag="1")]
287    pub limits: RunLimits,
288    #[prost(uint64, required, tag="2")]
289    pub execution_time: u64,
290    #[prost(message, required, tag="3")]
291    pub world: AuthorizerWorld,
292}
293#[derive(Clone, PartialEq, ::prost::Message)]
294pub struct RunLimits {
295    #[prost(uint64, required, tag="1")]
296    pub max_facts: u64,
297    #[prost(uint64, required, tag="2")]
298    pub max_iterations: u64,
299    #[prost(uint64, required, tag="3")]
300    pub max_time: u64,
301}
302#[derive(Clone, PartialEq, ::prost::Message)]
303pub struct AuthorizerWorld {
304    #[prost(uint32, optional, tag="1")]
305    pub version: ::core::option::Option<u32>,
306    #[prost(string, repeated, tag="2")]
307    pub symbols: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
308    #[prost(message, repeated, tag="3")]
309    pub public_keys: ::prost::alloc::vec::Vec<PublicKey>,
310    #[prost(message, repeated, tag="4")]
311    pub blocks: ::prost::alloc::vec::Vec<SnapshotBlock>,
312    #[prost(message, required, tag="5")]
313    pub authorizer_block: SnapshotBlock,
314    #[prost(message, repeated, tag="6")]
315    pub authorizer_policies: ::prost::alloc::vec::Vec<Policy>,
316    #[prost(message, repeated, tag="7")]
317    pub generated_facts: ::prost::alloc::vec::Vec<GeneratedFacts>,
318    #[prost(uint64, required, tag="8")]
319    pub iterations: u64,
320}
321#[derive(Clone, PartialEq, ::prost::Message)]
322pub struct Origin {
323    #[prost(oneof="origin::Content", tags="1, 2")]
324    pub content: ::core::option::Option<origin::Content>,
325}
326/// Nested message and enum types in `Origin`.
327pub mod origin {
328    #[derive(Clone, PartialEq, ::prost::Oneof)]
329    pub enum Content {
330        #[prost(message, tag="1")]
331        Authorizer(super::Empty),
332        #[prost(uint32, tag="2")]
333        Origin(u32),
334    }
335}
336#[derive(Clone, PartialEq, ::prost::Message)]
337pub struct Empty {
338}
339#[derive(Clone, PartialEq, ::prost::Message)]
340pub struct GeneratedFacts {
341    #[prost(message, repeated, tag="1")]
342    pub origins: ::prost::alloc::vec::Vec<Origin>,
343    #[prost(message, repeated, tag="2")]
344    pub facts: ::prost::alloc::vec::Vec<FactV2>,
345}
346#[derive(Clone, PartialEq, ::prost::Message)]
347pub struct SnapshotBlock {
348    #[prost(string, optional, tag="1")]
349    pub context: ::core::option::Option<::prost::alloc::string::String>,
350    #[prost(uint32, optional, tag="2")]
351    pub version: ::core::option::Option<u32>,
352    #[prost(message, repeated, tag="3")]
353    pub facts_v2: ::prost::alloc::vec::Vec<FactV2>,
354    #[prost(message, repeated, tag="4")]
355    pub rules_v2: ::prost::alloc::vec::Vec<RuleV2>,
356    #[prost(message, repeated, tag="5")]
357    pub checks_v2: ::prost::alloc::vec::Vec<CheckV2>,
358    #[prost(message, repeated, tag="6")]
359    pub scope: ::prost::alloc::vec::Vec<Scope>,
360    #[prost(message, optional, tag="7")]
361    pub external_key: ::core::option::Option<PublicKey>,
362}