bls

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateG1Points

func AggregateG1Points(points []*bn256.G1) *bn256.G1

AggregateG1Points aggregates array of G1 points into a single G1 point.

func AggregateG2Points

func AggregateG2Points(points []*bn256.G2) *bn256.G2

AggregateG2Points aggregates array of G2 points into a single G2 point.

func RecoverPublicKey

func RecoverPublicKey(shares []*PublicKeyShare, threshold int) (*bn256.G2, error)

RecoverPublicKey reconstructs public key from a threshold number of public key shares using Lagrange interpolation.

func RecoverSignature

func RecoverSignature(shares []*SignatureShare, threshold int) (*bn256.G1, error)

RecoverSignature reconstructs the full BLS signature from a threshold number of signature shares using Lagrange interpolation.

func Sign

func Sign(secretKey *big.Int, message []byte) *bn256.G1

Sign creates a point on a curve G1 by hashing and signing provided message using the provided secret key.

func SignG1

func SignG1(secretKey *big.Int, message *bn256.G1) *bn256.G1

SignG1 creates a point on a curve G1 by signing the provided G1 point message using the provided secret key.

func Verify

func Verify(publicKey *bn256.G2, message []byte, signature *bn256.G1) bool

Verify performs the pairing operation to check if the signature is correct for the provided message and the corresponding public key.

func VerifyG1

func VerifyG1(publicKey *bn256.G2, message *bn256.G1, signature *bn256.G1) bool

VerifyG1 performs the pairing operation to check if the signature is correct for the provided G1 point message and the corresponding public key.

Types

type PublicKeyShare

type PublicKeyShare struct {
	I int       // Index of public key share
	V *bn256.G2 // Value of public key share
}

PublicKeyShare represents public key share and its index.

type SecretKeyShare

type SecretKeyShare struct {
	I int      // Index of secret key share
	V *big.Int // Value of secret key share
}

SecretKeyShare represents secret key share and its index.

func GetSecretKeyShare

func GetSecretKeyShare(masterSecretKey []*big.Int, i int) *SecretKeyShare

GetSecretKeyShare computes secret share by evaluating a polynomial with coefficients taken from masterSecretKey. This is based on Shamir's Secret Sharing scheme and 'i' represents participant index.

func (*SecretKeyShare) PublicKeyShare

func (s *SecretKeyShare) PublicKeyShare() *PublicKeyShare

PublicKeyShare returns public key share from the current secret key share.

type SignatureShare

type SignatureShare struct {
	I int       // Index of signature share
	V *bn256.G1 // Value of signature share
}

SignatureShare represents signature share and its index.

Jump to

Keyboard shortcuts

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