using System;
using static StellaOps.Localization.T;
namespace StellaOps.Provcache;
public sealed partial class VeriKeyBuilder
{
///
/// Sets the SBOM canonical hash.
/// Automatically canonicalizes the SBOM content before hashing if raw bytes are provided.
///
/// The SBOM canonical hash.
/// This builder for fluent chaining.
public VeriKeyBuilder WithSbomHash(string sbomHash)
{
if (string.IsNullOrWhiteSpace(sbomHash))
throw new ArgumentException(_t("common.provcache.sbom_hash_required"), nameof(sbomHash));
_sbomHash = NormalizeHash(sbomHash);
return this;
}
///
/// Computes SBOM hash from raw SBOM bytes using canonical serialization.
///
/// Raw SBOM content bytes.
/// This builder for fluent chaining.
public VeriKeyBuilder WithSbomBytes(ReadOnlySpan sbomBytes)
{
_sbomHash = ComputeHash(sbomBytes);
return this;
}
}