-
Notifications
You must be signed in to change notification settings - Fork 13
/
http.go
29 lines (26 loc) · 926 Bytes
/
http.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
package main
import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/tonkeeper/tonproof/config"
)
func registerHandlers(e *echo.Echo, h *handler) {
proof := e.Group("/ton-proof")
proof.POST("/generatePayload", h.PayloadHandler, middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{echo.POST},
}))
proof.POST("/checkProof", h.ProofHandler, middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{echo.POST},
}))
dapp := e.Group("/dapp")
dapp.Use(middleware.CORS())
dapp.GET("/getAccountInfo", h.GetAccountInfo, middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{echo.GET},
}), middleware.JWTWithConfig(middleware.JWTConfig{
Claims: &jwtCustomClaims{},
SigningKey: []byte(config.Proof.PayloadSignatureKey),
}))
}