-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4524 from ElrondNetwork/merge-rc-v1.4.0-in-multis…
…igner Merge rc v1.4.0 in multisigner
- Loading branch information
Showing
632 changed files
with
10,884 additions
and
39,581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
libp2pCrypto "github.com/libp2p/go-libp2p-core/crypto" | ||
"github.com/libp2p/go-libp2p-core/peer" | ||
) | ||
|
||
type p2pConverter struct{} | ||
|
||
// NewP2pConverter creates a new instance of p2p converter | ||
func NewP2pConverter() *p2pConverter { | ||
return &p2pConverter{} | ||
} | ||
|
||
// Len return zero | ||
func (p *p2pConverter) Len() int { | ||
return 0 | ||
} | ||
|
||
// Decode does nothing | ||
func (p *p2pConverter) Decode(humanReadable string) ([]byte, error) { | ||
return nil, fmt.Errorf("not implemented") | ||
} | ||
|
||
// Encode encodes a byte array representing public key as peer ID string | ||
func (p *p2pConverter) Encode(pkBytes []byte) string { | ||
pubKey, err := libp2pCrypto.UnmarshalSecp256k1PublicKey(pkBytes) | ||
if err != nil { | ||
return "" | ||
} | ||
|
||
id, err := peer.IDFromPublicKey(pubKey) | ||
if err != nil { | ||
return "" | ||
} | ||
|
||
return id.Pretty() | ||
} | ||
|
||
// IsInterfaceNil returns true if there is no value under the interface | ||
func (p *p2pConverter) IsInterfaceNil() bool { | ||
return p == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.