diff --git a/core/commands/name/name.go b/core/commands/name/name.go index 7999aee3d..0e4fa6cb5 100644 --- a/core/commands/name/name.go +++ b/core/commands/name/name.go @@ -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 {