20 lines
519 B
C#
20 lines
519 B
C#
using System.Text;
|
|
using StellaOps.Cryptography;
|
|
|
|
namespace StellaOps.Audit.ReplayToken;
|
|
|
|
public sealed partial class Sha256ReplayTokenGenerator
|
|
{
|
|
private string ComputeHash(string input)
|
|
{
|
|
var bytes = Encoding.UTF8.GetBytes(input);
|
|
return _cryptoHash.ComputeHashHex(bytes, HashAlgorithms.Sha256);
|
|
}
|
|
|
|
private string ComputeTokenValue(ReplayTokenRequest request, string version)
|
|
{
|
|
var canonical = Canonicalize(request, version);
|
|
return ComputeHash(canonical);
|
|
}
|
|
}
|