key

package
v0.0.0-...-868bdbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const IDByteLength = crypto.AddressSize

IDByteLength is the length of a crypto.Address. Currently only 20.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID is a hex-encoded crypto.Address

func PubKeyToID

func PubKeyToID(pubKey crypto.PubKey) ID

PubKeyToID returns the ID corresponding to the given PubKey. It's the hex-encoding of the pubKey.Address().

type NodeKey

type NodeKey struct {
	PrivKey crypto.PrivKey `json:"priv_key"` // our priv key
}

NodeKey is the persistent peer key. It contains the nodes private key for authentication.

func LoadNodeKey

func LoadNodeKey(filePath string) (*NodeKey, error)

LoadNodeKey ...

func LoadOrGenNodeKey

func LoadOrGenNodeKey(filePath string) (*NodeKey, error)

LoadOrGenNodeKey for secp256k1 curve LoadOrGenNodeKey attempts to load the NodeKey from the given filePath. If the file does not exist, it generates and saves a new NodeKey.

func (*NodeKey) ID

func (nodeKey *NodeKey) ID() ID

ID returns the peer's canonical ID - the hash of its public key.

func (*NodeKey) PubKey

func (nodeKey *NodeKey) PubKey() crypto.PubKey

PubKey returns the peer's PubKey

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL