a1156960b9
Resolves 1113 documentation-completeness gaps flagged by CommentChecker (MissingReturns, MissingInheritDoc, InheritDocMisused, MissingDoc, MissingParam, RedundantInheritDoc) so the API surface is fully documented and the analyzer scan is clean. Doc comments only; no code changes.
20 lines
818 B
C#
20 lines
818 B
C#
namespace ZB.MOM.WW.MxGateway.Client.Cli;
|
|
|
|
/// <summary>Utility to redact API keys from error messages for safe output.</summary>
|
|
internal static class MxGatewayCliSecretRedactor
|
|
{
|
|
/// <summary>Replaces occurrences of the API key in the value with a redacted placeholder.</summary>
|
|
/// <param name="value">The message text to redact.</param>
|
|
/// <param name="apiKey">The API key to remove; no redaction if null or empty.</param>
|
|
/// <returns>The message text with any API key occurrence replaced by <c>[redacted]</c>.</returns>
|
|
public static string Redact(string value, string? apiKey)
|
|
{
|
|
if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(apiKey))
|
|
{
|
|
return value;
|
|
}
|
|
|
|
return value.Replace(apiKey, "[redacted]", StringComparison.Ordinal);
|
|
}
|
|
}
|