Uniform.Matrix.Protocol.Core 0.1.2

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

Uniform.Matrix.Protocol.Core

Types shared by Matrix clients and servers: identifiers, events, request and response records of the Client-Server API, Matrix errors, and canonical JSON for signing.

dotnet add package Uniform.Matrix.Protocol.Core

Identifiers

using Uniform.Matrix.Protocol.Core;

UserId userId = UserId.Parse("@alice:matrix.org");
Console.WriteLine(userId.Localpart);  // alice
Console.WriteLine(userId.ServerName); // matrix.org

MxcUri avatar = MxcUri.Parse("mxc://matrix.org/abc123");
Console.WriteLine(avatar.MediaId);    // abc123

API records and events

Requests, responses and event contents are records in snake_case JSON through MatrixJson.Options:

SyncResponse sync = JsonSerializer.Deserialize<SyncResponse>(json, MatrixJson.Options)!;
foreach ((string roomId, JoinedRoom room) in sync.Rooms.Join)
{
    foreach (ClientEvent clientEvent in room.Timeline.Events)
    {
        if (clientEvent.TryGetContent(out MessageContent? message)) Console.WriteLine($"{clientEvent.Sender}: {message.Body}");
    }
}

Constants for event types, membership, error codes and algorithms are in EventTypes, Memberships, ErrorCodes and EncryptionAlgorithms. A homeserver's error responses become MatrixException, with the HTTP status and the errcode.

Canonical JSON

Canonical JSON is what Matrix signs and hashes: sorted keys, no whitespace.

string canonical = CanonicalJson.Serialize(new { b = 1, a = "x" }); // {"a":"x","b":1}

CanonicalJson.SigningForm drops signatures and unsigned before signing, and AddSignature and GetSignature read and write the signatures object.

About

Part of Uniform.Matrix, a pure .NET implementation of the Matrix specification. Version 0.1 is an early pre-release: APIs may still change.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Uniform.Matrix.Protocol.Core:

Package Downloads
Uniform.Matrix.Protocol.Crypto

Matrix end-to-end encryption in pure .NET: Olm, Megolm, cross-signing, secret storage, key backup and emoji verification, ported from vodozemac and compatible with it.

Uniform.Matrix.Protocol.Client

HTTP client of the Matrix Client-Server API: login, sync, rooms, messages, media, devices, keys and key backup.

Uniform.Matrix.Protocol.Server

Matrix homeserver building blocks: room versions, event format, content hashes, signing, redaction and authorization rules.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 0 10/27/2026
0.1.0 31 10/26/2026
0.1.0-alpha.1 29 10/26/2026