Struct lockpad_auth::Claims
source · pub struct Claims {
pub sub: String,
pub exp: usize,
pub iat: usize,
}Expand description
The claims of a JWT
Fields§
§sub: String§exp: usize§iat: usizeImplementations§
source§impl Claims
impl Claims
sourcepub fn new(sub: String) -> Self
pub fn new(sub: String) -> Self
Create a claim with a given subject The expiration time is set to 7 days from the moment of creation
sourcepub async fn encode(&self, key: &EncodingKey) -> Result<String>
pub async fn encode(&self, key: &EncodingKey) -> Result<String>
Encode the claims into a JWT string
pub async fn decode(token: &str, key: &DecodingKey) -> Result<Self>
pub async fn decode_validation( token: &str, key: &DecodingKey, validation: &Validation ) -> Result<Self>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Claims
impl<'de> Deserialize<'de> for Claims
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more