iotaledger / crypto.rs

The canonical source of cryptographic ground-truth for IOTA projects that use Rust.
https://iota.org
64 stars 22 forks source link

Add ed25519 public key bytes wrapper #221

Closed DaughterOfMars closed 9 months ago

DaughterOfMars commented 9 months ago

Description of change

This PR adds a public key bytes wrapper that does not require validation to exist.

Type of change

Choose a type of change, and delete any options that are not relevant.

How the change has been tested

Modified a few existing tests to use the new type.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

semenov-vladyslav commented 9 months ago

What is the purpose of such wrapper? In which way the wrapper "does not require validation"?

In my opinion, it adds extra code duplication without clear benefits. Could you please provide a non-trivial use-case example demonstrating benefits of the wrapper?

DaughterOfMars commented 9 months ago

It does not require validation of bytes for the type to be constructed, unlike PublicKey. This allows us to unpack a public key without guaranteeing anything other than the length of the bytes. We need this in shimmer because currently invalid bytes are allowed syntactically (something we hope to change for 2.0).