← Back to SDKs
.NET SDK
The official Sirr client for .NET. Async-first, supports dependency injection with IHttpClientFactory, and targets .NET 8+.
Installation
dotnet add package Sirr.ClientOr via the NuGet Package Manager:
Install-Package Sirr.ClientQuick Start
using Sirr.Client;
var client = new SirrClient(new SirrOptions
{
BaseUrl = "https://sirr.example.com",
ApiKey = "sirr_lic_...",
});
// Store a secret (expires in 1 hour, max 3 reads)
var result = await client.CreateAsync(new CreateSecretRequest
{
Content = "database_password=hunter2",
Ttl = 3600,
MaxReads = 3,
});
Console.WriteLine($"Secret stored: {result.Id}");
// Retrieve the secret
var secret = await client.GetAsync(result.Id);
Console.WriteLine($"Content: {secret.Content}");
// Delete early
await client.DeleteAsync(result.Id);Try it live
Click Run to execute this example against a real Sirr instance. The secret is created, read, and deleted in real‑time.
C#
using Sirr.Client;
var client = new SirrClient(new SirrOptions
{
BaseUrl = "https://sirr.secretdrop.app",
});
// Store a secret (expires in 5 min, max 3 reads)
var result = await client.CreateAsync(new CreateSecretRequest
{
Content = "Hello from the Sirr sandbox!",
Ttl = 300,
MaxReads = 3,
});
Console.WriteLine($"Secret stored: {result.Id}");
// Retrieve the secret
var secret = await client.GetAsync(result.Id);
Console.WriteLine($"Content: {secret.Content}");
// Delete early
await client.DeleteAsync(result.Id);
Console.WriteLine("Secret deleted");Dependency Injection
Register the Sirr client in your DI container for ASP.NET Core, Worker Services, or any host that supports IHttpClientFactory.
// Program.cs
builder.Services.AddSirr(options =>
{
options.BaseUrl = "https://sirr.example.com";
options.ApiKey = builder.Configuration["Sirr:ApiKey"]!;
});
// Inject ISirrClient anywhere
public class SecretsController(ISirrClient sirr) : ControllerBase
{
[HttpPost]
public async Task<IActionResult> Store(string content)
{
var result = await sirr.CreateAsync(new CreateSecretRequest
{
Content = content,
Ttl = 3600,
});
return Ok(new { result.Id });
}
}Client-Side Encryption
Enable client-side encryption for defense in depth. Uses AES-256-GCM via .NET's built-in cryptography APIs.
var client = new SirrClient(new SirrOptions
{
BaseUrl = "https://sirr.example.com",
ApiKey = "sirr_lic_...",
Encryption = true,
});
// Content is encrypted before leaving your machine
var result = await client.CreateAsync(new CreateSecretRequest
{
Content = "top-secret-value",
Ttl = 600,
});
// Share Id and Key separately — both are needed to decrypt
var secret = await client.GetAsync(result.Id, key: result.Key);
Console.WriteLine(secret.Content); // "top-secret-value"Requirements
- .NET 8.0 or later
- No external dependencies — uses System.Net.Http and System.Security.Cryptography
- Compatible with ASP.NET Core, Worker Services, console apps, and MAUI
Contribute
The .NET SDK is open source under the MIT license. Bug reports, feature requests, and pull requests are welcome.
github.com/SirrVault/sirr-dotnet →