sigs

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DST = string("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")

Variables

View Source
var BS blsSigner

Functions

func BLSInit added in v0.3.5

func BLSInit()

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 SecpInit added in v0.3.5

func SecpInit()

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 AggregateSignature added in v0.3.5

type AggregateSignature = blst.P2Aggregate

type PublicKey added in v0.3.5

type PublicKey = blst.P1Affine

type SecretKey added in v0.3.5

type SecretKey = blst.SecretKey

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

type Signature added in v0.3.5

type Signature = blst.P2Affine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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