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)
| 132 | /// Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`. |
| 133 | /// Copied verbatim from `intent/bridge.rs::sanitize_id`. |
| 134 | fn sanitize_id(id: &str) -> String { |
| 135 | id.chars() |
| 136 | .map(|c| { |
| 137 | if c.is_ascii_alphanumeric() || c == '-' || c == '_' { |
| 138 | c |
| 139 | } else { |
| 140 | '_' |
| 141 | } |
| 142 | }) |
| 143 | .collect() |
| 144 | } |
| 145 | |
| 146 | /// The tracked-vault path for a memory's attestation: |
| 147 | /// `attestations/memory/<sanitized-id>/attested.md`. |