Documentation
¶
Index ¶
- Constants
- Variables
- func PublicKeyToCompressedBytes(pk *PublicKey) []byte
- func PublicKeyToUncompressedBytes(key *PublicKey) []byte
- func SignatureToBytes(sig *Signature) []byte
- func Verify(pk *PublicKey, sig *Signature, msg []byte) bool
- func VerifyProofOfPossession(pk *PublicKey, sig *Signature, msg []byte) bool
- type AggregatePublicKey
- type AggregateSignature
- type LocalSigner
- type PublicKey
- type SecretKey
- type Signature
- type Signer
Constants ¶
const PublicKeyLen = blst.BLST_P1_COMPRESS_BYTES
const SecretKeyLen = blst.BLST_SCALAR_BYTES
const SignatureLen = blst.BLST_P2_COMPRESS_BYTES
Variables ¶
var ( ErrNoPublicKeys = errors.New("no public keys") ErrFailedPublicKeyDecompress = errors.New("couldn't decompress public key") )
var (
ErrFailedSignatureDecompress = errors.New("couldn't decompress signature")
)
Functions ¶
func PublicKeyToCompressedBytes ¶ added in v1.11.3
PublicKeyToCompressedBytes returns the compressed big-endian format of the public key.
func PublicKeyToUncompressedBytes ¶ added in v1.11.3
PublicKeyToUncompressedBytes returns the uncompressed big-endian format of the public key.
func SignatureToBytes ¶
SignatureToBytes returns the compressed big-endian format of the signature.
func Verify ¶
Verify the [sig] of [msg] against the [pk]. The [sig] and [pk] may have been an aggregation of other signatures and keys. Invariant: [pk] and [sig] have both been validated.
func VerifyProofOfPossession ¶
Verify the possession of the secret pre-image of [sk] by verifying a [sig] of [msg] against the [pk]. The [sig] and [pk] may have been an aggregation of other signatures and keys. Invariant: [pk] and [sig] have both been validated.
Types ¶
type AggregatePublicKey ¶
type AggregatePublicKey = blst.P1Aggregate
type AggregateSignature ¶
type AggregateSignature = blst.P2Aggregate
type LocalSigner ¶ added in v1.12.1
type LocalSigner struct {
// contains filtered or unexported fields
}
func NewSigner ¶ added in v1.12.1
func NewSigner() (*LocalSigner, error)
NewSecretKey generates a new secret key from the local source of cryptographically secure randomness.
func SecretKeyFromBytes ¶
func SecretKeyFromBytes(skBytes []byte) (*LocalSigner, error)
SecretKeyFromBytes parses the big-endian format of the secret key into a secret key.
func (*LocalSigner) PublicKey ¶ added in v1.12.1
func (s *LocalSigner) PublicKey() *PublicKey
PublicKey returns the public key that corresponds to this secret key.
func (*LocalSigner) Sign ¶ added in v1.12.1
func (s *LocalSigner) Sign(msg []byte) *Signature
Sign [msg] to authorize this message
func (*LocalSigner) SignProofOfPossession ¶ added in v1.12.1
func (s *LocalSigner) SignProofOfPossession(msg []byte) *Signature
Sign [msg] to prove the ownership
func (*LocalSigner) ToBytes ¶ added in v1.12.1
func (s *LocalSigner) ToBytes() []byte
ToBytes returns the big-endian format of the secret key.
type PublicKey ¶
func AggregatePublicKeys ¶
AggregatePublicKeys aggregates a non-zero number of public keys into a single aggregated public key. Invariant: all [pks] have been validated.
func PublicKeyFromCompressedBytes ¶ added in v1.11.3
PublicKeyFromCompressedBytes parses the compressed big-endian format of the public key into a public key.
func PublicKeyFromValidUncompressedBytes ¶ added in v1.11.3
PublicKeyFromValidUncompressedBytes parses the uncompressed big-endian format of the public key into a public key. It is assumed that the provided bytes are valid.
type Signature ¶
func AggregateSignatures ¶
AggregateSignatures aggregates a non-zero number of signatures into a single aggregated signature. Invariant: all [sigs] have been validated.
func SignatureFromBytes ¶
SignatureFromBytes parses the compressed big-endian format of the signature into a signature.