crypto

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	SigTypeUnknown   = crypto.SigTypeUnknown
	SigTypeSecp256k1 = crypto.SigTypeSecp256k1
	SigTypeBLS       = crypto.SigTypeBLS
	SigTypeDelegated = crypto.SigTypeDelegated
)
View Source
const (
	BLSSignatureBytes = 96
)

Variables

This section is empty.

Functions

func Generate added in v1.0.1

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

Generate generates private key of given type

func GenerateFromSeed added in v1.10.0

func GenerateFromSeed(sigType crypto.SigType, seed io.Reader) ([]byte, error)

GenerateFromSeed generates private key of given type and seed

func RegisterSignature added in v1.0.1

func RegisterSignature(typ crypto.SigType, vs SigShim)

RegisterSignature should be only used during init

func Sign

func Sign(msg []byte, privkey []byte, sigType SigType) (*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 added in v1.0.1

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

ToPublic converts private key to public key

func Verify added in v1.0.1

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

Verify verifies signatures

func VerifyAggregate added in v1.0.1

func VerifyAggregate(pubKeys, msgs [][]byte, signature []byte) error

Types

type SigShim added in v1.0.1

type SigShim interface {
	GenPrivate() ([]byte, error)
	GenPrivateFromSeed(seed io.Reader) ([]byte, error)
	ToPublic(pk []byte) ([]byte, error)
	Sign(pk []byte, msg []byte) ([]byte, error)
	Verify(sig []byte, a address.Address, msg []byte) error
	VerifyAggregate(pubKeys, msgs [][]byte, signature []byte) bool
}

SigShim is used for introducing signature functions

type SigType

type SigType = crypto.SigType

type Signature

type Signature = crypto.Signature

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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