file

package
v0.2202.11 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package file provides a PEM file backed signer.

Index

Constants

View Source
const (

	// SignerName is the name used to identify the file backed signer.
	SignerName = "file"

	// StaticEntropySize is the size of the provided static entropy.
	StaticEntropySize = 32
)

Variables

View Source
var (

	// FileEntityKey is the entity key filename.
	FileEntityKey = "entity.pem"
	// FileIdentityKey is the identity key filename.
	FileIdentityKey = "identity.pem"
	// FileP2PKey is the P2P key filename.
	FileP2PKey = "p2p.pem"
	// FileP2PStaticEntropy is the static P2P entropy filename.
	FileP2PStaticEntropy = "p2p_entropy.pem"
	// FileConsensusKey is the consensus key filename.
	FileConsensusKey = "consensus.pem"
	// FileVRFKey is the vrf key filename.
	FileVRFKey = "vrf.pem"
)

Functions

func NewFactory

func NewFactory(config interface{}, roles ...signature.SignerRole) (signature.SignerFactory, error)

NewFactory creates a new factory with the specified roles, with the specified dataDir.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is a PEM file backed SignerFactory.

func (*Factory) EnsureRole

func (fac *Factory) EnsureRole(role signature.SignerRole) error

EnsureRole ensures that the SignerFactory is configured for the given role.

func (*Factory) ForceLoad

func (fac *Factory) ForceLoad(fn string) (signature.Signer, error)

ForceLoad is evil and should be destroyed, however that requires fixing deployment, and the entity key for node registration mess.

func (*Factory) Generate

func (fac *Factory) Generate(role signature.SignerRole, rng io.Reader) (signature.Signer, error)

Generate will generate and persist a new private key corresponding to the role, and return a Signer ready for use, using entropy from `rng`.

func (*Factory) Load

func (fac *Factory) Load(role signature.SignerRole) (signature.Signer, error)

Load will load the private key corresponding to the role, and return a Signer ready for use.

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer is a PEM file backed Signer.

func (*Signer) ContextSign

func (s *Signer) ContextSign(context signature.Context, message []byte) ([]byte, error)

ContextSign generates a signature with the private key over the context and message.

func (*Signer) Prove added in v0.2200.0

func (s *Signer) Prove(alphaString []byte) ([]byte, error)

Prove generates a VRF proof with the private key over the alpha.

func (*Signer) Public

func (s *Signer) Public() signature.PublicKey

Public returns the PublicKey corresponding to the signer.

func (*Signer) Reset

func (s *Signer) Reset()

Reset tears down the Signer and obliterates any sensitive state if any.

func (*Signer) StaticEntropy added in v0.2200.0

func (s *Signer) StaticEntropy() ([]byte, error)

StaticEntropy returns PrivateKeySize bytes of cryptographic entropy that is independent from the Signer's private key. The value of this entropy is constant for the lifespan of the signer's underlying key pair.

func (*Signer) String

func (s *Signer) String() string

String returns anything but the actual private key backing the Signer.

Jump to

Keyboard shortcuts

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