feat(CodeGenerator): Die Methoden GenerateTotpSecretKey, GenerateTotpQrCode und GenerateTotpQrCode wurden als Schnittstellenimplementierung hinzugefügt.

This commit is contained in:
Developer 02
2024-12-10 22:05:52 +01:00
parent 1657a99aa6
commit 085f37de16
6 changed files with 65 additions and 14 deletions

View File

@@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using DigitalData.Core.Client;
using EnvelopeGenerator.Application.Configurations.GtxMessaging;
using QRCoder;
namespace EnvelopeGenerator.Application.Extensions
{
@@ -55,13 +56,14 @@ namespace EnvelopeGenerator.Application.Extensions
services.Configure<DispatcherConfig>(dispatcherConfigSection);
services.Configure<MailConfig>(mailConfigSection);
services.Configure<CodeGeneratorConfig>(codeGeneratorConfigSection);
services.Configure<CodeGeneratorParams>(codeGeneratorConfigSection);
services.Configure<EnvelopeReceiverCacheParams>(envelopeReceiverCacheParamsSection);
services.AddHttpClientService<SmsParams>(smsConfigSection);
services.TryAddSingleton<IMessagingService, GtxMessagingService>();
services.TryAddSingleton<ICodeGenerator, CodeGenerator>();
services.TryAddSingleton<IEnvelopeReceiverCache, EnvelopeReceiverCache>();
services.TryAddSingleton<QRCodeGenerator>();
return services;
}
@@ -70,7 +72,7 @@ namespace EnvelopeGenerator.Application.Extensions
dispatcherConfigSection: config.GetSection("DispatcherConfig"),
mailConfigSection: config.GetSection("MailConfig"),
smsConfigSection: config.GetSection("SmsConfig"),
codeGeneratorConfigSection: config.GetSection("CodeGeneratorConfig"),
codeGeneratorConfigSection: config.GetSection("CodeGeneratorParams"),
envelopeReceiverCacheParamsSection: config.GetSection("EnvelopeReceiverCacheParams"));
}
}

View File

@@ -7,5 +7,8 @@ namespace EnvelopeGenerator.Application.Extensions
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
&& status?.ToString()?.ToLower() == "ok";
public static string ToBase64String(this byte[] bytes)
=> Convert.ToBase64String(bytes);
}
}