using System; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using StellaOps.Cryptography; namespace StellaOps.Cryptography.DependencyInjection; public static partial class CryptoServiceCollectionExtensions { /// /// Registers crypto services with compliance profile configuration. /// /// Service collection. /// Configuration root. /// Optional compliance configuration. /// The service collection. public static IServiceCollection AddStellaOpsCryptoWithCompliance( this IServiceCollection services, IConfiguration configuration, Action? configureCompliance = null) { ArgumentNullException.ThrowIfNull(services); ArgumentNullException.ThrowIfNull(configuration); services.AddStellaOpsCrypto(); services.Configure(options => { configuration.GetSection(CryptoComplianceOptions.SectionKey).Bind(options); configureCompliance?.Invoke(options); }); return services; } }