signer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KTBLS       string = "bls"
	KTSecp256k1 string = "secp256k1"
)
View Source
const DST = string("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")

Variables

This section is empty.

Functions

func ActSigType

func ActSigType(typ string) crypto.SigType

func AddressSigType

func AddressSigType(addr address.Address) crypto.SigType

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"

Types

type AggregateSignature

type AggregateSignature = blst.P2Aggregate

type Key

type Key struct {
	KeyInfo

	PublicKey []byte
	Address   address.Address
}

func DecodePricateKey

func DecodePricateKey(k string) (*Key, error)

DecodePricateKey Decode the private key exported: eg:7b22...227d

type KeyInfo

type KeyInfo struct {
	Type       string // secp256k1 or bls
	PrivateKey []byte
}

type PublicKey

type PublicKey = blst.P1Affine

type SecretKey

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

func NewBLSSinger

func NewBLSSinger() SigShim

func NewSecp256k1Singer

func NewSecp256k1Singer() SigShim

type Signature

type Signature = blst.P2Affine

Jump to

Keyboard shortcuts

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