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

Function verify_token

ch_10/src/routes/authentication.rs:94–105  ·  view source on GitHub ↗
(
    token: String,
)

Source from the content-addressed store, hash-verified

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

Callers 1

authFunction · 0.70

Calls 1

make_keyFunction · 0.70

Tested by

no test coverage detected