From 43d64a185537fc3d902aad26fbfe4c89eba70150 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sun, 29 Mar 2026 22:02:07 -0500 Subject: [PATCH] feat: stub out secure config with dependencies --- .../Configuration/SecureConfig.cs | 38 +++++++++++++++++++ .../Cryptography/ICryptoProvider.cs | 7 ++++ 2 files changed, 45 insertions(+) create mode 100644 src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/SecureConfig.cs create mode 100644 src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/ICryptoProvider.cs diff --git a/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/SecureConfig.cs b/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/SecureConfig.cs new file mode 100644 index 0000000..6fe2ad7 --- /dev/null +++ b/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/SecureConfig.cs @@ -0,0 +1,38 @@ +using StevanFreeborn.Extensions.Configuration.Secure.Cryptography; +using StevanFreeborn.Extensions.Configuration.Secure.Storage; + +namespace StevanFreeborn.Extensions.Configuration.Secure.Configuration; + +internal interface ISecureConfig +{ + Task DeleteAsync(string key, CancellationToken ct = default); + Task GetAsync(string key, CancellationToken ct = default); + Task SetAsync(string key, T value, CancellationToken ct = default); +} + +internal sealed class SecureConfig( + ISecureStorageProvider storageProvider, + ICryptoProvider cryptoProvider +) : ISecureConfig +{ + private readonly ISecureStorageProvider _storageProvider = storageProvider ?? + throw new ArgumentNullException(nameof(storageProvider)); + + private readonly ICryptoProvider _cryptoProvider = cryptoProvider ?? + throw new ArgumentNullException(nameof(cryptoProvider)); + + public async Task SetAsync(string key, T value, CancellationToken ct = default) + { + throw new NotImplementedException(); + } + + public async Task GetAsync(string key, CancellationToken ct = default) + { + throw new NotImplementedException(); + } + + public async Task DeleteAsync(string key, CancellationToken ct = default) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/ICryptoProvider.cs b/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/ICryptoProvider.cs new file mode 100644 index 0000000..4009509 --- /dev/null +++ b/src/StevanFreeborn.Extensions.Configuration.Secure/Cryptography/ICryptoProvider.cs @@ -0,0 +1,7 @@ +namespace StevanFreeborn.Extensions.Configuration.Secure.Cryptography; + +internal interface ICryptoProvider +{ + string Encrypt(string plainText); + string Decrypt(string cipherText); +} \ No newline at end of file