namespace StellaOps.Cryptography; /// /// Well-known HMAC purpose identifiers for compliance-aware cryptographic operations. /// Components should request HMAC by PURPOSE, not by algorithm. /// The platform resolves the correct algorithm based on the active compliance profile. /// public static class HmacPurpose { /// /// DSSE envelope signing and message authentication codes. /// Default: HMAC-SHA256 (world/fips/kcmvp/eidas), HMAC-GOST3411 (gost), HMAC-SM3 (sm). /// public const string Signing = "signing"; /// /// Token and URL authentication (e.g., signed URLs, ack tokens). /// Default: HMAC-SHA256 (world/fips/kcmvp/eidas), HMAC-GOST3411 (gost), HMAC-SM3 (sm). /// public const string Authentication = "auth"; /// /// External webhook interoperability (third-party webhook receivers). /// Always HMAC-SHA256, regardless of compliance profile. /// Every use of this purpose MUST be documented with justification. /// public const string WebhookInterop = "webhook"; /// /// All known HMAC purposes for validation. /// public static readonly IReadOnlyList All = new[] { Signing, Authentication, WebhookInterop }; /// /// Validates whether the given purpose is known. /// /// The purpose to validate. /// True if the purpose is known; otherwise, false. public static bool IsKnown(string? purpose) => !string.IsNullOrWhiteSpace(purpose) && All.Contains(purpose); }