using System;
using System.Net;
using System.Security.Cryptography;
using System.Text;
namespace FrameworkSL.Endpoints.Action
{
/// Small shared helpers for the /Action/Conversation* endpoints — deliberately
/// separate from ActionExecuteEndpoint's own private HtmlPage/ComputeHash (same shape,
/// but kept independent so this new, unverified code path can't affect the already
/// live-tested NeedsInput=0 / static-remarks-form endpoints).
internal static class ActionHtmlHelpers
{
public static string ErrorPage(string title, string message)
{
return $@"
{WebUtility.HtmlEncode(title)}
✗ {WebUtility.HtmlEncode(title)}
{WebUtility.HtmlEncode(message)}
GoodBooks ERP — Action Confirmation
";
}
public static string ComputeHash(string token)
{
var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(token));
return Convert.ToHexString(bytes).ToLowerInvariant();
}
}
}