ByteString

Specifies that a ByteArray shall be encoded/decoded as CBOR major type 2: a byte string. For types other than ByteArray, ByteString will have no effect.

Example usage:

@Serializable
data class Data(
@ByteString
val a: ByteArray, // CBOR major type 2: a byte string.

val b: ByteArray // CBOR major type 4: an array of data items.
)

See RFC 7049 2.1. Major Types.