pub fn encode_jwt_string(&self, secret: &Secret) -> Result<String, JwtError> {
        let header = json!({});
        use serde_json::Value;

        let secret: &String = &secret.0;

        let payload: Value = match serde_json::to_value(&self.0) {
            Ok(x) => x,
            Err(_) => return Err(JwtError::SerializeError),
        };
        match encode(header, secret, &payload, Algorithm::HS256) {
            Ok(x) => return Ok(x),
            Err(_) => return Err(JwtError::EncodeError),
        }
    }
/// Encodes the JWT, producing a string.
Encodes the JWT, producing a string.
Encodes the JWT producing a string .
pub fn encode_jwt_string(&self, secret: &Secret) -> Result<String, JwtError> {
        let header = json!({});
        use serde_json::Value;
        let secret: &String = &secret.0;
        let payload: Value = match serde_json::to_value(&self.0) {
            Ok(x) => x,
            Err(_) => return Err(JwtError::SerializeError),
        };
        match encode(header, secret, &payload, Algorithm::HS256) {
            Ok(x) => return Ok(x),
            Err(_) => return Err(JwtError::EncodeError),
        }
    }
pub fn encode_jwt_string ( & self , secret : & Secret ) -> Result < String , JwtError > { let header = json ! ( { } ) ; use serde_json :: Value ; let secret : & String = & secret . 0 ; let payload : Value = match serde_json :: to_value ( & self . 0 ) { Ok ( x ) => x , Err ( _ ) => return Err ( JwtError :: SerializeError ) , } ; match encode ( header , secret , & payload , Algorithm :: HS256 ) { Ok ( x ) => return Ok ( x ) , Err ( _ ) => return Err ( JwtError :: EncodeError ) , } }
Encodes the JWT, producing a string.
Encodes the JWT producing a string .
&self
secret
&Secret
&self
secret
&Secret