From d001ed74513eab7aee0fbef5f3c5ea0d94ca43e9 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Thu, 9 Mar 2023 15:23:52 +0100 Subject: [PATCH] fix: --verify forgets the verified key --- core/commands/name/name.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 {