Skip to content

Commit

Permalink
fix: --verify forgets the verified key
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta authored and guseggert committed Mar 13, 2023
1 parent fc81639 commit 877d091
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/commands/name/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,20 @@ Passing --verify will verify signature against provided public key.
// Peer ID.
if len(entry.PubKey) > 0 {
pub, err = ic.UnmarshalPublicKey(entry.PubKey)
if err != nil {
return err
}

// Verify the public key matches the name we are verifying.
entryID, err := peer.IDFromPublicKey(pub)

if err != nil {
return err
}

if id != entryID {
return fmt.Errorf("record public key does not match the verified name")
}
}
}
if err != nil {
Expand Down

0 comments on commit 877d091

Please sign in to comment.