fix: --verify forgets the verified key
Laurent Senta committed
Mar 9, 2023 at 15:23 UTC
877d091d7530e6ffea33c55c956077e06bc89557
1 file changed
+14
core/commands/name/name.go
+14
@@ -222,6 +222,20 @@ Passing --verify will verify signature against provided public key.
222
// Peer ID.
223
if len(entry.PubKey) > 0 {
224
pub, err = ic.UnmarshalPublicKey(entry.PubKey)
225
+ if err != nil {
226
+ return err
227
+ }
228
+
229
+ // Verify the public key matches the name we are verifying.
230
+ entryID, err := peer.IDFromPublicKey(pub)
231
+
232
+ if err != nil {
233
+ return err
234
+ }
235
+
236
+ if id != entryID {
237
+ return fmt.Errorf("record public key does not match the verified name")
238
+ }
239
}
240
}
241
if err != nil {