Skip to main content

RtSecretValueJsonConverter

Namespace: Meshmakers.Octo.Communication.Contracts.Serialization

System.Text.Json converter for (AB#5528, concept §3.3). It never writes an envelope or a plaintext.

public sealed class RtSecretValueJsonConverter : JsonConverter<RtSecretValue>

Inheritance Object → JsonConverter → JsonConverter<RtSecretValue> → RtSecretValueJsonConverter

Remarks:

Write: every (protected, legacy or pending) is written as the marker {"isSet":true|false} (: false only for an empty value or a legacy placeholder / corrupt string found in storage) - the same shape as OctoSecretStateDto and the GraphQL type OctoSecretState. A null value is written as null by the serializer.

Read: a JSON string is input and becomes (not trimmed; "" becomes Pending(""), which the engine write step treats as "unchanged"). The marker object ({"isSet":true|false}, also {}) means "unchanged" and becomes Pending("") as well; the marker may also carry the other fields of the read state, keyMissing (boolean) and setAt (ISO-8601 date string or null), so a client echoing what it read is "unchanged" (AB#5534 round 2) - deliberately not null, because null clears a secret in the engine write rules (concept §3.6), so a document that was read and is written back keeps its secrets. JSON null stays null. Any other token, or an object with other properties, throws a that never contains the value.

This is the strict wire contract of the engine: reading and writing delegate to (the converters on itself use the same helpers); this type stays as a thin public wrapper for API compatibility (AB#5534).

Fields​

IsSetPropertyName​

Name of the marker property written by the converters (reading also accepts keyMissing and setAt).

public static string IsSetPropertyName;

Properties​

HandleNull​

public bool HandleNull { get; }

Property Value​

Boolean

Type​

public Type Type { get; }

Property Value​

Type

Constructors​

RtSecretValueJsonConverter()​

public RtSecretValueJsonConverter()

Methods​

Read(out Utf8JsonReader, Type, JsonSerializerOptions)​

public RtSecretValue Read(out Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters​

reader Utf8JsonReader

typeToConvert Type

options JsonSerializerOptions

Returns​

RtSecretValue

Write(Utf8JsonWriter, RtSecretValue, JsonSerializerOptions)​

public void Write(Utf8JsonWriter writer, RtSecretValue value, JsonSerializerOptions options)

Parameters​

writer Utf8JsonWriter

value RtSecretValue

options JsonSerializerOptions

WriteMarker(Utf8JsonWriter)​

Writes the marker {"isSet":true}.

public static void WriteMarker(Utf8JsonWriter writer)

Parameters​

writer Utf8JsonWriter
The writer

WriteMarker(Utf8JsonWriter, RtSecretValue)​

Writes the marker {"isSet":true|false} of value ().

public static void WriteMarker(Utf8JsonWriter writer, RtSecretValue value)

Parameters​

writer Utf8JsonWriter
The writer

value RtSecretValue
The secret value