-
Notifications
You must be signed in to change notification settings - Fork 178
/
local.go
34 lines (26 loc) · 1.22 KB
/
local.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
29
30
31
32
33
34
// (c) 2019 Dapper Labs - ALL RIGHTS RESERVED
package module
import (
"github.com/onflow/flow-go/crypto"
"github.com/onflow/flow-go/crypto/hash"
"github.com/onflow/flow-go/model/flow"
)
// Local encapsulates the stable local node information.
type Local interface {
// NodeID returns the node ID of the local node.
NodeID() flow.Identifier
// Address returns the (listen) address of the local node.
Address() string
// Sign provides a signature oracle that given a message and hasher, it
// generates and returns a signature over the message using the node's private key
// as well as the input hasher
Sign([]byte, hash.Hasher) (crypto.Signature, error)
// NotMeFilter returns handy not-me filter for searching identity
NotMeFilter() flow.IdentityFilter
// SignFunc provides a signature oracle that given a message, a hasher, and a signing function, it
// generates and returns a signature over the message using the node's private key
// as well as the input hasher by invoking the given signing function. The overall idea of this function
// is to not expose the private key to the caller.
SignFunc([]byte, hash.Hasher, func(crypto.PrivateKey, []byte, hash.Hasher) (crypto.Signature,
error)) (crypto.Signature, error)
}