Skip to content
Overview

Overview

A server-side .NET 11 client for Hotkey. Add it to a .NET backend to keep one cloud browser per user, request a human handoff and handle the events that follow.

On this page

Klyroo.Hotkey emblem

Build and install

From this repository, build the independently versioned NuGet package and add it to your server project from the local feed:

Shell
dotnet pack src/Klyroo.Hotkey -c Release -o artifacts
dotnet add /path/to/Server.csproj package Klyroo.Hotkey --version 0.1.0-preview.1 --no-restore
dotnet restore /path/to/Server.csproj --source "$PWD/artifacts" --source https://api.nuget.org/v3/index.json

Add a browser and request a handoff

C#
using Klyroo.Hotkey;

// Configure this in the server project's Program.cs.
builder.Services.AddKlyrooHotkey(
    services => services.GetRequiredService<IConfiguration>()["Hotkey:ApiKey"]
        ?? throw new InvalidOperationException("Missing server setting Hotkey:ApiKey."));

Set Hotkey__ApiKey via the server's secret configuration. For every operation, resolve the Hotkey browser ID from your authenticated user's server-side mapping. Only the provisioning backend needs a workspace key. Use a key scoped to a single browser for that user's other operations.

C#
// In an authenticated handler after resolving userId on the server.
var browser = await hotkey.GetOrCreateBrowserAsync(
    new BrowserCreate(ExternalId: userId, TimeZone: "Europe/Paris", Languages: ["fr-FR"]),
    idempotencyKey: provisioningOperationId,
    cancellationToken: cancellationToken);

var ask = await hotkey.CreateAskAsync(
    new AskCreate(browser.Id, "Sign in to your reporting portal",
        Url: new Uri("https://reports.example.com/sign-in")),
    idempotencyKey: handoffOperationId,
    cancellationToken: cancellationToken);

Persist the operation IDs and use the same ID and request body if the caller retries. Keep hand links and live-view URLs private and deliver them only to the authorized user. An ask can optionally offer the user the choice to save their sign-in. The backend handles the resulting event or reads the ask status.

API coverage

Task Client operations
Browsers List, page, provision by external ID, update locale and metadata, wake, sleep, delete, and list tabs
Human handoffs Create, find, cancel or renew an ask, list saved sign-in metadata and forget a saved sign-in
Live view Configure workspace origins, create an expiring view or interactive embed, list, inspect and revoke embeds
Files List and stream browser downloads, including saved PDFs, and delete files
Events and usage Read the event cursor, query usage or stream its CSV export
Access and delivery Read workspace and account, issue and revoke browser-scoped keys, manage webhook endpoints and verify deliveries

Browser execution and session storage are provided by Hotkey. Site permissions, camera and microphone, passkeys, proxy routing and billing are managed through Hotkey itself. See the HTTP API and embed documentation.

Receive webhooks

Pass the raw request bytes and the Hotkey-Signature header to HotkeyWebhook.VerifyAndRead before JSON parsing. Reject a null result. The verifier checks HMAC-SHA256 and a five-minute window. Deduplicate using the authenticated event's Id in your durable queue or database, then return 2xx once you have recorded it. The API key and the endpoint's webhook secret are separate credentials. See the delivery contract.

The client retries safe reads and supported idempotent writes a maximum of twice. It honors retry delays up to 30 seconds and returns longer delays in HotkeyException.RetryAfter. Embed creation is sent once because every call mints a new token. Stream copies leave the destination open and can leave partial bytes if the connection is interrupted.

Documentation

Getting started Step-by-step first integration
Guides Task-oriented recipes for profiles, handoffs, webhooks, embeds and testing
Concepts Server-side ownership, scoped keys, retries and webhook verification
Platforms Server hosting, Blazor render modes, .NET MAUI clients and trimming
API reference Every public type and member
FAQ Troubleshooting and limitations

Compatibility

  • .NET 11 SDK (net11.0).
  • Server-side .NET library with no UI dependency (Microsoft.Extensions.Http only).
  • Blazor Web (Static SSR, Interactive Server, WebAssembly, Auto) and .NET MAUI apps (Blazor Hybrid and Native) connect through your authenticated backend API so API keys and webhook secrets never reach the client.

License

MIT. See LICENSE.