ZkDocumentDataWrapperSerializer
Custom serializer wrapper for ZkDocumentData that bridges a limitation in kotlinx.serialization regarding RFC 9360, Section 2 polymorphism.
According to RFC 9360 (used in ISO/IEC 18013-5 for parameters like msoX5chain), certificate chains can be encoded as either a single CBOR Byte String (bstr) or an Array of Byte Strings ([ 2* bstr ]).
Normalization Behavior: This wrapper uses obor to inspect the raw CBOR payload. If the certificate chain (msoX5chain) is present as a single byte string, it normalizes it by wrapping it into a 1-item CBOR Array. This guarantees that kotlinx.serialization (via NormalizedX509Serializer) always encounters a uniform list structure, independent of whether 1 or multiple items (or null) are present.
See also
for msoX5chain (de-)serialization.