RatelKey.Burrow.Sdk 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RatelKey.Burrow.Sdk --version 1.2.0
                    
NuGet\Install-Package RatelKey.Burrow.Sdk -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RatelKey.Burrow.Sdk" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RatelKey.Burrow.Sdk" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="RatelKey.Burrow.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RatelKey.Burrow.Sdk --version 1.2.0
                    
#r "nuget: RatelKey.Burrow.Sdk, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RatelKey.Burrow.Sdk@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RatelKey.Burrow.Sdk&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=RatelKey.Burrow.Sdk&version=1.2.0
                    
Install as a Cake Tool

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).
  • Live secrets that follow every change on the Burrow (LiveAsync, LiveEnvironmentAsync).
  • Certificates from a dynamic certificate secret, such as SSH logins, for a key made in memory (GetCertificateAsync, LiveCertificateAsync).
  • 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

Live secrets

A live handle holds a secret's current value and follows every change on the Burrow as it happens.

var db = await burrow.LiveAsync("payments/prod/DATABASE");

db.GetField("password");                                   // always the current value
db.Changed += (_, change) => pool.Reconnect(change.Next);

burrow.LiveEnvironmentAsync("payments/prod") does the same for a whole environment: env.Get("API_KEY"), and Changed lists what changed, was added or was removed.

  • The call completes after the first read. A missing secret or grant is refused there.
  • All live handles on a client share one connection. It reconnects on its own and re-reads anything that changed while it was down.
  • Status is Live, Reconnecting, Revoked (access was taken away) or Removed (deleted on the Burrow). The last two are final, and the handle keeps its last value.
  • Handlers run on the SDK's background threads. One that throws is reported on Error.
  • CloseAsync() or disposing the client closes every handle.
  • Needs a Burrow with live updates; an older one is refused at LiveAsync.

Certificates

A dynamic certificate secret, such as an SSH user secret, gives each machine that asks a short-lived certificate of its own. The SDK makes a new Ed25519 key in memory for each one and sends only its public half.

var login = await burrow.GetCertificateAsync("api/prod/DEPLOY_SSH");

login.PrivateKey      // the OpenSSH private key
login.Value           // its certificate (ssh-ed25519-cert-v01@openssh.com ...)
login.Principals      // the logins it signs in as
login.Host            // where the secret says to connect, or null
login.ValidBefore     // when it stops being accepted

Hand the key and certificate to your SSH library, or write them to id_ed25519 (mode 600) and id_ed25519-cert.pub for ssh -i. Passing TimeSpan.FromMinutes(5) as validity asks for one that lasts less than the secret allows.

LiveCertificateAsync keeps one current:

var login = await burrow.LiveCertificateAsync("api/prod/DEPLOY_SSH");

login.Current;                                                  // the certificate and key to use now
login.Changed += (_, change) => connections.UseKey(change.Next);
await login.RenewAsync();                                       // a new one at once, e.g. after a host refused it
  • It renews once two thirds of the certificate's time have passed, and as soon as the secret's settings change. Each renewal makes a new key.
  • Revoking one certificate from the dashboard sends no event; RenewAsync() gets a new one.
  • GetSecretAsync on a certificate secret throws BurrowServerException (409) naming GetCertificateAsync.

In-memory identity

Enroll with a machine token's code from the Burrow's Machine tokens page. The key stays in memory and nothing is written to disk. The code carries the Burrow's address and certificate trust.

await using var burrow = Burrow.Enroll(Environment.GetEnvironmentVariable("BURROW_ENROLL_CODE")!);

var db = await burrow.GetSecretAsync("payments/prod/DATABASE");
  • The machine enrolls on the first read and renews itself with the same code before it expires.
  • Burrow.Open() enrolls from BURROW_ENROLL_CODE when the host has no identity under ~/.burrow.
  • CloseAsync() or disposing the client ends the machine at once, so it shows as expired on the Burrow.
  • Only a machine token's code works here. A one-time invitation is refused.

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 requires permissions: id-token: write. GitLab CI/CD (gitlab.com) requires the job to declare its token as RATEL_ID_TOKEN:

id_tokens:
  RATEL_ID_TOKEN:
    aud: https://burrow.example.com

Bitbucket Pipelines requires the step to list the Burrow as an OIDC audience:

- step:
    oidc:
      audiences:
        - https://burrow.example.com

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, or 409 when a secret refuses the request), 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.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.3.1 111 10/24/2026
1.3.0 110 10/19/2026
1.2.0 108 10/15/2026
1.1.1 100 10/10/2026
1.1.0 111 10/2/2026
1.0.1 111 9/27/2026
1.0.0 109 9/27/2026