Table of Contents

Class ManifestJsonWriter

Namespace
FishMMO.WebServers.Signing
Assembly
Patcher.dll

Emits the exact JSON bytes a signed manifest is made of.

public sealed class ManifestJsonWriter
Inheritance
ManifestJsonWriter
Inherited Members

Remarks

This exists instead of System.Text.Json.JsonSerializer because the signature is over the literal bytes the client receives, and ASP.NET's serialiser is not a stable part of that contract: its naming policy, escaping table and spacing are framework configuration, and a future AddJsonOptions call somewhere in Program.cs would change what goes on the wire without anyone connecting that to "patching stopped working". Owning the emitter makes the wire format a property of this file.

The format is fixed and minimal: "key": value, pairs separated by ", ". The ": " spacing is one of the two the client verifier accepts (it tries ": " first), and it is the one the blanked-signature placeholder is written in, so the emitted document and the canonical message differ in exactly one place — the signature value — by construction.

Insertion order is preserved and never sorted. The client does not care about key order (it substring-searches for one field), but a stable order keeps the ETag, the logs and a human diff meaningful.

Methods

AddBool(string, bool)

Appends a boolean field.

public ManifestJsonWriter AddBool(string name, bool value)

Parameters

name string
value bool

Returns

ManifestJsonWriter

AddNumber(string, long)

Appends an integer field. Always invariant-culture, never grouped.

public ManifestJsonWriter AddNumber(string name, long value)

Parameters

name string
value long

Returns

ManifestJsonWriter

AddString(string, string?)

Appends a string field. The value is JSON-escaped.

public ManifestJsonWriter AddString(string name, string? value)

Parameters

name string
value string

Returns

ManifestJsonWriter

Build()

The document body: the field list WITHOUT the enclosing braces and WITHOUT a trailing separator, ready for SignDocument(string, byte[]) to wrap and sign.

public string Build()

Returns

string

BuildBody(JsonObject)

Re-emits an already-parsed JSON object in this writer's format, minus the enclosing braces. Used by the offline signing tool, which is handed a document somebody else wrote and must normalise it before it can be signed.

public static string BuildBody(JsonObject obj)

Parameters

obj JsonObject

Returns

string