DidDocumentJsonProducer

Centralized conforming producer for DID document JSON per DID 1.1 §6.2.1 / §6.2.3.

Use this when serializing DidDocument to JSON so that:

  • @context uses v1.1 as first entry when useV1_1Context is true

  • controller, alsoKnownAs, verification relationships, and DidService.type (string or array) are emitted correctly

All producers (Universal Registrar adapter, AbstractWebDidMethod, AbstractBlockchainDidMethod, etc.) should use this for consistent, spec-aligned output.

Functions

Link copied to clipboard
fun toBytesWithMediaType(document: DidDocument, useV1_1Context: Boolean = true): Pair<ByteArray, String>

Produces JSON bytes and the conforming Content-Type.

Link copied to clipboard
fun toJsonObject(document: DidDocument, useV1_1Context: Boolean = true): JsonObject

Produces a JSON object for the DID document.