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

Function make_key

ch_11/src/routes/authentication.rs:71–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71fn make_key() -> PasetoSymmetricKey<V4, PasetoLocal> {
72 let key_str = env::var("PASETO_KEY").unwrap();
73 let key_bytes = key_str.as_bytes();
74 let mut key_array = [0u8; 32];
75 let len = key_bytes.len().min(32);
76 key_array[..len].copy_from_slice(&key_bytes[..len]);
77 PasetoSymmetricKey::<V4, PasetoLocal>::from(Key::from(&key_array))
78}
79
80pub fn verify_token(token: String) -> Result<Session, handle_errors::Error> {
81 let key = make_key();

Callers 2

verify_tokenFunction · 0.70
issue_tokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected