Katragadda.Extensions.GoogleSecretManager
0.1.1
dotnet add package Katragadda.Extensions.GoogleSecretManager --version 0.1.1
NuGet\Install-Package Katragadda.Extensions.GoogleSecretManager -Version 0.1.1
<PackageReference Include="Katragadda.Extensions.GoogleSecretManager" Version="0.1.1" />
<PackageVersion Include="Katragadda.Extensions.GoogleSecretManager" Version="0.1.1" />
<PackageReference Include="Katragadda.Extensions.GoogleSecretManager" />
paket add Katragadda.Extensions.GoogleSecretManager --version 0.1.1
#r "nuget: Katragadda.Extensions.GoogleSecretManager, 0.1.1"
#:package Katragadda.Extensions.GoogleSecretManager@0.1.1
#addin nuget:?package=Katragadda.Extensions.GoogleSecretManager&version=0.1.1
#tool nuget:?package=Katragadda.Extensions.GoogleSecretManager&version=0.1.1
Katragadda.Extensions.GoogleSecretManager
Caching, auto-refreshing, typed-configuration wrapper around
Google.Cloud.SecretManager.V1
for ASP.NET Core and generic-host .NET applications.
Why
Google's official .NET client for Secret Manager is intentionally a thin,
low-level gRPC/REST client — it does not provide caching, background refresh,
or idiomatic IOptions<T> binding. Every application that wants those things
today has to hand-roll them. This library fills that gap, the way
Spring Cloud GCP's Secret Manager starter
does for the Java/Spring ecosystem (which already has this out of the box).
Install
dotnet add package Katragadda.Extensions.GoogleSecretManager
Quick start
services.AddGoogleSecretManagerCaching(options =>
{
options.ProjectId = "my-gcp-project";
options.CacheTtl = TimeSpan.FromMinutes(10);
options.EnableBackgroundRefresh = true; // keeps cache warm proactively
});
// Anywhere in your app:
var client = serviceProvider.GetRequiredService<ICachingSecretManagerClient>();
var apiKey = await client.GetSecretValueAsync("my-api-key");
Typed configuration binding
services.AddOptions<MyApiOptions>()
.BindSecret(sp => sp.GetRequiredService<ICachingSecretManagerClient>(),
secretId: "my-api-key",
(opts, value) => opts.ApiKey = value);
React to secret rotation
services.AddGoogleSecretManagerCaching(options =>
{
options.ProjectId = "my-gcp-project";
options.OnSecretChanged = (secretId, newValue) =>
{
// e.g. re-key a downstream client, log a rotation event
};
});
Authentication
Uses Application Default Credentials
via the underlying SecretManagerServiceClient — no action needed when
running on GCP infrastructure (GKE Workload Identity, Cloud Run, etc.); run
gcloud auth application-default login for local development.
How it works
ICachingSecretManagerClient.GetSecretValueAsyncserves a cached value if withinCacheTtl, otherwise fetches and caches.- When
EnableBackgroundRefreshis true (default), a hostedBackgroundServiceproactively re-fetches every previously-resolved secret onBackgroundRefreshInterval, so callers rarely pay a synchronous fetch-latency cost. OnSecretChangedfires only when a refresh observes an actual value change (new version published upstream), not on every refresh sweep.
Status
v0.1.0 — early release. Feedback and issues welcome.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Google.Cloud.SecretManager.V1 (>= 2.8.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
-
net8.0
- Google.Cloud.SecretManager.V1 (>= 2.8.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.1 | 143 | 9/13/2026 |