using System;
namespace StellaOps.Attestor.Envelope;
///
/// Represents a DSSE envelope signature (detached from payload).
///
public sealed class EnvelopeSignature
{
private readonly byte[] signature;
public EnvelopeSignature(string keyId, string algorithmId, ReadOnlySpan value)
{
if (string.IsNullOrWhiteSpace(keyId))
{
throw new ArgumentException("Key identifier is required.", nameof(keyId));
}
if (string.IsNullOrWhiteSpace(algorithmId))
{
throw new ArgumentException("Algorithm identifier is required.", nameof(algorithmId));
}
if (value.Length == 0)
{
throw new ArgumentException("Signature bytes must not be empty.", nameof(value));
}
KeyId = keyId;
AlgorithmId = algorithmId;
signature = value.ToArray();
}
///
/// Gets the key identifier associated with the signature.
///
public string KeyId { get; }
///
/// Gets the signing algorithm identifier.
///
public string AlgorithmId { get; }
///
/// Gets the raw signature bytes.
///
public ReadOnlyMemory Value => signature;
}