-
Notifications
You must be signed in to change notification settings - Fork 4
/
identity.go
28 lines (24 loc) · 973 Bytes
/
identity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package dbft
import (
"fmt"
)
type (
// PublicKey is a generic public key interface used by dbft.
PublicKey any
// PrivateKey is a generic private key interface used by dbft. PrivateKey is used
// only by [PreBlock] and [Block] signing callbacks ([PreBlock.SetData] and
// [Block.Sign]) to grant access to the private key abstraction to Block and
// PreBlock signing code. PrivateKey does not contain any methods, hence user
// supposed to perform type assertion before the PrivateKey usage.
PrivateKey any
// Hash is a generic hash interface used by dbft for payloads, blocks and
// transactions identification. It is recommended to implement this interface
// using hash functions with low hash collision probability. The following
// requirements must be met:
// 1. Hashes of two equal payloads/blocks/transactions are equal.
// 2. Hashes of two different payloads/blocks/transactions are different.
Hash interface {
comparable
fmt.Stringer
}
)