cmpb/
accesscontrol.rs

1/// Policy used to describe how to authenticate a specific action
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Policy {
5    /// rule keywords, e.g., ANY/MAJORITY/ALL/SELF/a number/a rate
6    #[prost(string, tag = "1")]
7    pub rule: ::prost::alloc::string::String,
8    /// org_list describes the organization set included in the authentication
9    #[prost(string, repeated, tag = "2")]
10    pub org_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
11    /// role_list describes the role set included in the authentication
12    /// e.g., admin/client/consensus/common
13    #[prost(string, repeated, tag = "3")]
14    pub role_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
15}
16/// online member of blockchain
17#[allow(clippy::derive_partial_eq_without_eq)]
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Member {
20    /// organization identifier of the member
21    #[prost(string, tag = "1")]
22    pub org_id: ::prost::alloc::string::String,
23    /// member type
24    #[prost(enumeration = "MemberType", tag = "2")]
25    pub member_type: i32,
26    /// member identity related info bytes
27    #[prost(bytes = "vec", tag = "3")]
28    pub member_info: ::prost::alloc::vec::Vec<u8>,
29}
30/// full attribute member of blockchain
31#[allow(clippy::derive_partial_eq_without_eq)]
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct MemberFull {
34    /// organization identifier of the member
35    #[prost(string, tag = "1")]
36    pub org_id: ::prost::alloc::string::String,
37    /// member type
38    #[prost(enumeration = "MemberType", tag = "2")]
39    pub member_type: i32,
40    /// member identity related info bytes
41    #[prost(bytes = "vec", tag = "3")]
42    pub member_info: ::prost::alloc::vec::Vec<u8>,
43    /// the identity of this member (non-uniqueness)
44    #[prost(string, tag = "4")]
45    pub member_id: ::prost::alloc::string::String,
46    /// role of this member
47    #[prost(string, tag = "5")]
48    pub role: ::prost::alloc::string::String,
49    /// the identity of this member (unique)
50    #[prost(string, tag = "6")]
51    pub uid: ::prost::alloc::string::String,
52}
53/// member extra data
54#[allow(clippy::derive_partial_eq_without_eq)]
55#[derive(Clone, PartialEq, ::prost::Message)]
56pub struct MemberExtraData {
57    /// sequence, like ethereum account nonce, by default is 0
58    ///
59    /// others
60    #[prost(uint64, tag = "1")]
61    pub sequence: u64,
62}
63#[allow(clippy::derive_partial_eq_without_eq)]
64#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct MemberAndExtraData {
66    #[prost(message, optional, tag = "1")]
67    pub member: ::core::option::Option<Member>,
68    #[prost(message, optional, tag = "2")]
69    pub extra_data: ::core::option::Option<MemberExtraData>,
70}
71/// public key member's info
72#[allow(clippy::derive_partial_eq_without_eq)]
73#[derive(Clone, PartialEq, ::prost::Message)]
74pub struct PkInfo {
75    /// the der of the public key
76    #[prost(bytes = "vec", tag = "1")]
77    pub pk_bytes: ::prost::alloc::vec::Vec<u8>,
78    /// member role
79    #[prost(string, tag = "2")]
80    pub role: ::prost::alloc::string::String,
81    /// member's org_id
82    #[prost(string, tag = "3")]
83    pub org_id: ::prost::alloc::string::String,
84}
85#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
86#[repr(i32)]
87pub enum MemberType {
88    /// X509 cert
89    Cert = 0,
90    /// cert hash
91    CertHash = 1,
92    /// public key
93    PublicKey = 2,
94    /// did
95    Did = 3,
96    /// alias
97    Alias = 4,
98    /// address
99    Addr = 5,
100}
101impl MemberType {
102    /// String value of the enum field names used in the ProtoBuf definition.
103    ///
104    /// The values are not transformed in any way and thus are considered stable
105    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
106    pub fn as_str_name(&self) -> &'static str {
107        match self {
108            MemberType::Cert => "CERT",
109            MemberType::CertHash => "CERT_HASH",
110            MemberType::PublicKey => "PUBLIC_KEY",
111            MemberType::Did => "DID",
112            MemberType::Alias => "ALIAS",
113            MemberType::Addr => "ADDR",
114        }
115    }
116    /// Creates an enum from field names used in the ProtoBuf definition.
117    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
118        match value {
119            "CERT" => Some(Self::Cert),
120            "CERT_HASH" => Some(Self::CertHash),
121            "PUBLIC_KEY" => Some(Self::PublicKey),
122            "DID" => Some(Self::Did),
123            "ALIAS" => Some(Self::Alias),
124            "ADDR" => Some(Self::Addr),
125            _ => None,
126        }
127    }
128}
129/// member status
130#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
131#[repr(i32)]
132pub enum MemberStatus {
133    /// member's status is normal
134    Normal = 0,
135    /// member's status is invalid
136    Invalid = 1,
137    /// member's status is revoked
138    Revoked = 2,
139    /// member's status is frozen
140    Frozen = 3,
141}
142impl MemberStatus {
143    /// String value of the enum field names used in the ProtoBuf definition.
144    ///
145    /// The values are not transformed in any way and thus are considered stable
146    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
147    pub fn as_str_name(&self) -> &'static str {
148        match self {
149            MemberStatus::Normal => "NORMAL",
150            MemberStatus::Invalid => "INVALID",
151            MemberStatus::Revoked => "REVOKED",
152            MemberStatus::Frozen => "FROZEN",
153        }
154    }
155    /// Creates an enum from field names used in the ProtoBuf definition.
156    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
157        match value {
158            "NORMAL" => Some(Self::Normal),
159            "INVALID" => Some(Self::Invalid),
160            "REVOKED" => Some(Self::Revoked),
161            "FROZEN" => Some(Self::Frozen),
162            _ => None,
163        }
164    }
165}
166/// verify the member's relevant identity material type
167#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
168#[repr(i32)]
169pub enum VerifyType {
170    /// CRL
171    Crl = 0,
172}
173impl VerifyType {
174    /// String value of the enum field names used in the ProtoBuf definition.
175    ///
176    /// The values are not transformed in any way and thus are considered stable
177    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
178    pub fn as_str_name(&self) -> &'static str {
179        match self {
180            VerifyType::Crl => "CRL",
181        }
182    }
183    /// Creates an enum from field names used in the ProtoBuf definition.
184    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
185        match value {
186            "CRL" => Some(Self::Crl),
187            _ => None,
188        }
189    }
190}