envelope

fun envelope(payload: JsonElement, mediaType: String): JsonObject

Builds the RFC 8785 digest envelope anchored on-chain in digest payload mode: the digest is over JCS(payload) and the envelope carries canon = "JCS".

Parameters

payload

the off-chain payload

mediaType

the media type of the original payload


fun envelope(payloadBytes: ByteArray, mediaType: String): JsonObject

Builds a legacy (pre-canonicalization) digest envelope over raw payloadBytes.

Kept for compatibility; new anchors should use the JsonElement overload, whose digest does not depend on key order.

Parameters

payloadBytes

the exact bytes hashed (historically the UTF-8 of the serialized payload JSON)

mediaType

the media type of the original payload