morrpcmesssage

package
v0.0.0-...-25c9f67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MORRPCMessage

type MORRPCMessage struct{}

func NewMorRpc

func NewMorRpc() *MORRPCMessage

func (*MORRPCMessage) AuthError

func (m *MORRPCMessage) AuthError(privateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) InitiateSessionRequest

func (m *MORRPCMessage) InitiateSessionRequest(user common.Address, provider common.Address, spend *big.Int, bidID common.Hash, userPrivateKeyHex lib.HexString, requestId string) (*RPCMessage, error)

func (*MORRPCMessage) InitiateSessionResponse

func (m *MORRPCMessage) InitiateSessionResponse(providerPubKey lib.HexString, userAddr common.Address, bidID common.Hash, providerPrivateKeyHex lib.HexString, requestID string) (*RpcResponse, error)

func (*MORRPCMessage) OutOfCapacityError

func (m *MORRPCMessage) OutOfCapacityError(privateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) ResponseError

func (m *MORRPCMessage) ResponseError(message string, privateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) SessionCloseRequest

func (m *MORRPCMessage) SessionCloseRequest(sessionID common.Hash, userPrivateKeyHex lib.HexString, requestId string) (*RPCMessage, error)

func (*MORRPCMessage) SessionClosedError

func (m *MORRPCMessage) SessionClosedError(privateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) SessionPromptRequest

func (m *MORRPCMessage) SessionPromptRequest(sessionID common.Hash, prompt interface{}, providerPubKey lib.HexString, userPrivateKeyHex lib.HexString, requestId string) (*RPCMessage, error)

func (*MORRPCMessage) SessionPromptResponse

func (m *MORRPCMessage) SessionPromptResponse(message string, providerPrivateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) SessionReport

func (m *MORRPCMessage) SessionReport(sessionID string, start uint, end uint, prompts uint, tokens uint, reqs []ReqObject, providerPrivateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) SpendLimitError

func (m *MORRPCMessage) SpendLimitError(privateKeyHex lib.HexString, requestId string) (*RpcResponse, error)

func (*MORRPCMessage) VerifySignature

func (m *MORRPCMessage) VerifySignature(params any, signature lib.HexString, publicKey lib.HexString, sourceLog lib.ILogger) bool

type RPCErrorData

type RPCErrorData struct {
	Timestamp uint64         `json:"timestamp" validate:"required,number"`
	Signature *lib.HexString `json:"signature" validate:"required,hexadecimal"`
}

type RPCMessage

type RPCMessage struct {
	ID     string          `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

type ReportRes

type ReportRes struct {
	Signature lib.HexString  `json:"signature,omitempty" validate:"required,hexadecimal"`
	Message   *SessionReport `json:"message"             validate:"required"`
	Timestamp uint64         `json:"timestamp"           validate:"required,number"`
}

type ReqObject

type ReqObject struct {
	Req  uint `json:"req"`
	Res  uint `json:"res"`
	Toks uint `json:"toks"`
}

ReqObject represents a request object within a session report

type RpcError

type RpcError struct {
	Message string       `json:"message"`
	Code    int          `json:"code"`
	Data    RPCErrorData `json:"data"`
}

type RpcResponse

type RpcResponse struct {
	ID     string           `json:"id"`
	Result *json.RawMessage `json:"result"`
	Error  *RpcError        `json:"error,omitempty"`
}

type SessionCloseReq

type SessionCloseReq struct {
	Signature lib.HexString `json:"signature,omitempty" validate:"required,hexadecimal"`
	SessionID common.Hash   `json:"sessionid"           validate:"required,hexadecimal"`
	Timestamp uint64        `json:"timestamp"           validate:"required,number"`
}

type SessionPromptReq

type SessionPromptReq struct {
	Signature lib.HexString `json:"signature,omitempty" validate:"required,hexadecimal"`
	SessionID common.Hash   `json:"sessionid" validate:"required,hex32"`
	Message   string        `json:"message"   validate:"required"`
	Timestamp uint64        `json:"timestamp" validate:"required,number"`
}

type SessionPromptRes

type SessionPromptRes struct {
	Message   string        `json:"message"             validate:"required"`
	Signature lib.HexString `json:"signature,omitempty" validate:"required,hexadecimal"`
	Timestamp uint64        `json:"timestamp"           validate:"required,number"`
}

type SessionReport

type SessionReport struct {
	SessionID string      `json:"sessionid"`
	Start     uint        `json:"start"`
	End       uint        `json:"end"`
	Prompts   uint        `json:"prompts"`
	Tokens    uint        `json:"tokens"`
	Reqs      []ReqObject `json:"reqs"`
}

SessionReport represents the detailed session report

type SessionReq

type SessionReq struct {
	Signature lib.HexString  `json:"signature,omitempty" validate:"required,hexadecimal"`
	User      common.Address `json:"user"      validate:"required,eth_addr"`
	Key       lib.HexString  `json:"key"       validate:"required,hexadecimal"`
	Spend     lib.BigInt     `json:"spend"     validate:"required"`
	Timestamp uint64         `json:"timestamp" validate:"required,number"`
	BidID     common.Hash    `json:"bidid"     validate:"required,hex32"`
}

type SessionRes

type SessionRes struct {
	PubKey      lib.HexString  `json:"message" validate:"required,hexadecimal"`
	Approval    lib.HexString  `json:"approval" validate:"required,hexadecimal"`
	ApprovalSig lib.HexString  `json:"approvalSig" validate:"required,hexadecimal"`
	User        common.Address `json:"user" validate:"required,eth_addr"`
	Timestamp   uint64         `json:"timestamp" validate:"required,timestamp"`
	Signature   lib.HexString  `json:"signature,omitempty" validate:"required,hexadecimal"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL