Remove unneeded logs
parent: tbd commit: cfba404
1 | use Error; |
2 | use Future; |
3 | |
4 | use Instance; |
5 | |
6 | use User; |
7 | |
8 | use |
9 | AuthenticatedPayload, AuthenticationSource, UserTokenMetadata, |
10 | ; |
11 | use ; |
12 | use |
13 | , | DecodeRsaPublicKey
14 | , |
15 | , | Sha256
16 | , | Verifier
17 | RsaPublicKey, |
18 | ; |
19 | use ; |
20 | use ; |
21 | |
22 | use crate ConnectionState; |
23 | |
24 | ; |
25 | |
26 | |
27 | type Target = ; |
28 | |
29 | |
30 | &self.0 |
31 | |
32 | |
33 | |
34 | ; |
35 | |
36 | |
37 | |
38 | |
39 | Missing, |
40 | // #[error("{0}")] |
41 | // InstanceAuthentication(#[from] Error), |
42 | |
43 | InvalidToken, |
44 | |
45 | Other, |
46 | |
47 | |
48 | ; |
49 | |
50 | |
51 | |
52 | &self.0 |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | async ; |
59 | |
60 | |
61 | |
62 | |
63 | async |
64 | network_message: &NetworkMessage, |
65 | state: &ConnectionState, |
66 | |
67 | let message: AuthenticatedPayload = |
68 | map_err?; | from_slice .
69 | |
70 | let = message |
71 | .source |
72 | .iter |
73 | .filter_map |
74 | if let User = auth |
75 | Some |
76 | else |
77 | None |
78 | |
79 | |
80 | .next |
81 | .ok_or_else?; |
82 | |
83 | let authenticated_instance = |
84 | ?; | from_message .await
85 | |
86 | let public_key_raw = state.public_key .await?; |
87 | let verification_key = from_rsa_pem .unwrap; |
88 | |
89 | let data: = decode |
90 | auth_token.as_ref, |
91 | &verification_key, |
92 | & new, |
93 | |
94 | .unwrap; |
95 | |
96 | if data.claims.user != *auth_user |
97 | || data.claims.generated_for != *authenticated_instance.inner |
98 | |
99 | Err |
100 | else |
101 | Ok |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | async |
109 | network_message: &NetworkMessage, |
110 | state: &ConnectionState, |
111 | |
112 | let message: AuthenticatedPayload = |
113 | map_err?; | from_slice .
114 | |
115 | let = message |
116 | .source |
117 | .iter |
118 | .filter_map |
119 | if let Instance |
120 | instance, |
121 | signature, |
122 | = auth |
123 | |
124 | Some |
125 | else |
126 | None |
127 | |
128 | |
129 | .next |
130 | // TODO: Instance authentication error |
131 | .ok_or_else?; |
132 | |
133 | let public_key = from_pkcs1_pem .unwrap; |
134 | |
135 | let verifying_key: = new; |
136 | |
137 | verifying_key.verify |
138 | &message.payload, |
139 | & try_from .unwrap, |
140 | ?; |
141 | |
142 | Ok |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | T: , |
150 | S: Send + Sync + 'static, |
151 | |
152 | async |
153 | Ok |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | async ; |
160 | |
161 | |
162 | |
163 | |
164 | T: FnOnce(T1) -> F + Clone + Send + 'static, |
165 | F: + Send, |
166 | T1: + Send, |
167 | S: Send + Sync, |
168 | E: Error + Send + Sync + 'static, |
169 | |
170 | async |
171 | let value = T1 from_message .await?; |
172 | self .await.map_err |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | T: FnOnce(T1, T2) -> F + Clone + Send + 'static, |
180 | F: + Send, |
181 | T1: + Send, |
182 | T2: + Send, |
183 | S: Send + Sync, |
184 | E: Error + Send + Sync + 'static, |
185 | |
186 | async |
187 | let value = T1 from_message .await?; |
188 | let value_2 = T2 from_message .await?; |
189 | self .await.map_err |
190 | |
191 | |
192 | |
193 | |
194 | |
195 | |
196 | T: FnOnce(T1, T2, T3) -> F + Clone + Send + 'static, |
197 | F: + Send, |
198 | T1: + Send, |
199 | T2: + Send, |
200 | T3: + Send, |
201 | S: Send + Sync, |
202 | E: Error + Send + Sync + 'static, |
203 | |
204 | async |
205 | let value = T1 from_message .await?; |
206 | let value_2 = T2 from_message .await?; |
207 | let value_3 = T3 from_message .await?; |
208 | |
209 | self |
210 | .await |
211 | .map_err |
212 | |
213 | |
214 | |
215 | ; |
216 | |
217 | |
218 | |
219 | |
220 | T: Clone + Send + Sync, |
221 | |
222 | async |
223 | Ok |
224 | |
225 | |
226 | |
227 | // Temp |
228 | |
229 | |
230 | |
231 | T: DeserializeOwned + Send + Sync + Serialize + Debug, |
232 | S: Clone + Send + Sync, |
233 | |
234 | async |
235 | let payload: AuthenticatedPayload = from_slice?; |
236 | let payload = deserialize?; |
237 | |
238 | Ok |
239 | |
240 | |
241 | |
242 | ; |
243 | |
244 | /// Handshake-specific message type. |
245 | /// |
246 | /// Uses basic serde_json-based deserialization to maintain the highest |
247 | /// level of compatibility across versions. |
248 | ; |
249 | |
250 | |
251 | |
252 | |
253 | T: DeserializeOwned + Send + Sync + Serialize, |
254 | S: Clone + Send + Sync, |
255 | |
256 | async |
257 | Ok |
258 | |
259 | |
260 |