// Generate a one-time token, store it in the cache, and return it on the reply-to
Generate a one-time token, store it in the cache, and return it on the reply-to
Generate a one - time token store it in the cache and return it on the reply - to
fn gen_ott(msg: nats::Message, con: &mut redis::Connection, expiration_seconds: u32) {
    info!("Generating OTT");
    let req: TokenRequest = serde_json::from_slice(&msg.data).unwrap();
    let ott = nuid::next().to_string().to_uppercase();
    let _: bool = con
        .set_ex(ott_key(&ott), req.account_key, expiration_seconds as usize)
        .unwrap();
    msg.respond(ott.as_bytes()).unwrap();
}
fn gen_ott ( msg : nats :: Message , con : & mut redis :: Connection , expiration_seconds : u32 ) { info ! ( " " ) ; let req : TokenRequest = serde_json :: from_slice ( & msg . data ) . unwrap ( ) ; let ott = nuid :: next ( ) . to_string ( ) . to_uppercase ( ) ; let _ : bool = con . set_ex ( ott_key ( & ott ) , req . account_key , expiration_seconds as usize ) . unwrap ( ) ; msg . respond ( ott . as_bytes ( ) ) . unwrap ( ) ; }
Generate a one-time token, store it in the cache, and return it on the reply-to
Generate a one - time token store it in the cache and return it on the reply - to
msg
nats::Message
con
&mut redis::Connection
expiration_seconds
u32