Compare commits
1 Commits
0a9cc09f7b
...
194139bc30
Author | SHA1 | Date |
---|---|---|
kozabrada123 | 194139bc30 |
|
@ -3,10 +3,7 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use crate::types::utils::Snowflake;
|
||||
use jsonwebtoken::errors::Error;
|
||||
use jsonwebtoken::{
|
||||
decode, encode, Algorithm, DecodingKey, EncodingKey, Header, TokenData, Validation,
|
||||
};
|
||||
use jsonwebtoken::{encode, EncodingKey, Header};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub fn generate_token(id: &Snowflake, email: String, jwt_key: &str) -> String {
|
||||
|
@ -45,13 +42,8 @@ pub fn build_token(claims: &Claims, jwt_key: &str) -> Result<String, jsonwebtoke
|
|||
)
|
||||
}
|
||||
|
||||
pub fn decode_token(token: &str, jwt_secret: &str) -> Result<TokenData<Claims>, Error> {
|
||||
/*pub fn decode_token(token: &str) -> Result<TokenData<Claims>, Error> {
|
||||
let mut validation = Validation::new(Algorithm::HS256);
|
||||
//TODO: What is this?
|
||||
//validation.sub = Some("quartzauth".to_string());
|
||||
decode(
|
||||
token,
|
||||
&DecodingKey::from_secret(jwt_secret.as_bytes()),
|
||||
&validation,
|
||||
)
|
||||
}
|
||||
validation.sub = Some("quartzauth".to_string());
|
||||
decode(token, &DecodingKey::from_secret(JWT_SECRET), &validation)
|
||||
}*/
|
||||
|
|
Loading…
Reference in New Issue