Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

improve the error message returned when peer verification fails #57

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

marten-seemann
Copy link
Collaborator

No description provided.

crypto.go Outdated
if p, err := peer.IDFromPublicKey(pubKey); err == nil {
peerID = p
}
return fmt.Errorf("peer IDs don't match. Expected %s, got %s", remote, peerID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "peer IDs don't match: expected %s, got %s" but that's mostly just preference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

crypto.go Outdated
@@ -93,7 +93,11 @@ func (i *Identity) ConfigForPeer(remote peer.ID) (*tls.Config, <-chan ic.PubKey)
return err
}
if remote != "" && !remote.MatchesPublicKey(pubKey) {
return errors.New("peer IDs don't match")
var peerID peer.ID = "(not determined)"
if p, err := peer.IDFromPublicKey(pubKey); err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we include the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Done.

@marten-seemann marten-seemann merged commit 8a8ad62 into master Apr 21, 2020
@marten-seemann marten-seemann deleted the improve-verification-error branch August 1, 2020 03:36
@aschmahmann aschmahmann mentioned this pull request Aug 23, 2021
62 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants