MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / verify_token

Function verify_token

ch_11/src/routes/authentication.rs:80–89  ·  view source on GitHub ↗
(token: String)

Source from the content-addressed store, hash-verified

78}
79
80pub fn verify_token(token: String) -> Result<Session, handle_errors::Error> {
81 let key = make_key();
82
83 let json_value = PasetoParser::<V4, PasetoLocal>::default()
84 .parse(&token, &key)
85 .map_err(|_| handle_errors::Error::CannotDecryptToken)?;
86
87 serde_json::from_value::<Session>(json_value)
88 .map_err(|_| handle_errors::Error::CannotDecryptToken)
89}
90
91fn issue_token(account_id: AccountId) -> String {
92 let key = make_key();

Callers 1

authFunction · 0.70

Calls 1

make_keyFunction · 0.70

Tested by

no test coverage detected