(master_key: &[u8], timestamp: u64)
| 68 | } |
| 69 | |
| 70 | fn 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 | |
| 77 | fn create_session(username: &str, server_key: &[u8], password: &str) -> Session { |
| 78 | let master_key = derive_master_key(server_key, password); |
no outgoing calls
no test coverage detected