pubky / pkarr

Public Key Addressable Resource Records (sovereign TLDs)
https://app.pkarr.org
MIT License
153 stars 17 forks source link

fix: always include the pubkey in the inner bytes #56

Closed Frando closed 6 months ago

Frando commented 6 months ago

The inner bytes payload contained in a SignedPacket currently is different depending on how the SignedPacket was constructed. So the AsRef<[u8]> would returns a byte slice with the 32 byte pubkey at the beginning if the packet was created with SignedPacket::from_packet() and without the 32 byte pubkey if created with SignedPacket::from_relay_response().

This PR fixes this and also exposes as_bytes / from_bytes methods which are useful for persisting the full signed packet to a database or cache.

Nuhvi commented 6 months ago

Wow can't believe it took so long for this bug to be discovered, thanks @Frando.