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

Method deserialize

src/models/types.rs:1505–1517  ·  view source on GitHub ↗
(buf: &[u8])

Source from the content-addressed store, hash-verified

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
1520pub struct SessionDetails {

Callers

nothing calls this directly

Calls 2

DoubleSHA256HashClass · 0.85
lenMethod · 0.45

Tested by

no test coverage detected