Documentation ¶
Index ¶
- func WithEncRPCConnection[R any](ctx context.Context, rpc *BackendRPC, acct *wecommon.GWAccount, ...) (*R, error)
- func WithPlainRPCConnection[R any](ctx context.Context, b *BackendRPC, ...) (*R, error)
- type BackendRPC
- func (rpc *BackendRPC) ConnectHttp(ctx context.Context, account *wecommon.GWAccount) (*tenrpc.EncRPCClient, error)
- func (rpc *BackendRPC) ConnectWS(ctx context.Context, account *wecommon.GWAccount) (*tenrpc.EncRPCClient, error)
- func (rpc *BackendRPC) PlainConnectWs(ctx context.Context) (*gethrpc.Client, error)
- func (rpc *BackendRPC) ReturnConn(conn tenrpc.Client) error
- func (rpc *BackendRPC) ReturnConnWS(conn tenrpc.Client) error
- func (rpc *BackendRPC) Stop()
- type NewHeadNotifier
- type SKManager
- type Services
- func (w *Services) AddAddressToUser(userID []byte, address string, signature []byte, ...) error
- func (w *Services) GenerateAndStoreNewUser() ([]byte, error)
- func (w *Services) GenerateUserMessageToSign(encryptionToken []byte, formatsSlice []string) (string, error)
- func (w *Services) GetTenNetworkConfig() (tencommon.TenNetworkInfo, error)
- func (w *Services) GetTenNodeHealthStatus() (bool, error)
- func (w *Services) IsStopping() bool
- func (w *Services) Logger() gethlog.Logger
- func (w *Services) Stop()
- func (w *Services) UserExists(userID []byte) bool
- func (w *Services) UserHasAccount(userID []byte, address string) (bool, error)
- func (w *Services) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithEncRPCConnection ¶
func WithEncRPCConnection[R any](ctx context.Context, rpc *BackendRPC, acct *wecommon.GWAccount, execute func(*tenrpc.EncRPCClient) (*R, error)) (*R, error)
func WithPlainRPCConnection ¶
Types ¶
type BackendRPC ¶
type BackendRPC struct {
// contains filtered or unexported fields
}
func NewBackendRPC ¶
func NewBackendRPC(hostAddrHTTP string, hostAddrWS string, logger gethlog.Logger) *BackendRPC
func (*BackendRPC) ConnectHttp ¶
func (rpc *BackendRPC) ConnectHttp(ctx context.Context, account *wecommon.GWAccount) (*tenrpc.EncRPCClient, error)
func (*BackendRPC) ConnectWS ¶
func (rpc *BackendRPC) ConnectWS(ctx context.Context, account *wecommon.GWAccount) (*tenrpc.EncRPCClient, error)
func (*BackendRPC) PlainConnectWs ¶
func (*BackendRPC) ReturnConn ¶
func (rpc *BackendRPC) ReturnConn(conn tenrpc.Client) error
func (*BackendRPC) ReturnConnWS ¶
func (rpc *BackendRPC) ReturnConnWS(conn tenrpc.Client) error
func (*BackendRPC) Stop ¶
func (rpc *BackendRPC) Stop()
type NewHeadNotifier ¶
type NewHeadNotifier interface {
// contains filtered or unexported methods
}
type SKManager ¶ added in v1.0.0
type SKManager interface { CreateSessionKey(user *common.GWUser) (*common.GWSessionKey, error) ActivateSessionKey(user *common.GWUser) (bool, error) DeactivateSessionKey(user *common.GWUser) (bool, error) DeleteSessionKey(user *common.GWUser) (bool, error) SignTx(ctx context.Context, user *common.GWUser, input *types.Transaction) (*types.Transaction, error) }
SKManager - session keys are Private Keys managed by the Gateway At the moment, each user can have a single Session Key. Which is either active or inactive when the SK is active, then all transactions submitted by that user will be signed with the session key The SK is also considered an "Account" of that user when the SK is created, it signs over the VK of the user so that it can interact with a node the standard way From the POV of the Ten network - a session key is a normal account key
func NewSKManager ¶ added in v1.0.0
type Services ¶
type Services struct { HostAddrHTTP string // The HTTP address on which the TEN host can be reached HostAddrWS string // The WS address on which the TEN host can be reached Storage storage.UserStorage RPCResponsesCache cache.Cache BackendRPC *BackendRPC RateLimiter *ratelimiter.RateLimiter SKManager SKManager Config *common.Config NewHeadsService *subscriptioncommon.NewHeadsService MetricsTracker metrics.Metrics // contains filtered or unexported fields }
Services handles the various business logic for the api endpoints
func NewServices ¶
func NewServices(hostAddrHTTP string, hostAddrWS string, storage storage.UserStorage, stopControl *stopcontrol.StopControl, version string, logger gethlog.Logger, metricsTracker metrics.Metrics, config *common.Config) *Services
func (*Services) AddAddressToUser ¶
func (w *Services) AddAddressToUser(userID []byte, address string, signature []byte, signatureType viewingkey.SignatureType) error
AddAddressToUser checks if a message is in correct format and if signature is valid. If all checks pass we save address and signature against userID
func (*Services) GenerateAndStoreNewUser ¶
GenerateAndStoreNewUser generates new key-pair and userID, stores it in the database and returns hex encoded userID and error
func (*Services) GenerateUserMessageToSign ¶
func (*Services) GetTenNetworkConfig ¶
func (w *Services) GetTenNetworkConfig() (tencommon.TenNetworkInfo, error)
func (*Services) GetTenNodeHealthStatus ¶
func (*Services) IsStopping ¶
IsStopping returns whether the WE is stopping
func (*Services) UserExists ¶
func (*Services) UserHasAccount ¶
UserHasAccount checks if provided account exist in the database for given userID