1e21e33ade
Move SecureStoreManager project and tests to Deprecated folder and remove from solution. SecureStore functionality is now integrated into ConfigManager.
85 lines
2.7 KiB
C#
85 lines
2.7 KiB
C#
namespace JdeScoping.SecureStoreManager.Services;
|
|
|
|
/// <summary>
|
|
/// Interface for managing SecureStore encrypted secret stores.
|
|
/// </summary>
|
|
public interface ISecureStoreManager
|
|
{
|
|
/// <summary>
|
|
/// Gets whether a store is currently open.
|
|
/// </summary>
|
|
bool IsStoreOpen { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the path to the currently open store, or null if no store is open.
|
|
/// </summary>
|
|
string? CurrentStorePath { get; }
|
|
|
|
/// <summary>
|
|
/// Gets whether there are unsaved changes to the current store.
|
|
/// </summary>
|
|
bool HasUnsavedChanges { get; }
|
|
|
|
/// <summary>
|
|
/// Creates a new store secured with a key file.
|
|
/// </summary>
|
|
/// <param name="storePath">Path for the new store file (.json).</param>
|
|
/// <param name="keyFilePath">Path for the key file (.key).</param>
|
|
void CreateStore(string storePath, string keyFilePath);
|
|
|
|
/// <summary>
|
|
/// Opens an existing store using a key file.
|
|
/// </summary>
|
|
/// <param name="storePath">Path to the store file (.json).</param>
|
|
/// <param name="keyFilePath">Path to the key file (.key).</param>
|
|
void OpenStore(string storePath, string keyFilePath);
|
|
|
|
/// <summary>
|
|
/// Closes the currently open store without saving.
|
|
/// </summary>
|
|
void CloseStore();
|
|
|
|
/// <summary>
|
|
/// Saves changes to the currently open store.
|
|
/// </summary>
|
|
void Save();
|
|
|
|
/// <summary>
|
|
/// Gets all secret keys in the current store.
|
|
/// </summary>
|
|
/// <returns>Collection of secret key names.</returns>
|
|
IReadOnlyList<string> GetKeys();
|
|
|
|
/// <summary>
|
|
/// Gets the value of a secret.
|
|
/// </summary>
|
|
/// <param name="key">The secret key.</param>
|
|
/// <returns>The decrypted secret value.</returns>
|
|
string GetSecret(string key);
|
|
|
|
/// <summary>
|
|
/// Sets or updates a secret value.
|
|
/// </summary>
|
|
/// <param name="key">The secret key.</param>
|
|
/// <param name="value">The value to encrypt and store.</param>
|
|
void SetSecret(string key, string value);
|
|
|
|
/// <summary>
|
|
/// Removes a secret from the store.
|
|
/// </summary>
|
|
/// <param name="key">The secret key to remove.</param>
|
|
void RemoveSecret(string key);
|
|
|
|
/// <summary>
|
|
/// Generates a new key file for use with store encryption.
|
|
/// </summary>
|
|
/// <param name="path">Path where the key file will be created.</param>
|
|
void GenerateKeyFile(string path);
|
|
|
|
/// <summary>
|
|
/// Exports the current store's key to a file (for key file-based stores).
|
|
/// </summary>
|
|
/// <param name="path">Path where the key will be exported.</param>
|
|
void ExportKey(string path);
|
|
}
|