MCPcopy Create free account
hub / github.com/cosdata/cosdata / generate_token_key

Function generate_token_key

org/src/session_token.rs:70–75  ·  view source on GitHub ↗
(master_key: &[u8], timestamp: u64)

Source from the content-addressed store, hash-verified

68}
69
70fn generate_token_key(master_key: &[u8], timestamp: u64) -> hmac::Key {
71 let key = hmac::Key::new(hmac::HMAC_SHA256, master_key);
72 let ts_bytes = timestamp.to_be_bytes();
73 hmac::Key::new(hmac::HMAC_SHA256,
74 hmac::sign(&key, &ts_bytes).as_ref())
75}
76
77fn create_session(username: &str, server_key: &[u8], password: &str) -> Session {
78 let master_key = derive_master_key(server_key, password);

Callers 2

create_sessionFunction · 0.70
verify_tokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected