Documentation ¶
Index ¶
- Constants
- func HashesToBytes(hashes []Hash) [][]byte
- func IDToByte(id Identifier) []byte
- func PubVerify(sig Signature, data []byte, nodeID identity.NodeID) (bool, error)
- func SetKeys() error
- func VerifyQuorumSignature(aggregatedSigs AggSig, blockID Identifier, aggSigners []identity.NodeID) (bool, error)
- type AggSig
- type ECDSASignature
- type Hash
- type Hasher
- type Identifier
- type PrivateKey
- type PublicKey
- type Signature
- type StaticRand
Constants ¶
View Source
const ( SHA3_224 = "sha3_224" SHA3_256 = "sha3_256" SHA3_384 = "sha3_384" SHA3_512 = "sha3_512" )
View Source
const ( HashLenSha3_224 = 32 HashLenSha3_256 = 32 HashLenSha3_384 = 32 HashLenSha3_512 = 32 )
View Source
const ( // Supported signing algorithms //UnknownSigningAlgorithm SigningAlgorithm = iota BLS_BLS12381 = "BLS_BLS12381" ECDSA_P256 = "ECDSA_P256" ECDSA_SECp256k1 = "ECDSA_SECp256k1" )
Variables ¶
This section is empty.
Functions ¶
func HashesToBytes ¶
HashesToBytes converts a slice of hashes to a slice of byte slices.
func IDToByte ¶
func IDToByte(id Identifier) []byte
func VerifyQuorumSignature ¶
Types ¶
type ECDSASignature ¶
type ECDSASignature struct {
// contains filtered or unexported fields
}
type Hash ¶
type Hash []byte
Hash is the hash algorithms output types
func BytesToHash ¶
type Hasher ¶
type Hasher interface { // Size returns the hash output length Size() int // ComputeHash returns the hash output regardless of the hash state ComputeHash([]byte) Hash // Write([]bytes) (using the io.Writer interface) adds more bytes to the // current hash state io.Writer // SumHash returns the hash output and resets the hash state SumHash() Hash // Reset resets the hash state Reset() }
Hasher interface
type Identifier ¶
type Identifier [32]byte
func HashToID ¶
func HashToID(hash []byte) Identifier
func MakeID ¶
func MakeID(body interface{}) Identifier
MakeID creates an ID from the hash of encoded data.
type PrivateKey ¶
type PrivateKey interface { // Algorithm returns the signing algorithm related to the private key. Algorithm() string // KeySize return the key size in bytes. // KeySize() int // Sign generates a signature using the provided hasher. Sign([]byte, Hasher) (Signature, error) // PublicKey returns the public key. PublicKey() PublicKey }
PrivateKey is an unspecified signature scheme private key
func GenerateKey ¶
func GenerateKey(signer string, id identity.NodeID) (PrivateKey, error)
type PublicKey ¶
type PublicKey interface { // Algorithm returns the signing algorithm related to the public key. Algorithm() string // KeySize return the key size in bytes. //KeySize() int // Verify verifies a signature of an input message using the provided hasher. Verify(Signature, Hash) (bool, error) }
PublicKey is an unspecified signature scheme public key.
type Signature ¶
type Signature [][]byte
func (*Signature) ToECDSA ¶
func (sig *Signature) ToECDSA() ECDSASignature
TODO: I have to generate an error here
type StaticRand ¶
Click to show internal directories.
Click to hide internal directories.