feat: wip on aes crypto provider

This commit is contained in:
Stevan Freeborn
2026-03-31 07:15:13 -05:00
parent 2915c32274
commit b843cf9f08
2 changed files with 48 additions and 0 deletions
@@ -0,0 +1,20 @@
namespace StevanFreeborn.Extensions.Configuration.Secure.Cryptography;
internal sealed class AesCryptoProvider(IEncryptionKeyProvider keyProvider) : ICryptoProvider
{
private readonly IEncryptionKeyProvider _keyProvider = keyProvider
?? throw new ArgumentNullException(nameof(keyProvider));
// TODO: Implement this shit
public string Decrypt(string cipherText)
{
_ = _keyProvider.GetKey();
throw new NotImplementedException();
}
public string Encrypt(string plainText)
{
throw new NotImplementedException();
}
}
@@ -0,0 +1,28 @@
using Moq;
using StevanFreeborn.Extensions.Configuration.Secure.Cryptography;
namespace StevanFreeborn.Extensions.Configuration.Secure.Tests.Unit.Cryptography;
public class AesCryptoProviderTests
{
private readonly Mock<IEncryptionKeyProvider> _mockKeyProvider = new();
private readonly AesCryptoProvider _sut;
public AesCryptoProviderTests()
{
_sut = new(_mockKeyProvider.Object);
}
[Fact]
public void EncryptAndDecrypt_WhenCalled_ItShouldReturnOriginalString()
{
var originalText = "SuperDuperSecret";
var encryptedText = _sut.Encrypt(originalText);
var decryptedText = _sut.Decrypt(encryptedText);
encryptedText.Should().NotBe(originalText);
decryptedText.Should().Be(originalText);
}
}