- Introduced AuthorityAdvisoryAiOptions and related classes for managing advisory AI configurations, including remote inference options and tenant-specific settings. - Added AuthorityApiLifecycleOptions to control API lifecycle settings, including legacy OAuth endpoint configurations. - Implemented validation and normalization methods for both advisory AI and API lifecycle options to ensure proper configuration. - Created AuthorityNotificationsOptions and its related classes for managing notification settings, including ack tokens, webhooks, and escalation options. - Developed IssuerDirectoryClient and related models for interacting with the issuer directory service, including caching mechanisms and HTTP client configurations. - Added support for dependency injection through ServiceCollectionExtensions for the Issuer Directory Client. - Updated project file to include necessary package references for the new Issuer Directory Client library.
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace StellaOps.Attestor.Envelope;
|
|
|
|
public sealed class DsseEnvelope
|
|
{
|
|
public DsseEnvelope(
|
|
string payloadType,
|
|
ReadOnlyMemory<byte> payload,
|
|
IEnumerable<DsseSignature> signatures,
|
|
string? payloadContentType = null,
|
|
DsseDetachedPayloadReference? detachedPayload = null)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(payloadType))
|
|
{
|
|
throw new ArgumentException("payloadType must be provided.", nameof(payloadType));
|
|
}
|
|
|
|
PayloadType = payloadType;
|
|
Payload = payload;
|
|
PayloadContentType = payloadContentType;
|
|
DetachedPayload = detachedPayload;
|
|
|
|
var normalised = signatures?.ToArray() ?? Array.Empty<DsseSignature>();
|
|
if (normalised.Length == 0)
|
|
{
|
|
throw new ArgumentException("At least one signature must be supplied.", nameof(signatures));
|
|
}
|
|
|
|
// Deterministic ordering (keyid asc, signature asc) for canonical output.
|
|
Signatures = normalised
|
|
.OrderBy(static x => x.KeyId ?? string.Empty, StringComparer.Ordinal)
|
|
.ThenBy(static x => x.Signature, StringComparer.Ordinal)
|
|
.ToArray();
|
|
}
|
|
|
|
public string PayloadType { get; }
|
|
|
|
public ReadOnlyMemory<byte> Payload { get; }
|
|
|
|
public string? PayloadContentType { get; }
|
|
|
|
public IReadOnlyList<DsseSignature> Signatures { get; }
|
|
|
|
public DsseDetachedPayloadReference? DetachedPayload { get; }
|
|
}
|