namespace StellaOps.Cryptography.Kms;
///
/// Configuration for the Google Cloud KMS-backed .
///
public sealed class GcpKmsOptions
{
private TimeSpan metadataCacheDuration = TimeSpan.FromMinutes(5);
private TimeSpan publicKeyCacheDuration = TimeSpan.FromMinutes(10);
///
/// Gets or sets the service endpoint (default: kms.googleapis.com).
///
public string Endpoint { get; set; } = "kms.googleapis.com";
///
/// Gets or sets the cache duration for crypto key metadata lookups.
///
public TimeSpan MetadataCacheDuration
{
get => metadataCacheDuration;
set => metadataCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(5));
}
///
/// Gets or sets the cache duration for exported public key material.
///
public TimeSpan PublicKeyCacheDuration
{
get => publicKeyCacheDuration;
set => publicKeyCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(10));
}
///
/// Gets or sets an optional factory that can construct a custom GCP facade (primarily used for testing).
///
public Func? FacadeFactory { get; set; }
private static TimeSpan EnsurePositive(TimeSpan value, TimeSpan @default)
=> value <= TimeSpan.Zero ? @default : value;
}