| 1 | namespace AgentForge.Credentials; |
| 2 | |
| 3 | public static class ForgeHostUrl |
| 4 | { |
| 5 | public static string NormalizeKey(string baseUrl) |
| 6 | { |
| 7 | if (!Uri.TryCreate(baseUrl.Trim(), UriKind.Absolute, out var uri)) |
| 8 | throw new ArgumentException("Base URL must be absolute.", nameof(baseUrl)); |
| 9 | |
| 10 | return NormalizeKey(uri); |
| 11 | } |
| 12 | |
| 13 | public static string NormalizeKey(Uri baseUri) => |
| 14 | baseUri.GetLeftPart(UriPartial.Authority).TrimEnd('/').ToLowerInvariant(); |
| 15 | } |
| 16 |