feat: paste views; configuration validation; hmacsha256 method; enhance paste clean up serivce; paste view clean up service;

This commit is contained in:
2026-01-09 19:12:05 -05:00
parent 60876eb1ba
commit 3048af3a6d
20 changed files with 592 additions and 46 deletions
+14 -1
View File
@@ -1,4 +1,6 @@
namespace SharpbinV3.Server
using System.Security.Cryptography;
namespace SharpbinV3.Server
{
public class Utilities
{
@@ -8,5 +10,16 @@
var random = new Random();
return new string([.. Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)])]);
}
public static string ComputeHmacSha256(string secret, string input)
{
var secretBytes = System.Text.Encoding.UTF8.GetBytes(secret);
var inputBytes = System.Text.Encoding.UTF8.GetBytes(input);
using var hmac = new HMACSHA256(secretBytes);
var hashBytes = hmac.ComputeHash(inputBytes);
return Convert.ToHexString(hashBytes);
}
}
}