XDevPlatform.ChatXdk 0.5.0

dotnet add package XDevPlatform.ChatXdk --version 0.5.0
                    
NuGet\Install-Package XDevPlatform.ChatXdk -Version 0.5.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="XDevPlatform.ChatXdk" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XDevPlatform.ChatXdk" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="XDevPlatform.ChatXdk" />
                    
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 XDevPlatform.ChatXdk --version 0.5.0
                    
#r "nuget: XDevPlatform.ChatXdk, 0.5.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 XDevPlatform.ChatXdk@0.5.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=XDevPlatform.ChatXdk&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=XDevPlatform.ChatXdk&version=0.5.0
                    
Install as a Cake Tool

chat-xdk .NET bindings

.NET bindings for the X Chat SDK — encryption for X Direct Messages.

Architecture

C# (ChatXdk) → P/Invoke → Rust cdylib (chat_xdk_dotnet) → chat-xdk-core

Complex values cross the FFI boundary as JSON strings. P/Invoke entry points are generated with csbindgen from src/lib.rs into dotnet/ChatXdk/NativeMethods.g.cs.

Prerequisites

  • .NET 8+ SDK
  • Rust (stable) to build the native chat_xdk_dotnet library

Setup

From the repo root, build the native library:

cargo build -p chat-xdk-dotnet --release

Then build the managed wrapper:

cd crates/dotnet/dotnet/ChatXdk
dotnet build -c Release

Place the native library (libchat_xdk_dotnet.dylib / .so / chat_xdk_dotnet.dll) on the loader path next to your app. After changing FFI exports in src/lib.rs, regenerate NativeMethods.g.cs with your csbindgen workflow.

Quick Start

using ChatXdk;

using var chat = new Chat();
chat.UpdateConfig(juiceboxConfigJson);
chat.Unlock(pin, juiceboxConfigJson);
// Or load a local key blob + its registered version instead of Juicebox:
// chat.ImportKeys(privateKeyBytes, registeredKeyVersion);

// Set the session once: your user id + registered signing-key version,
// the opt-in conversation-key cache, and the participants' signing keys.
chat.SetIdentity(myUserId, registeredKeyVersion);
chat.SetCacheKeys(true);
chat.SetSigningKeys(signingKeys);

// Batch load — signing keys come from the store; the verified conversation
// keys populate the cache.
var batch = chat.DecryptEvents(rawEventB64List);
foreach (var dm in batch.Messages)
{
    if (dm.Event.GetProperty("type").GetString() == "Message")
        Console.WriteLine(dm.Event.GetProperty("sender_id").GetString());
}

// Individual events: omitted arguments resolve from the session stores
// (pass conversation/signing keys explicitly to override).
var evt = chat.DecryptEvent(eventB64);
var conversationId = evt.GetProperty("conversation_id").GetString()!;

// Sending resolves the identity and conversation key from the session too.
var payload = chat.EncryptMessage(new EncryptMessageParams(conversationId, "hi!"));
// Reply / react by handing back the raw event being answered.
var reply = chat.EncryptReply(new EncryptReplyParams(conversationId, "pong", eventB64));
var reaction = chat.EncryptAddReaction(new EncryptReactionParams(eventB64, "👍"));

var plaintext = chat.Decrypt(encryptedGroupNameB64, convKeyBytes);

Stateless helpers (base64/hex, MIME sniffing, image dimensions) live on ChatXdkUtilities.

API

See the .NET column of the unified tables in docs/API.md for the full method list, parameters, and return types.

Security limitations

The underlying protocol provides no forward secrecy and no post-compromise security: compromise of an identity private key exposes all conversation keys ever encrypted to that public key — and therefore all past and future messages in those conversations. Key rotation does not retroactively protect messages encrypted under a previous key. See docs/CRYPTO.md — Known Limitations.

License

MIT — see the repo LICENSE. Third-party notices: THIRD_PARTY_NOTICES.md.

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.
  • net8.0

    • No dependencies.

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
0.5.0 1,012 8/18/2026
0.4.3 445 7/24/2026
0.4.2 116 7/23/2026
0.4.1 362 7/20/2026
0.4.0 113 7/20/2026
0.2.1 108 7/16/2026
0.2.0 113 7/10/2026