Documentation ¶
Index ¶
- Constants
- func Public(priv PrivateKey) ed25519.PublicKey
- func VRFVerify(nodeID types.NodeID, msg []byte, sig types.VrfSignature) bool
- type Domain
- type EdSigner
- func (es *EdSigner) Matches(x any) bool
- func (es *EdSigner) Name() string
- func (es *EdSigner) NodeID() types.NodeID
- func (es *EdSigner) Prefix() []byte
- func (es *EdSigner) PrivateKey() PrivateKey
- func (es *EdSigner) PublicKey() *PublicKey
- func (es *EdSigner) Sign(d Domain, m []byte) types.EdSignature
- func (es *EdSigner) String() string
- func (es *EdSigner) VRFSigner() *VRFSigner
- type EdSignerOptionFunc
- type EdVerifier
- type PrivateKey
- type PublicKey
- type VRFSigner
- type VRFVerifier
- type VerifierOptionFunc
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) Matches ¶ added in v1.4.0
Matches implements the gomock.Matcher interface for testing.
func (*EdSigner) Name ¶ added in v1.4.0
Name returns the name of the signer. This is the filename of the identity file.
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 FromFile ¶ added in v1.4.0
func FromFile(path string) EdSignerOptionFunc
FromFile loads the private key from a file.
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
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.
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)
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.