Closed awesterb closed 8 months ago
Thanks! This makes sense. The only reason we'd implement visit_borrowed_bytes
separately is if we had a zero-copy deserialization routine for these keys. But all of them copy, so there's no special case here.
Worth mentioning that this same issue was just filed over on the old repo (https://github.com/dalek-cryptography/ed25519-dalek/issues/315) and this fix hasn't been released yet.
This is a slight improvement to the deserialisation code for
SigningKey
andVerifyingKey
.The default implementations of
visit_borrowed_bytes
andvisit_byte_buf
forward tovisit_bytes
, but onlyvisit_borrowed_bytes
was implemented for the{Signing,Verifying}KeyVisitor
. This means that{Signing,Verifying}Key
s can only be deserialised from borrowed byte arrays, but not from owned or transient byte arrays. Example:Implementing
visit_bytes
instead ofvisit_borrowed_bytes
enables deserialisation from all three byte array types.