Skip to content

Commit

Permalink
fix(key): display ed25519 public key size on error.
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Normand <me@zenithar.org>
  • Loading branch information
Zenithar committed Jun 28, 2022
1 parent 4c779fb commit 5e47396
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/keys/ed25519.go
Expand Up @@ -63,8 +63,8 @@ func (e *ed25519Verifier) UnmarshalPublicKey(key *data.PublicKey) error {
}
return err
}
if len(e.PublicKey) != ed25519.PublicKeySize {
return errors.New("tuf: unexpected public key length for ed25519 key")
if n := len(e.PublicKey); n != ed25519.PublicKeySize {
return fmt.Errorf("tuf: unexpected public key length for ed25519 key, expected %d, got %d", ed25519.PublicKeySize, n)
}
return nil
}
Expand Down

0 comments on commit 5e47396

Please sign in to comment.