MaskingContentConverter
class MaskingContentConverter(json: Json, engine: MaskingEngine, registry: Map<String, String>) : ContentConverter
A Ktor ContentConverter that masks responses through the kotlinx backend.
Ktor's json() converter resolves each type's default serializer, so a SerializersModule contextual registration would not intercept @Serializable classes (ADR 0009). Instead this converter resolves the response type's serializer and wraps it with maskingSerializer, which masks only the @IhawuResource types present in registry and passes everything else through untouched — so it is safe to wrap every response.
The caller reaches the (synchronous) encode via a thread-local installed per call by IhawuKtor; with no principal in scope the resource fails closed to {}.
Request bodies are not masked: deserialize delegates to the stock kotlinx converter.
Functions
Link copied to clipboard
open suspend override fun deserialize(charset: Charset, typeInfo: TypeInfo, content: ByteReadChannel): Any?