From cd32e1772e177f2c2ccc104362db9eca2079ea78 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 27 Aug 2018 10:57:05 +0300 Subject: [PATCH] use MatchesPublicKey, don't rewrite it. --- sign.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sign.go b/sign.go index 8dd9998..d12bce5 100644 --- a/sign.go +++ b/sign.go @@ -30,13 +30,8 @@ func verifyMessageSignature(m *pb.Message) error { } // verify that the source ID matches the attached key - xpid, err := peer.IDFromPublicKey(pubk) - if err != nil { - return err - } - - if pid != xpid { - return fmt.Errorf("bad signing key; source ID/key mismatch: %s %s", pid, xpid) + if !pid.MatchesPublicKey(pubk) { + return fmt.Errorf("bad signing key; source ID %s doesn't match key", pid) } }