Added a check for characters which an API key cannot contain (#1227)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-24 17:20:13 +01:00
1 parent c72a1948b3
commit e5a7f5423f
40 files changed
+1179 -71

No files matched your search

@@ -0,0 +1,32 @@
namespace AIStudio.Tools.Validation;
/// <summary>
/// What keeps an API key from being sent, as far as its characters tell.
/// </summary>
public enum APIKeyIssueKind
{
NONE,
/// <summary>
/// A space, a tab, or a line break inside the key.
/// </summary>
/// <remarks>
/// No provider issues keys with whitespace, so the user most likely copied more than the key,
/// e.g., two lines of a table or the key together with its name.
/// </remarks>
WHITESPACE,
/// <summary>
/// A character nobody sees, e.g., a zero-width space, a byte order mark, or a control character.
/// </summary>
/// <remarks>
/// Web pages and documents add such characters to what they show, and they come along when the
/// user copies the key from there.
/// </remarks>
INVISIBLE_CHARACTER,
/// <summary>
/// A visible character outside of ASCII, e.g., an umlaut or a typographic quotation mark.
/// </summary>
NON_ASCII_CHARACTER,
}