Polhem.JsonRpc.Payload 1.1.1

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

Polhem.JsonRpc.Payload

An optional payload envelope for Polhem.JsonRpc: the params of a request and the result of a response travel as plain JSON, as an encoded body (a codec, then gzip), or as an encrypted one (AES-256-CBC with HMAC-SHA256), with an optional frame that guards against replay. It is the wire format of the Polhem framework; its TypeScript client reads the envelope, the json codec and the encryption, but not yet the frame. It supports trimming and Native AOT, so it runs on iOS, Android and WebAssembly.

var payload = new PayloadProcessor(new PayloadOptions { RequireFrame = true });

var parameters = payload.WrapRequest("Calculator.Add", new AddRequest { A = 1, B = 2 }, PayloadFormat.Encrypted, key: sessionKey, sequence: next);
var result = await rpc.InvokeAsync<JsonElement>("Calculator.Add", parameters);
var added = payload.UnwrapResult<AddResponse>("Calculator.Add", PayloadFormat.Encrypted, result, sessionKey)!;

The format, the codec, the key and the sequence number are chosen per call. An encrypted payload is bound to the method and the direction under its HMAC, so it cannot be sent to another method or sent back as a request. UnwrapResult<T> decodes into the type the caller expects and only checks the envelope's type against it; UnwrapResult without a type argument resolves the type from that name and accepts only the types registered with PayloadOptions.TypeResolver. Under Native AOT, give PayloadOptions.SerializerOptions and the JSON codec options whose TypeInfoResolver is a source-generated JsonSerializerContext.

Documentation and samples: https://github.com/polhem-dev/polhem-jsonrpc

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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Polhem.JsonRpc.Payload:

Package Downloads
Polhem.JsonRpc.Payload.Server

Server half of Polhem.JsonRpc.Payload: a dispatcher filter that opens the payload envelope, checks the replay-protection frame and seals the result.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 0 10/5/2026