protocol

package
v0.0.0-...-798c9db Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sucess int = iota
	SignatureNotCorrect
	InterIOErr
	UnmarshalJsonErr
	ActionErr
	MethodNotCorrect
	UserNotAuthorized
)
View Source
const (
	VerifySignature int = iota
)

Variables

View Source
var ErrDesc map[int]string = map[int]string{
	Sucess:              "success",
	MethodNotCorrect:    "method not correct",
	InterIOErr:          "server read error",
	UnmarshalJsonErr:    "unmarshal json object error",
	ActionErr:           "action not correct",
	SignatureNotCorrect: "signature not correct",
}

Functions

This section is empty.

Types

type Request

type Request struct {
	Action  int         `json:"action"`
	PayLoad interface{} `json:"payload"`
}

type Response

type Response struct {
	Success bool        `json:"success"`
	ErrMsg  string      `json:"msg"`
	ErrCode int         `json:"err_code"`
	PayLoad interface{} `json:"payload"`
}

func ResponseError

func ResponseError(errMsg string, errCode int) *Response

func ResponseSuccess

func ResponseSuccess(v interface{}) *Response

func SimpleSuccessResponse

func SimpleSuccessResponse() *Response

func (*Response) Bytes

func (r *Response) Bytes() []byte

func (*Response) String

func (r *Response) String() string

type VerfiyPlainMsg

type VerfiyPlainMsg struct {
	DID       string  `json:"did"` ///public key in string
	TimeStamp int64   `json:"time_stamp"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type VerifyReq

type VerifyReq struct {
	Signature string `json:"sig"` ///hex string
	VerfiyPlainMsg
}

type VerifyResp

type VerifyResp struct {
	Signature *VerifyReq `json:"signature"`
}

Jump to

Keyboard shortcuts

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