file

package
v0.2103.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 9 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"
)

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"
	// FileConsensusKey is the consensus key filename.
	FileConsensusKey = "consensus.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) 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) 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