Agntcy.Slim
2.1.2
dotnet add package Agntcy.Slim --version 2.1.2
NuGet\Install-Package Agntcy.Slim -Version 2.1.2
<PackageReference Include="Agntcy.Slim" Version="2.1.2" />
<PackageVersion Include="Agntcy.Slim" Version="2.1.2" />
<PackageReference Include="Agntcy.Slim" />
paket add Agntcy.Slim --version 2.1.2
#r "nuget: Agntcy.Slim, 2.1.2"
#:package Agntcy.Slim@2.1.2
#addin nuget:?package=Agntcy.Slim&version=2.1.2
#tool nuget:?package=Agntcy.Slim&version=2.1.2
SLIM C# SDK
C# SDK for SLIM (Secure Low-Latency Interactive Messaging).
This SDK provides an idiomatic C# API built on top of auto-generated bindings from uniffi-bindgen-cs.
Requirements
- .NET 8.0 or higher
- Rust toolchain (for building native libraries from source)
- Task (optional, for build automation)
Quick Start
Using NuGet Package
dotnet add package Agntcy.Slim
The NuGet package includes native libraries for all supported platforms. No additional setup required!
using Agntcy.Slim;
Slim.Initialize();
var service = Slim.GetGlobalService();
// ...
Slim.Shutdown();
Building from Source
To build the complete SDK, you need artifacts from the Rust bindings build:
# From the root of the repository
cd dotnet
task ci BINDGEN_TARGET=x86_64-unknown-linux-gnu PROFILE=release
For development on a single platform:
task generate
task build
task test
API Overview
Main Classes
| Class | Description |
|---|---|
Slim |
Static entry point for initialization, shutdown, and global access |
SlimService |
Service for managing connections and creating apps |
SlimApp |
Application for managing sessions, subscriptions, and routing |
SlimSession |
Session for sending and receiving messages |
SlimName |
Identity in org/namespace/app format |
SlimMessage |
Received message with Payload (bytes) and Text (string) |
SlimSessionConfig |
Session configuration (type, MLS, retries) |
SlimClientConfig |
Client connection configuration (endpoint, TLS, transport auth) |
SlimServerConfig |
Server listen configuration (endpoint, TLS, transport auth) |
SlimOidcConfig |
OIDC transport authentication settings |
SlimOidcPolicy |
Claim-based access policy (Rego, RegoFile, Cel) |
Transport Authentication (gRPC connection)
Separate from the app identity passed to CreateApp, the gRPC connection to a SLIM node can
carry its own credentials.
OIDC, client side (client-credentials flow):
var clientConfig = Slim.NewInsecureClientConfig("http://127.0.0.1:46357")
.WithOidc(new SlimOidcConfig
{
IssuerUrl = "https://auth.example.com",
ClientId = "my-client",
ClientSecret = "s3cr3t",
Scope = "openid profile",
Timeout = TimeSpan.FromSeconds(30)
});
using var service = Slim.GetGlobalService();
var connId = service.Connect(clientConfig);
For the refresh-token flow set RefreshToken (or RefreshTokenFile, which is rewritten in
place as tokens rotate) instead of ClientSecret.
Server side, verifying incoming JWTs against the issuer's JWKS endpoint, optionally restricting access by claim:
var serverConfig = Slim.NewInsecureServerConfig("127.0.0.1:46357")
.WithOidc(new SlimOidcConfig
{
IssuerUrl = "https://auth.example.com",
Audience = "slim", // required for verification
JwksTtl = TimeSpan.FromHours(1),
ClaimCacheTtl = TimeSpan.FromMinutes(1),
Policy = new SlimOidcPolicy.Cel("\"admin\" in claims.groups")
});
await service.RunServerAsync(serverConfig);
Policy accepts SlimOidcPolicy.Cel, SlimOidcPolicy.Rego (which must define
package slim.auth with default allow = false), or SlimOidcPolicy.RegoFile. Client-only
properties (Scope, Timeout) and server-only properties (JwksTtl, ClaimCacheTtl,
Policy) are ignored by the other side. Read back what a config carries via
SlimClientConfig.Oidc / SlimServerConfig.Oidc, which return null for other auth modes.
From a config file — Slim.NewClientConfigFromJson accepts a full gRPC client config,
covering TLS material, backoff, and every authentication mode (basic, static_jwt, jwt,
spire, oidc). The examples read the same document from SLIM_CLIENT_CONFIG:
{
"endpoint": "http://127.0.0.1:46357",
"tls": { "insecure": true },
"auth": {
"type": "oidc",
"issuer_url": "https://auth.example.com",
"client_id": "my-client",
"client_secret": "s3cr3t",
"audience": "slim",
"policy": { "cel": "\"admin\" in claims.groups" }
}
}
The schema matches data-plane/core/config/src/grpc/schema/client-config.schema.json in the
slim repo.
Examples
The SDK includes complete working examples demonstrating real-world usage:
- Point-to-Point (
Slim.Examples.PointToPoint): 1:1 messaging with request/reply pattern - Group Messaging (
Slim.Examples.Group): Group sessions with moderator/participant roles - slimrpc (
Slim.Examples.SlimRpc): Protobuf RPC over SLIM (see SLIMRPC.md)
Quick Start:
# Run receiver
dotnet run --project Slim.Examples.PointToPoint -- --local org/alice/v1
# Run sender (in another terminal)
dotnet run --project Slim.Examples.PointToPoint -- \
--local org/bob/v1 --remote org/alice/v1 --message "Hello"
slimrpc Example:
Requires a running SLIM server. See the SLIM repository for instructions on running a server (for example, from the slim repo: cd data-plane && cargo run --bin slim -- --config ./config/base/server-config.yaml).
# Generate proto code (requires buf and protoc-gen-slimrpc-csharp)
task slimrpc:generate-proto
# Run server (in one terminal)
dotnet run --project Slim.Examples.SlimRpc -- --mode server
# Run client (in another terminal)
dotnet run --project Slim.Examples.SlimRpc -- --mode client
See example source code in Slim.Examples.* projects for full implementation details and command-line options.
Running Tests
The SDK includes smoke tests that don't require a running SLIM server:
task test
For full integration testing with a SLIM server, you would need to:
- Start a SLIM server instance
- Run the example applications to verify functionality
See the Slim.Examples.* projects for working integration examples.
Development
Available Tasks
task # List all available tasks
task ci # Run complete CI pipeline: generate, copy runtimes, build, test, pack
task format # Format the C# code using dotnet format
task lint # Check code formatting without applying changes
task generate # Generate C# bindings from artifacts (requires ARTIFACTS_DIR)
task copy:runtimes # Copy runtime libraries from artifacts to runtimes directory
task build # Build .NET solution (expects bindings already generated)
task test # Run smoke tests (no server required)
task pack # Create NuGet package (expects runtimes already copied)
task clean # Clean all build artifacts
Regenerating Bindings
If the Rust bindings change, you need to rebuild the Rust library first, then regenerate C# bindings:
task generate
Platform Support
| Platform | Architecture | .NET RID | Status |
|---|---|---|---|
| Linux (GNU) | x86_64 | linux-x64 | Supported |
| Linux (GNU) | aarch64 | linux-arm64 | Supported |
| Linux (musl) | x86_64 | linux-musl-x64 | Supported |
| Linux (musl) | aarch64 | linux-musl-arm64 | Supported |
| macOS | x86_64 | osx-x64 | Supported |
| macOS | aarch64 | osx-arm64 | Supported |
| Windows | x86_64 | win-x64 | Supported |
| Windows | aarch64 | win-arm64 | Supported |
NuGet Package
The NuGet package includes native libraries for all supported platforms using the standard runtimes/{rid}/native/ structure. When you install the package, .NET automatically selects the correct native library for your platform.
# Install the package
dotnet add package Agntcy.Slim
# Build and run - native library is automatically included
dotnet run
Publishing to NuGet
The NuGet package is automatically published when a release tag is pushed (e.g., slim-bindings-v0.1.0). The release workflow:
- Builds native libraries for all supported platforms
- Tests bindings locally with all platform libraries
- Creates a NuGet package with native libraries for all platforms
- Publishes to NuGet.org
License
Apache-2.0 - See LICENSE for details.
Related Projects
- Go bindings - Go bindings for SLIM
- Python bindings - Python bindings for SLIM
- uniffi-bindgen-cs - C# bindings generator for UniFFI
| 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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Agntcy.Slim:
| Package | Downloads |
|---|---|
|
Agntcy.Slim.SlimRpc
C# slimrpc helper library for SLIM bindings |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.1.2 | 124 | 8/28/2026 |
| 2.1.1 | 115 | 8/26/2026 |
| 2.1.1-rc.3 | 88 | 8/25/2026 |
| 2.1.1-rc.2 | 81 | 8/24/2026 |
| 2.1.1-rc.1 | 87 | 8/24/2026 |
| 2.1.0 | 114 | 8/13/2026 |
| 2.0.0 | 143 | 8/5/2026 |
| 2.0.0-alpha.7 | 75 | 8/3/2026 |
| 2.0.0-alpha.5 | 84 | 7/31/2026 |
| 2.0.0-alpha.4 | 69 | 7/21/2026 |
| 2.0.0-alpha.3 | 86 | 7/15/2026 |
| 2.0.0-alpha.2 | 96 | 6/29/2026 |
| 2.0.0-alpha.1 | 82 | 6/23/2026 |
| 2.0.0-alpha.0 | 73 | 6/3/2026 |
| 1.4.1 | 138 | 5/23/2026 |
| 1.4.0 | 135 | 5/13/2026 |
| 1.4.0-rc.6 | 77 | 5/13/2026 |
| 1.4.0-rc.5 | 77 | 5/12/2026 |
| 1.4.0-rc.3 | 82 | 5/12/2026 |
| 1.4.0-rc.2 | 80 | 5/11/2026 |