aboutsummaryrefslogtreecommitdiffstats
path: root/core/interfaces.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/interfaces.go')
-rw-r--r--core/interfaces.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/interfaces.go b/core/interfaces.go
index 36b0160..5e1002c 100644
--- a/core/interfaces.go
+++ b/core/interfaces.go
@@ -108,3 +108,29 @@ type Ticker interface {
// Stop the ticker.
Stop()
}
+
+// Signer defines a role to sign data.
+type Signer interface {
+ // SignBlock signs a block.
+ SignBlock(b *types.Block) error
+ // SignVote signs a vote.
+ SignVote(v *types.Vote) error
+ // SignCRS sign a block's CRS signature.
+ SignCRS(b *types.Block, crs common.Hash) error
+}
+
+// CryptoVerifier defines a role to verify data in crypto's way.
+type CryptoVerifier interface {
+ // VerifyBlock verifies if a block is properly signed or not.
+ VerifyBlock(b *types.Block) (ok bool, err error)
+ // VerifyVote verfies if a vote is properly signed or not.
+ VerifyVote(v *types.Vote) (ok bool, err error)
+ // VerifyCRS verifies if a CRS signature of one block is valid or not.
+ VerifyCRS(b *types.Block, crs common.Hash) (ok bool, err error)
+}
+
+// Authenticator verify/sign who own the data.
+type Authenticator interface {
+ Signer
+ CryptoVerifier
+}