sigs

package
v0.0.0-...-484cccf Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sigs allows for signing, verifying signatures and key generation using key types selected by package user.

For support of secp256k1 import: _ "github.com/filecoin-project/lotus/lib/sigs/secp"

For support of Filecoin BLS import: _ "github.com/filecoin-project/lotus/lib/sigs/bls"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBlockSignature

func CheckBlockSignature(ctx context.Context, blk *types.BlockHeader, 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