forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (32 loc) · 1.19 KB
/
main.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
35
36
37
38
39
40
package handlers
import (
"strconv"
"time"
"github.com/stellar/go/clients/federation"
"github.com/stellar/go/clients/stellartoml"
"github.com/stellar/go/services/compliance/internal/config"
"github.com/stellar/go/services/compliance/internal/crypto"
"github.com/stellar/go/services/compliance/internal/db"
"github.com/stellar/go/support/http"
)
// RequestHandler implements compliance server request handlers
type RequestHandler struct {
Config *config.Config `inject:""`
Client http.SimpleHTTPClientInterface `inject:""`
Database db.Database `inject:""`
SignatureSignerVerifier crypto.SignerVerifierInterface `inject:""`
StellarTomlResolver stellartoml.ClientInterface `inject:""`
FederationResolver federation.ClientInterface `inject:""`
NonceGenerator NonceGeneratorInterface `inject:""`
}
type NonceGeneratorInterface interface {
Generate() string
}
type NonceGenerator struct{}
func (n *NonceGenerator) Generate() string {
return strconv.FormatInt(time.Now().UnixNano(), 10)
}
type TestNonceGenerator struct{}
func (n *TestNonceGenerator) Generate() string {
return "nonce"
}