identity

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package identity stores the ECDSA P2P key and the BLS12-381 DV consensus key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsensusKey

type ConsensusKey struct {
	PrivKey kyber.Scalar
	PubKey  *bls12381.KyberG1
}

ConsensusKey wraps a BLS12-381 keypair.

type ConsensusStore

type ConsensusStore struct {
	KeystorePath string
	PasswordPath string
}

ConsensusStore stores a single DVC consensus key using a keystore and password file.

func DefaultConsensus

func DefaultConsensus() ConsensusStore

DefaultConsensus returns the DVC identity store at the default file path (<data_dir>/nodekey.json).

func (ConsensusStore) Create

func (s ConsensusStore) Create() (*ConsensusKey, error)

Create generates a new key and saves the new node identity.

TODO Make sure the created key can't ever be used for validators.

func (ConsensusStore) Get

func (s ConsensusStore) Get() (*ConsensusKey, error)

Get retrieves the existing node identity or creates a new one.

func (ConsensusStore) Load

func (s ConsensusStore) Load() (*ConsensusKey, error)

Load reads the existing node identity.

func (ConsensusStore) Password

func (s ConsensusStore) Password() (password string, err error)

Password reads the node password or creates a new random password if none exists.

type P2PStore

type P2PStore struct {
	KeyPath string
}

P2PStore stores the P2P identity key.

func DefaultP2P

func DefaultP2P() P2PStore

DefaultP2P returns the DVC identity store at the default file path (<data_dir>/nodekey.json).

func (P2PStore) Create

func (s P2PStore) Create() (*ecdsa.PrivateKey, error)

Create generates a new key and saves the new node identity.

func (P2PStore) Get

func (s P2PStore) Get() (*ecdsa.PrivateKey, error)

Get retrieves the existing node identity or creates a new one.

func (P2PStore) Load

func (s P2PStore) Load() (*ecdsa.PrivateKey, error)

Load reads the existing node identity.

func (P2PStore) MustGet

func (s P2PStore) MustGet() *ecdsa.PrivateKey

MustGet returns the node's identity or terminates the program if an error occurs.

Jump to

Keyboard shortcuts

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