Documentation ¶
Index ¶
Constants ¶
const ( ATX Domain = 0 PROPOSAL = 1 BALLOT = 2 HARE = 3 POET = 4 BEACON_FIRST_MSG = 10 BEACON_FOLLOWUP_MSG = 11 )
const PrivateKeySize = ed25519.PrivateKeySize
PrivateKeySize size of the private key in bytes.
Variables ¶
This section is empty.
Functions ¶
func Public ¶ added in v1.0.0
func Public(priv PrivateKey) ed25519.PublicKey
Types ¶
type EdSigner ¶
type EdSigner struct {
// contains filtered or unexported fields
}
EdSigner represents an ED25519 signer.
func NewEdSigner ¶
func NewEdSigner(opts ...EdSignerOptionFunc) (*EdSigner, error)
NewEdSigner returns an auto-generated ed signer.
func (*EdSigner) PrivateKey ¶ added in v1.0.0
func (es *EdSigner) PrivateKey() PrivateKey
PrivateKey returns private key.
type EdSignerOptionFunc ¶ added in v1.0.0
type EdSignerOptionFunc func(*edSignerOption) error
EdSignerOptionFunc modifies EdSigner.
func WithKeyFromRand ¶ added in v1.0.0
func WithKeyFromRand(rand io.Reader) EdSignerOptionFunc
WithKeyFromRand sets the private key used by EdSigner using predictable randomness source.
func WithPrefix ¶ added in v1.0.0
func WithPrefix(prefix []byte) EdSignerOptionFunc
WithPrefix sets the prefix used by EdSigner. This usually is the Network ID.
func WithPrivateKey ¶ added in v1.0.0
func WithPrivateKey(priv PrivateKey) EdSignerOptionFunc
WithPrivateKey sets the private key used by EdSigner.
type EdVerifier ¶ added in v1.0.0
type EdVerifier struct {
// contains filtered or unexported fields
}
EdVerifier extracts public keys from signatures.
func NewEdVerifier ¶ added in v1.0.0
func NewEdVerifier(opts ...VerifierOptionFunc) (*EdVerifier, error)
func (*EdVerifier) Verify ¶ added in v1.0.0
func (es *EdVerifier) Verify(d Domain, nodeID types.NodeID, m []byte, sig types.EdSignature) bool
Verify verifies that a signature matches public key and message.
type PrivateKey ¶ added in v1.0.0
type PrivateKey = ed25519.PrivateKey
PrivateKey is an alias to ed25519.PrivateKey.
type PublicKey ¶
PublicKey is the type describing a public key.
func NewPublicKey ¶
NewPublicKey constructs a new public key instance from a byte array.
func (*PublicKey) Field ¶ added in v0.1.15
Field returns a log field. Implements the LoggableField interface.
func (*PublicKey) ShortString ¶
ShortString returns a representative sub string.
type VRFSigner ¶ added in v0.1.34
type VRFSigner struct {
// contains filtered or unexported fields
}
VRFSigner is a signer for VRF purposes.
func (VRFSigner) LittleEndian ¶ added in v1.0.0
LittleEndian indicates whether byte order in a signature is little-endian.
type VRFVerifier ¶ added in v1.0.0
func NewVRFVerifier ¶ added in v1.0.0
func NewVRFVerifier() VRFVerifier
func (VRFVerifier) Verify ¶ added in v1.0.0
func (v VRFVerifier) Verify(nodeID types.NodeID, msg []byte, sig types.VrfSignature) bool
Verify verifies that a signature matches public key and message.
type VerifierOptionFunc ¶ added in v1.0.0
type VerifierOptionFunc func(*edVerifierOption) error
VerifierOptionFunc to modify verifier.
func WithVerifierPrefix ¶ added in v1.0.0
func WithVerifierPrefix(prefix []byte) VerifierOptionFunc
WithVerifierPrefix sets the prefix used by PubKeyVerifier. This usually is the Network ID.