sigs

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBlockSignature

func CheckBlockSignature(ctx context.Context, blk *block.Block, worker address.Address) error

func Generate

func Generate(sigType crypto.SigType) ([]byte, error)

Generate generates private key of given type

func RegisterSignature

func RegisterSignature(typ crypto.SigType, vs SigShim)

RegisterSignature should be only used during init

func Sign

func Sign(sigType crypto.SigType, privkey []byte, msg []byte) (*crypto.Signature, error)

Sign takes in signature type, private key and message. Returns a signature for that message. Valid sigTypes are: "secp256k1" and "bls"

func ToPublic

func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error)

ToPublic converts private key to public key

func Verify

func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error

Verify verifies signatures

Types

type SigShim

type SigShim interface {
	GenPrivate() ([]byte, error)
	ToPublic(pk []byte) ([]byte, error)
	Sign(pk []byte, msg []byte) ([]byte, error)
	Verify(sig []byte, a address.Address, msg []byte) error
}

SigShim is used for introducing signature functions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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