Progress on refactor
parent: tbd commit: c9f076f
1 | use Debug; |
2 | |
3 | use |
4 | , | DecodeRsaPrivateKey
5 | , | SigningKey
6 | , | Sha256
7 | , |
8 | RsaPrivateKey, |
9 | ; |
10 | use ; |
11 | use Value; |
12 | use info; |
13 | |
14 | use crate |
15 | AnyObject, AnyOperation, GiteratedMessage, GiteratedObject, GiteratedOperation, |
16 | ; |
17 | |
18 | use ; |
19 | |
20 | |
21 | |
22 | pub user: User, |
23 | pub generated_for: Instance, |
24 | pub exp: u64, |
25 | |
26 | |
27 | |
28 | |
29 | pub source: , |
30 | pub message: , |
31 | |
32 | |
33 | |
34 | |
35 | pub source: , |
36 | pub object: String, |
37 | pub operation: String, |
38 | pub payload: , |
39 | |
40 | |
41 | |
42 | |
43 | GiteratedMessage |
44 | object: AnyObject, |
45 | operation: self.operation, |
46 | payload: AnyOperation, |
47 | |
48 | |
49 | |
50 | |
51 | // impl<T: Serialize> From<Authenticated<T>> for AuthenticatedPayload { |
52 | // fn from(mut value: Authenticated<T>) -> Self { |
53 | // let payload = bincode::serialize(&value.message).unwrap(); |
54 | |
55 | // AuthenticatedPayload { |
56 | // target_instance: value.target_instance, |
57 | // source: value |
58 | // .source |
59 | // .drain(..) |
60 | // .map(|provider| provider.as_ref().authenticate(&payload)) |
61 | // .collect::<Vec<_>>(), |
62 | // message_type: value.message_type, |
63 | // payload, |
64 | // } |
65 | // } |
66 | // } |
67 | |
68 | |
69 | ; |
70 | |
71 | |
72 | |
73 | ; |
74 | |
75 | |
76 | |
77 | |
78 | A: AuthenticationSourceProvider, |
79 | |
80 | |
81 | vec! |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | A: AuthenticationSourceProvider, |
88 | B: AuthenticationSourceProvider, |
89 | |
90 | |
91 | let = self; |
92 | |
93 | vec! |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | Self |
100 | source: vec!, |
101 | message, |
102 | |
103 | |
104 | |
105 | |
106 | &mut self, |
107 | authentication: P, |
108 | |
109 | let message_payload = to_vec .unwrap; |
110 | |
111 | info! |
112 | "Verifying payload: {}", |
113 | unwrap | from_utf8 .
114 | ; |
115 | |
116 | self.source |
117 | .push; |
118 | |
119 | |
120 | |
121 | let payload = serialize .unwrap; |
122 | |
123 | AuthenticatedPayload |
124 | object: self.message.object.to_string, |
125 | operation: self.message.operation, |
126 | source: self |
127 | .source |
128 | .drain |
129 | .map |
130 | ., |
131 | payload, |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | pub user: User, |
141 | pub token: UserAuthenticationToken, |
142 | |
143 | |
144 | |
145 | |
146 | User |
147 | user: self.user.clone, |
148 | token: self.token.clone, |
149 | |
150 | |
151 | |
152 | |
153 | |
154 | |
155 | pub instance: Instance, |
156 | pub private_key: String, |
157 | |
158 | |
159 | |
160 | |
161 | let mut rng = thread_rng; |
162 | |
163 | let private_key = from_pkcs1_pem .unwrap; |
164 | let signing_key = new; |
165 | let signature = signing_key.sign_with_rng; |
166 | |
167 | Instance |
168 | instance: self.instance.clone, |
169 | // TODO: Actually parse signature from private key |
170 | signature: InstanceSignature, |
171 | |
172 | |
173 | |
174 | |
175 | |
176 | |
177 | ; |
178 | |
179 | |
180 | |
181 | Self |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | self.0.clone |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | &self.0 |
194 | |
195 | |
196 | |
197 | |
198 | ; |
199 | |
200 | |
201 | |
202 | &self.0 |
203 | |
204 | |
205 | |
206 | |
207 | |
208 | User |
209 | user: User, |
210 | token: UserAuthenticationToken, |
211 | , |
212 | Instance |
213 | instance: Instance, |
214 | signature: InstanceSignature, |
215 | , |
216 | |
217 |