github.com/0chain/gosdk@v1.17.11/core/zcncrypto/bls.go (about)

     1  package zcncrypto
     2  
     3  import "io"
     4  
     5  var BlsSignerInstance BlsSigner
     6  
     7  type BlsSigner interface {
     8  	SetRandFunc(randReader io.Reader)
     9  	FrSub(out Fr, x Fr, y Fr)
    10  
    11  	NewFr() Fr
    12  	NewSecretKey() SecretKey
    13  	NewPublicKey() PublicKey
    14  	NewSignature() Signature
    15  	NewID() ID
    16  }
    17  
    18  // Fr --
    19  type Fr interface {
    20  	Serialize() []byte
    21  
    22  	SetLittleEndian(buf []byte) error
    23  }
    24  
    25  type SecretKey interface {
    26  	SerializeToHexStr() string
    27  	DeserializeHexStr(s string) error
    28  
    29  	Serialize() []byte
    30  
    31  	GetLittleEndian() []byte
    32  	SetLittleEndian(buf []byte) error
    33  
    34  	SetByCSPRNG()
    35  
    36  	GetPublicKey() PublicKey
    37  
    38  	Sign(m string) Signature
    39  	Add(rhs SecretKey)
    40  
    41  	GetMasterSecretKey(k int) (msk []SecretKey, err error)
    42  	Set(msk []SecretKey, id ID) error
    43  }
    44  
    45  type PublicKey interface {
    46  	SerializeToHexStr() string
    47  	DeserializeHexStr(s string) error
    48  
    49  	Serialize() []byte
    50  }
    51  
    52  type Signature interface {
    53  	SerializeToHexStr() string
    54  	DeserializeHexStr(s string) error
    55  
    56  	Add(rhs Signature)
    57  
    58  	Verify(pk PublicKey, m string) bool
    59  }
    60  
    61  type ID interface {
    62  	SetHexString(s string) error
    63  	GetHexString() string
    64  
    65  	SetDecString(s string) error
    66  }