33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System;
|
|
using static StellaOps.Localization.T;
|
|
|
|
namespace StellaOps.Provcache;
|
|
|
|
public sealed partial class VeriKeyBuilder
|
|
{
|
|
/// <summary>
|
|
/// Sets the merge policy hash (PolicyBundle digest).
|
|
/// </summary>
|
|
/// <param name="policyHash">The policy bundle hash.</param>
|
|
/// <returns>This builder for fluent chaining.</returns>
|
|
public VeriKeyBuilder WithMergePolicyHash(string policyHash)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(policyHash))
|
|
throw new ArgumentException(_t("common.provcache.policy_hash_required"), nameof(policyHash));
|
|
|
|
_mergePolicyHash = NormalizeHash(policyHash);
|
|
return this;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Computes policy hash from raw policy bundle bytes.
|
|
/// </summary>
|
|
/// <param name="policyBytes">Raw policy bundle content bytes.</param>
|
|
/// <returns>This builder for fluent chaining.</returns>
|
|
public VeriKeyBuilder WithMergePolicyBytes(ReadOnlySpan<byte> policyBytes)
|
|
{
|
|
_mergePolicyHash = ComputeHash(policyBytes);
|
|
return this;
|
|
}
|
|
}
|