Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

use new ExtractPublicKey signature #17

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ipns.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ func EmbedPublicKey(pk ic.PubKey, entry *pb.IpnsEntry) error {
if err != nil {
return err
}
extracted, err := id.ExtractPublicKey()
if err != nil {
if _, err := id.ExtractPublicKey(); err != peer.ErrNoPublicKey {
// Either a *real* error or nil.
return err
}
if extracted != nil {
return nil
}

// We failed to extract the public key from the peer ID, embed it in the
// record.
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
},
{
"author": "whyrusleeping",
"hash": "QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3",
"hash": "QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB",
"name": "go-libp2p-peer",
"version": "2.3.8"
"version": "2.4.0"
},
{
"author": "whyrusleeping",
"hash": "QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE",
"hash": "QmatE2nxsAaK96jxMFBPMtVJEsaMrcJ21UYBHpXTkEM95r",
"name": "go-libp2p-peerstore",
"version": "2.0.4"
"version": "2.0.5"
},
{
"hash": "QmSb4B8ZAAj5ALe9LjfzPyF8Ma6ezC1NTnDF2JQPUJxEXb",
"hash": "Qma9Eqp16mNHDX1EL73pcxhFfzbyXVcAYtaDd1xdmDRDtL",
"name": "go-libp2p-record",
"version": "4.1.7"
"version": "4.1.8"
},
{
"author": "whyrusleeping",
Expand Down
10 changes: 5 additions & 5 deletions record.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ func (v Validator) Validate(key string, value []byte) error {
}

func (v Validator) getPublicKey(pid peer.ID, entry *pb.IpnsEntry) (ic.PubKey, error) {
pk, err := ExtractPublicKey(pid, entry)
if err != nil {
return nil, err
}
if pk != nil {
switch pk, err := ExtractPublicKey(pid, entry); err {
case peer.ErrNoPublicKey:
case nil:
return pk, nil
default:
return nil, err
}

if v.KeyBook == nil {
Expand Down