22 lines
		
	
	
		
			787 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			787 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using Microsoft.Extensions.DependencyInjection;
 | 
						|
using Microsoft.Extensions.DependencyInjection.Extensions;
 | 
						|
using StellaOps.Cryptography;
 | 
						|
 | 
						|
namespace StellaOps.Cryptography.Plugin.BouncyCastle;
 | 
						|
 | 
						|
/// <summary>
 | 
						|
/// Dependency injection helpers for registering the BouncyCastle Ed25519 crypto provider.
 | 
						|
/// </summary>
 | 
						|
public static class BouncyCastleCryptoServiceCollectionExtensions
 | 
						|
{
 | 
						|
    public static IServiceCollection AddBouncyCastleEd25519Provider(this IServiceCollection services)
 | 
						|
    {
 | 
						|
        ArgumentNullException.ThrowIfNull(services);
 | 
						|
 | 
						|
        services.TryAddSingleton<BouncyCastleEd25519CryptoProvider>();
 | 
						|
        services.TryAddEnumerable(ServiceDescriptor.Singleton<ICryptoProvider, BouncyCastleEd25519CryptoProvider>());
 | 
						|
 | 
						|
        return services;
 | 
						|
    }
 | 
						|
}
 |