Initial commit

This commit is contained in:
zavolo
2026-06-05 00:53:35 +03:00
commit e59e4424a4
7686 changed files with 352420 additions and 0 deletions
@@ -0,0 +1,33 @@
namespace MyTelegram.AuthServer.Services;
public class RsaKeyProvider(IOptions<MyTelegramAuthServerOptions> options)
: IRsaKeyProvider,
ISingletonDependency
{
private string? _privateKey;
public string GetRsaPrivateKey()
{
if (!string.IsNullOrEmpty(_privateKey))
{
return _privateKey;
}
if (!File.Exists(options.Value.PrivateKeyFilePath))
{
throw new FileNotFoundException(
"Private key not exists",
options.Value.PrivateKeyFilePath
);
}
_privateKey = File.ReadAllText(options.Value.PrivateKeyFilePath);
if (string.IsNullOrEmpty(_privateKey))
{
throw new InvalidOperationException("Private key can not be null");
}
return _privateKey;
}
}