From 3f1131623e83bcee84ec76b54aa5c8bec9093305 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Thu, 2 Apr 2026 19:54:23 -0500 Subject: [PATCH] refactor: make isecureconfig interface public --- .../Configuration/ISecureConfig.cs | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/ISecureConfig.cs b/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/ISecureConfig.cs index 9aba129..cdcd00e 100644 --- a/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/ISecureConfig.cs +++ b/src/StevanFreeborn.Extensions.Configuration.Secure/Configuration/ISecureConfig.cs @@ -2,11 +2,61 @@ using System.Text.Json.Serialization.Metadata; namespace StevanFreeborn.Extensions.Configuration.Secure.Configuration; -internal interface ISecureConfig +/// +/// Provides secure storage, retrieval, and deletion of configuration values. +/// All values are automatically encrypted before storage and decrypted on retrieval. +/// +public interface ISecureConfig { + /// + /// Serializes, encrypts, and stores a value for the specified key. + /// Resolves from the registered serializer options. + /// + /// The type of the value to store. + /// The configuration key. + /// The value to store. + /// A token to monitor for cancellation requests. + /// A task representing the asynchronous operation. Task SetAsync(string key, T value, CancellationToken ct = default); + + /// + /// Serializes, encrypts, and stores a value for the specified key using the provided type metadata. + /// This overload supports Native AOT by accepting pre-compiled . + /// + /// The type of the value to store. + /// The configuration key. + /// The value to store. + /// The JSON type metadata for source-generated serialization. + /// A token to monitor for cancellation requests. + /// A task representing the asynchronous operation. Task SetAsync(string key, T value, JsonTypeInfo typeInfo, CancellationToken ct = default); + + /// + /// Reads, decrypts, and deserializes a value for the specified key. + /// Resolves from the registered serializer options. + /// + /// The type of the value to retrieve. + /// The configuration key. + /// A token to monitor for cancellation requests. + /// The deserialized value, or default if the key does not exist. Task GetAsync(string key, CancellationToken ct = default); + + /// + /// Reads, decrypts, and deserializes a value for the specified key using the provided type metadata. + /// This overload supports Native AOT by accepting pre-compiled . + /// + /// The type of the value to retrieve. + /// The configuration key. + /// The JSON type metadata for source-generated serialization. + /// A token to monitor for cancellation requests. + /// The deserialized value, or default if the key does not exist. Task GetAsync(string key, JsonTypeInfo typeInfo, CancellationToken ct = default); + + /// + /// Deletes the value associated with the specified key from secure storage. + /// + /// The configuration key. + /// A token to monitor for cancellation requests. + /// true if the value was deleted; otherwise, false. Task DeleteAsync(string key, CancellationToken ct = default); } \ No newline at end of file