gxt-csharp 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package gxt-csharp --version 3.0.0
                    
NuGet\Install-Package gxt-csharp -Version 3.0.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="gxt-csharp" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="gxt-csharp" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="gxt-csharp" />
                    
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 gxt-csharp --version 3.0.0
                    
#r "nuget: gxt-csharp, 3.0.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 gxt-csharp@3.0.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=gxt-csharp&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=gxt-csharp&version=3.0.0
                    
Install as a Cake Tool

GXT (Game Exchange Token)

Minimal, encrypted, signed and copy-pasteable tokens for manual data exchange between games.

For details check out spec.md.

Rationale

I was thinking about how it could be possible to add trading between two players to a singleplayer game as part of a mod. Mostly out of curiosity to see if it was doable or too much work. At first I thought about having a server that manages the trades, but then I thought that not everybody can or wants to set up a server.

Thats also when I had the idea to package the data into string tokens that can be sent via discord and started researching how to make this somewhat secure and easy to use and implement.

With the current design, every message is signed and encrypted for a designated receiver. This prevents people from fulfilling a trade request and then sending the fulfillment to 50 people who all collect the rewards. Its still not as secure as server side validation, but thats okay for me.

While working on this, I also realized that there is potential for more than just trading, so I removed all the trade specific fields and the protocol now takes an opaque payload that can contain any valid json value. (Strings, Numbers, Maps, etc.)

About

The protocol uses an Ed25519 key pair for signing messages and to derive a X25519 key pair from encryption.

The size of the token before encoding is limited to 64KB.

Because this is intended to be easy to integrate by mod authors, a library and cli are provided. Both are written in rust. There is also a wrapper that exposes a C API called gxt-api-c, a wrapper that provides the API as an Extism plugin and a C# wrapper (based on Extism).

Install

cargo install gxt-cli

# or if you want the UI as well
cargo install gxt-cli -F ui

Demo

# Create keys for communication
gxt keygen --out alice.key
gxt keygen --out bob.key

# Create an id card for bob
echo '{"name":"Bob"}' | gxt id bob.key --out bob.id --meta -

# Verify if the id card is valid and signed
gxt verify --file bob.id

# Create a message for bob using their id card and your own key
gxt msg --key alice.key --to bob.id --out msg_to_bob.gxt --payload '{"hello":"world"}'

# Verify if the message is valid and signed
gxt verify --file msg_to_bob.gxt

# Decrypt the message using bobs key
gxt decrypt --key bob.key --file msg_to_bob.gxt

# Try decrypting a message with a key its not intended for
gxt keygen --out charlie.key
gxt decrypt --key charlie.key --file msg_to_bob.gxt

CLI

General

GXT (Game Exchange Token)

Usage: gxt <COMMAND>

Commands:
  keygen   Generates a new private key
  id       Generate an ID card containing the data about a peer
  verify   Verify a message
  msg      Create an encrypted message
  decrypt  Decrypt a message
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Keygen

Generates a new private key

Usage: gxt keygen --out <OUT>

Options:
  -o, --out <OUT>  Where to store the key
  -h, --help       Print help

Id

Generate an ID card containing the data about a peer

Usage: gxt id [OPTIONS] --meta <META> <KEY>

Arguments:
  <KEY>  The key of the person creating the id card

Options:
  -m, --meta <META>  Meta data for the id card. Can be anything, but must be set. Pass - to read from stdin
  -o, --out <OUT>    Where to store the id card token
  -h, --help         Print help

Verify

Verify a message

Usage: gxt.exe verify [OPTIONS] <--msg <MSG>|--file <FILE>>

Options:
  -m, --msg <MSG>    The string token containing the message. Pass - to read from stdin
  -f, --file <FILE>  The path to the encrypted message
  -j, --json         Print output as json
  -h, --help         Print help

Msg

Create an encrypted message

Usage: gxt msg [OPTIONS] --key <KEY> --to <TO> --payload <PAYLOAD>

Options:
  -k, --key <KEY>         The key of the sender
  -t, --to <TO>           The id card of the recipient
  -p, --parent <PARENT>   The parent of this message
  --payload <PAYLOAD> The payload of the message. Can be anything, but must be set. Pass - to read from stdin
  -o, --out <OUT>         Where to store the message token
  -h, --help              Print help

Decrypt

Decrypt a message

Usage: gxt.exe decrypt [OPTIONS] --key <KEY> <--msg <MSG>|--file <FILE>>

Options:
  -k, --key <KEY>    The key of the receiver
  -m, --msg <MSG>    The string token containing the message. Pass - to read from stdin
  -f, --file <FILE>  The path to the encrypted message
  -j, --json         Print output as json
  -h, --help         Print help

C API

To use the C API, clone the repository and then build the crate gxt-api-c. This will create a dynamic and a static library, as well as the corresponding include header, inside the target directory.

git clone https://github.com/hardliner66/gxt
cd gxt
cargo build -p gxt-api-c --release
cd target/release
ls

Extism API

By exposing the API as an Extism plugin its possible to use the library in every language that is supported as a host language by Extism.

C# API

Ready to use C# DLL, which loads the library through Extism, so we don't have to deploy the native library.

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
4.2.0 175 9/24/2025
4.1.0 173 9/23/2025
4.0.2 176 9/20/2025
4.0.1 220 9/19/2025
4.0.0 355 9/19/2025 4.0.0 is deprecated because it has critical bugs.
3.0.1 300 9/16/2025
3.0.0 296 9/15/2025
2.2.0 252 9/15/2025
2.1.0 249 9/15/2025
2.0.1 418 9/15/2025 2.0.1 is deprecated because it has critical bugs.
1.2.0 168 9/12/2025
1.0.0 183 9/11/2025