MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / verify_token

Function verify_token

ch_09/src/routes/authentication.rs:91–102  ·  view source on GitHub ↗
(
    token: String,
)

Source from the content-addressed store, hash-verified

89}
90
91pub 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
104fn issue_token(account_id: AccountId) -> String {
105 let key = make_key();

Callers 1

authFunction · 0.70

Calls 1

make_keyFunction · 0.70

Tested by

no test coverage detected