CBOR encoder needs to deal with bytes directly.
Actually, this bug applies to all different value types the encoder support. Instead of holding the value, the encoder will be more efficient to provide a mode to only hold a reference to the value and then let the caller to guarantee the value is unchanged and alive during the encoding period. Anyway, it will be good to optimize it but not a blocker for the feature.
We should consider adding && getter for CBORValue.