Sanitize a memory id for use as a directory name in the sidecar/vault path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`. Copied verbatim from `intent/bridge.rs::sanitize_id`.
(id: &str)
| 119 | /// Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`. |
| 120 | /// Copied verbatim from `intent/bridge.rs::sanitize_id`. |
| 121 | fn sanitize_id(id: &str) -> String { |
| 122 | id.chars() |
| 123 | .map(|c| { |
| 124 | if c.is_ascii_alphanumeric() || c == '-' || c == '_' { |
| 125 | c |
| 126 | } else { |
| 127 | '_' |
| 128 | } |
| 129 | }) |
| 130 | .collect() |
| 131 | } |
| 132 | |
| 133 | /// The tracked-vault path for a memory's attestation: |
| 134 | /// `attestations/memory/<sanitized-id>/attested.md`. |