stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Security.Cryptography;
|
||||
using AuditPackRecord = StellaOps.AuditPack.Models.AuditPack;
|
||||
|
||||
namespace StellaOps.AuditPack.Services;
|
||||
|
||||
public sealed partial class AuditPackBuilder
|
||||
{
|
||||
private static AuditPackRecord WithDigest(AuditPackRecord pack)
|
||||
{
|
||||
var json = CanonicalJson.Serialize(pack with { PackDigest = null, Signature = null });
|
||||
var digest = ComputeDigest(json);
|
||||
return pack with { PackDigest = digest };
|
||||
}
|
||||
|
||||
private static string ComputeDigest(byte[] content)
|
||||
{
|
||||
var hash = SHA256.HashData(content);
|
||||
return Convert.ToHexString(hash).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user