Table of Contents

Interface IElasticsearchKeyStorage

Namespace
Excalibur.Data.ElasticSearch.Security
Assembly
Excalibur.Data.ElasticSearch.dll

Defines CRUD operations for secure secret storage and retrieval in key management systems.

public interface IElasticsearchKeyStorage

Methods

DeleteSecretAsync(string, CancellationToken)

Removes a secret from the key management system.

Task<bool> DeleteSecretAsync(string keyName, CancellationToken cancellationToken)

Parameters

keyName string

The unique identifier for the secret to remove.

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task<bool>

A task that represents the asynchronous operation. The task result contains true if the secret was removed successfully, false if the secret did not exist.

Exceptions

SecurityException

Thrown when secret deletion fails due to security constraints.

ArgumentException

Thrown when the key name is null, empty, or invalid.

GetSecretAsync(string, CancellationToken)

Retrieves a secret value from the secure key management system.

Task<string?> GetSecretAsync(string keyName, CancellationToken cancellationToken)

Parameters

keyName string

The unique identifier for the secret to retrieve.

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task<string>

A task that represents the asynchronous operation. The task result contains the secret value or null if the secret does not exist.

Exceptions

SecurityException

Thrown when secret retrieval fails due to security constraints.

ArgumentException

Thrown when the key name is null, empty, or invalid.

GetSecretMetadataAsync(string, CancellationToken)

Retrieves metadata about a secret without accessing the secret value itself.

Task<SecretMetadata?> GetSecretMetadataAsync(string keyName, CancellationToken cancellationToken)

Parameters

keyName string

The unique identifier for the secret.

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task<SecretMetadata>

A task that represents the asynchronous operation. The task result contains the secret metadata or null if the secret does not exist.

Exceptions

SecurityException

Thrown when metadata retrieval fails due to security constraints.

ArgumentException

Thrown when the key name is null, empty, or invalid.

SecretExistsAsync(string, CancellationToken)

Checks whether a secret exists in the key management system without retrieving its value.

Task<bool> SecretExistsAsync(string keyName, CancellationToken cancellationToken)

Parameters

keyName string

The unique identifier for the secret to check.

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task<bool>

A task that represents the asynchronous operation. The task result contains true if the secret exists, false otherwise.

Exceptions

SecurityException

Thrown when secret existence check fails due to security constraints.

ArgumentException

Thrown when the key name is null, empty, or invalid.

SetSecretAsync(string, string, SecretMetadata?, CancellationToken)

Stores a secret value in the secure key management system.

Task<bool> SetSecretAsync(string keyName, string secretValue, SecretMetadata? metadata, CancellationToken cancellationToken)

Parameters

keyName string

The unique identifier for the secret to store.

secretValue string

The secret value to store securely.

metadata SecretMetadata

Optional metadata associated with the secret.

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task<bool>

A task that represents the asynchronous operation. The task result contains true if the secret was stored successfully, false otherwise.

Exceptions

SecurityException

Thrown when secret storage fails due to security constraints.

ArgumentException

Thrown when the key name or secret value is invalid.