ContentNegotiationService
interface ContentNegotiationService
Content negotiation service for DID resolution.
Supports multiple content types for DID documents to ensure interoperability with different clients and use cases.
Supported Content Types:
application/did(default) - DID 1.1 / DID Resolution 1.0 media typeapplication/did+ld+json- JSON-LD format with full context (legacy, DID Core 1.0)application/did+json- Plain JSON format without JSON-LD processing (legacy, DID Core 1.0)application/did+cbor- CBOR format for compact representationapplication/json- Fallback JSON format
Example Usage:
val negotiationService = DefaultContentNegotiationService()
// Negotiate content type from Accept header
val contentType = negotiationService.negotiateContentType("application/did+cbor")
// Serialize document
val bytes = negotiationService.serializeDocument(document, contentType)Content copied to clipboard
Inheritors
Functions
Link copied to clipboard
Deserialize document from content type.
Link copied to clipboard
abstract suspend fun negotiateContentType(acceptHeader: String?, defaultType: String = DidMediaTypes.DID): String
Negotiate content type from Accept header.
Link copied to clipboard
Serialize document to requested content type.