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 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 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 Config *common.Config NewHeadsService *subscriptioncommon.NewHeadsService // 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, 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
Click to show internal directories.
Click to hide internal directories.