(
token: String,
)
| 89 | } |
| 90 | |
| 91 | pub fn verify_token( |
| 92 | token: String, |
| 93 | ) -> Result<Session, handle_errors::Error> { |
| 94 | let key = make_key(); |
| 95 | |
| 96 | let json_value = PasetoParser::<V4, PasetoLocal>::default() |
| 97 | .parse(&token, &key) |
| 98 | .map_err(|_| handle_errors::Error::CannotDecryptToken)?; |
| 99 | |
| 100 | serde_json::from_value::<Session>(json_value) |
| 101 | .map_err(|_| handle_errors::Error::CannotDecryptToken) |
| 102 | } |
| 103 | |
| 104 | fn issue_token(account_id: AccountId) -> String { |
| 105 | let key = make_key(); |