(hint: Option<&str>)
| 387 | } |
| 388 | |
| 389 | fn validate_view_hint(hint: Option<&str>) -> Result<(), BindingEncodeError> { |
| 390 | let Some(hint) = hint else { |
| 391 | return Ok(()); |
| 392 | }; |
| 393 | let malformed = hint.is_empty() |
| 394 | || hint.len() > 255 |
| 395 | || hint.starts_with('/') |
| 396 | || hint.ends_with('/') |
| 397 | || hint.contains("//") |
| 398 | || hint.contains("refs/") |
| 399 | || hint |
| 400 | .chars() |
| 401 | .any(|character| character.is_control() || character.is_whitespace()); |
| 402 | if malformed { |
| 403 | return Err(BindingEncodeError::InvalidViewHint { |
| 404 | hint: hint.to_string(), |
| 405 | }); |
| 406 | } |
| 407 | Ok(()) |
| 408 | } |
| 409 | |
| 410 | /// Blake3-derived binding identity: `ID_DOMAIN || payload || signature`. |
| 411 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
no test coverage detected