(buf: &[u8])
| 1503 | } |
| 1504 | |
| 1505 | fn deserialize(buf: &[u8]) -> Result<Self, String> { |
| 1506 | if buf.len() < 32 { |
| 1507 | return Err("Input must be at least 32 bytes".to_string()); |
| 1508 | } |
| 1509 | let mut password_hash = [0u8; 32]; |
| 1510 | password_hash.copy_from_slice(&buf[..32]); |
| 1511 | let username_bytes = buf[32..].to_vec(); |
| 1512 | let username = String::from_utf8(username_bytes).map_err(|err| err.to_string())?; |
| 1513 | Ok(Self { |
| 1514 | username, |
| 1515 | password_hash: DoubleSHA256Hash(password_hash), |
| 1516 | }) |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | pub struct SessionDetails { |
nothing calls this directly
no test coverage detected