@@ -7,27 +7,29 @@ pub mod mix_node {
77 use super :: * ;
88
99 use axum:: extract:: { DefaultBodyLimit , Request , State } ;
10+ use axum:: http:: StatusCode ;
1011 use axum:: middleware:: { self , Next } ;
1112 use axum:: response:: { IntoResponse , Response } ;
1213 use axum:: { response:: Json , routing:: post, Router } ;
13- use axum:: http:: StatusCode ;
1414 use axum_extra:: headers:: authorization:: Bearer ;
1515 use axum_extra:: headers:: Authorization ;
1616 use axum_extra:: TypedHeader ;
1717 use rand:: { rngs:: StdRng , SeedableRng } ;
1818 use rust_elgamal:: { Ciphertext , EncryptionKey , RistrettoPoint } ;
1919 use serde:: { Deserialize , Deserializer , Serialize } ;
20- use tower_http:: trace:: TraceLayer ;
2120 use std:: sync:: OnceLock ;
21+ use tower_http:: trace:: TraceLayer ;
2222
2323 #[ derive( Debug , Clone ) ]
2424 pub struct AppState {
25- auth_token : Option < String > ,
25+ auth_token : Option < & ' static str > ,
2626 }
2727
2828 impl AppState {
2929 pub fn new ( auth_token : Option < String > ) -> Self {
30- Self { auth_token }
30+ Self {
31+ auth_token : auth_token. map ( |s| s. leak ( ) as & ' _ str ) ,
32+ }
3133 }
3234 }
3335
@@ -55,7 +57,7 @@ pub mod mix_node {
5557 #[ tracing:: instrument(
5658 skip( codes) ,
5759 fields(
58- x_code. len = codes. x_code. len( ) ,
60+ x_code. len = codes. x_code. len( ) ,
5961 y_code. len = codes. y_code. len( ) ,
6062 enc_key = ?codes. enc_key,
6163 )
@@ -93,7 +95,7 @@ pub mod mix_node {
9395 match ( auth_token, auth_header) {
9496 // AUTH_TOKEN is set on the server and in the request header so we check
9597 ( Some ( auth_token) , Some ( TypedHeader ( header_auth_token) ) )
96- if auth_token == header_auth_token. token ( ) =>
98+ if * auth_token == * header_auth_token. token ( ) =>
9799 {
98100 next_run. await
99101 }
0 commit comments