RatelKey.Burrow.Sdk
1.0.0
See the version list below for details.
dotnet add package RatelKey.Burrow.Sdk --version 1.0.0
NuGet\Install-Package RatelKey.Burrow.Sdk -Version 1.0.0
<PackageReference Include="RatelKey.Burrow.Sdk" Version="1.0.0" />
<PackageVersion Include="RatelKey.Burrow.Sdk" Version="1.0.0" />
<PackageReference Include="RatelKey.Burrow.Sdk" />
paket add RatelKey.Burrow.Sdk --version 1.0.0
#r "nuget: RatelKey.Burrow.Sdk, 1.0.0"
#:package RatelKey.Burrow.Sdk@1.0.0
#addin nuget:?package=RatelKey.Burrow.Sdk&version=1.0.0
#tool nuget:?package=RatelKey.Burrow.Sdk&version=1.0.0
Burrow SDK for .NET
Read secrets from a self-hosted RatelKey Burrow with a machine identity.
- Single and structured secrets, and individual fields of a structured secret.
- The machine's own access map (
ListProjectsAsync,ListSecretsAsync). - Certificate pinning, or standard CA trust (
TlsMode). - An OIDC token instead of a key (
Burrow.Oidc). - Verifying the Burrow's signed webhooks (
BurrowWebhooks.Verify).
Requirements
- .NET 8+.
- One dependency:
BouncyCastle.Cryptography, for Ed25519.
Install
dotnet add package RatelKey.Burrow.Sdk
Bootstrap a machine
From the Burrow dashboard, Machines → Add machine, and run the install it gives you on the target host.
The identity lands at ~/.burrow/burrows/<slug>/identity.json.
Quick start
using RatelKey.Burrow;
// The single machine identity on this host (under ~/.burrow, or $BURROW_HOME).
using var burrow = Burrow.Open();
// A single-value secret:
var apiKey = (await burrow.GetSecretAsync("payments/prod/API_KEY")).Value;
// A structured secret, one read, projected locally with no re-fetch:
var db = await burrow.GetSecretAsync("payments/prod/DATABASE");
var all = db.ToDictionary(); // every field, name to value
var host = db.GetField("host"); // one field
var fields = db.GetFields("username", "password"); // in the order given
// What this machine can read:
foreach (var p in await burrow.ListProjectsAsync())
Console.WriteLine($"{p.Project}: {string.Join(", ", p.Categories)}");
Point it at a specific identity by selector or path:
Burrow.Open("burrow-a1b2c3d4e5f60718"); // slug / name / machine id / URL
Burrow.Open("/home/you/.burrow/burrows/burrow-a1b2c3d4e5f60718"); // path (a burrow dir or identity.json)
Without ~/.burrow
For an app that manages its own key material:
using var burrow = Burrow.Connect(
burrowUrl: "https://burrow.internal:12010",
machineId: "...",
privateKeyPem: Environment.GetEnvironmentVariable("BURROW_MACHINE_KEY")!); // PKCS#8 PEM
OIDC
using var burrow = Burrow.Oidc(
burrowUrl: "https://burrow.example.com",
fingerprint: Environment.GetEnvironmentVariable("BURROW_FINGERPRINT")); // omit for a publicly-trusted certificate
var apiKey = (await burrow.GetSecretAsync("payments/prod/API_KEY")).Value;
audience defaults to burrowUrl. GitHub Actions currently requires permissions: id-token: write.
Certificate trust
using var burrow = Burrow.Open(tls: TlsMode.SystemTrust);
Without an explicit tls, the SDK uses the trust chosen when the machine was added: encrypted by default (works everywhere), or verified against the Burrow's own key or a CA if that was selected.
TlsMode.Pinned: trust-on-first-use, stored at~/.burrow/burrows/<slug>/known_cert.TlsMode.PinnedTo("aa:bb:..."): a fixed fingerprint (from the Burrow's network settings).TlsMode.SystemTrust: CA and hostname verification, for a Burrow on a custom domain or Let's Encrypt.TlsMode.Insecure: no verification; accepts any certificate. Opt-in only, for a network you already trust. Shortcut:Burrow.Open().InsecureTls().
Webhooks
Verify a delivery from a Burrow's Signed webhook. Needs only the webhook's signing secret, not a machine identity.
app.MapPost("/hooks/burrow", async (HttpRequest request) =>
{
using var body = new MemoryStream();
await request.Body.CopyToAsync(body);
var e = BurrowWebhooks.Verify(body.ToArray(), request.Headers[BurrowWebhooks.SignatureHeader],
Environment.GetEnvironmentVariable("BURROW_WEBHOOK_SECRET")!);
Console.WriteLine($"{e.Event} {e.Data.Summary}");
return Results.NoContent();
});
Pass the raw body, before JSON parsing. A retry of the same event carries the same e.Id, so keep the ids you've handled to ignore repeats.
Errors
Every failure is a BurrowException: BurrowAuthException (401), BurrowForbiddenException (403, no grant),
BurrowNotFoundException (404), BurrowServerException (5xx), BurrowCertificateException (pin mismatch),
BurrowTransportException (unreachable or unparsable), BurrowIdentityException (no, ambiguous or invalid
identity), plus two projection errors on the result: SecretShapeException (e.g. Value on a structured
secret) and FieldNotFoundException. The message carries the Burrow's own reason. BurrowWebhooks.Verify
throws BurrowWebhookException for a missing or wrong signature.
Build
dotnet test tests/RatelKey.Burrow.Tests
scripts/build-bundle.sh
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net8.0
- BouncyCastle.Cryptography (>= 2.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.