service

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Approve = "APPROVE"
	Reject  = "REJECT"
	Wait    = "WAIT"
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(pri *ecdsa.PrivateKey, cipherText string) (string, error)

Decrypt decrypts an ECIES ciphertext.

func PEM2PrivateKey

func PEM2PrivateKey(pemData []byte) (*ecdsa.PrivateKey, error)

func Sign

func Sign(private *ecdsa.PrivateKey, message string) (string, error)

func Verify

func Verify(public *ecdsa.PublicKey, message, signature string) bool

Types

type CallbackService

type CallbackService struct {
	PrivateKey       *ecdsa.PrivateKey
	PublicKey        *ecdsa.PublicKey
	DecryptSigKey    *ecdsa.PrivateKey
	MPCNodePublicKey *ecdsa.PublicKey
	RandomReject     bool
	// contains filtered or unexported fields
}

func NewCallBackService

func NewCallBackService(cfg *CallbackServiceConfig) (*CallbackService, error)

func (*CallbackService) Check

func (c *CallbackService) Check(g *gin.Context)

func (*CallbackService) RawDataSignature

func (c *CallbackService) RawDataSignature(g *gin.Context)

func (*CallbackService) Start

func (c *CallbackService) Start() error

func (*CallbackService) Stop

func (c *CallbackService) Stop() error

type CallbackServiceConfig

type CallbackServiceConfig struct {
	Address              string
	PrivateKeyPath       string
	DecryptSigKeyPath    string
	MPCNodePublicKeyPath string
	RandomReject         bool
}

type Check

type Check struct {
	CallbackId    string `json:"callback_id,omitempty"` // 由mpc-node生成,每次请求callback server时生成一个新的
	RequestType   string `json:"request_type,omitempty"`
	RequestDetail `json:"request_detail,omitempty"`
	ExtraInfo     `json:"extra_info,omitempty"`
}

type ExtraInfo

type ExtraInfo struct {
	SinoId    string `json:"sino_id,omitempty"`
	RequestId string `json:"request_id,omitempty"`
}

type RequestDetail

type RequestDetail struct {
	T            int      `json:"t,omitempty"`
	N            int      `json:"n,omitempty"`
	Cryptography string   `json:"cryptography,omitempty"`
	PartyIds     []string `json:"party_ids,omitempty"`

	SignType  string          `json:"sign_type,omitempty" form:"sign_type"`
	PublicKey string          `json:"public_key,omitempty"`
	Path      string          `json:"path,omitempty"`
	Message   string          `json:"message,omitempty"`
	Signature string          `json:"signature,omitempty"`
	TxInfo    json.RawMessage `json:"tx_info,omitempty" form:"tx_info"`
}

type Response

type Response struct {
	Status    string        `json:"status,omitempty"`
	Error     string        `json:"error,omitempty"`
	Data      *ResponseData `json:"data,omitempty"`
	Signature string        `json:"signature,omitempty"`
}

type ResponseData

type ResponseData struct {
	CallbackId string `json:"callback_id,omitempty"`
	SinoId     string `json:"sino_id,omitempty"`
	RequestId  string `json:"request_id,omitempty"`
	Action     string `json:"action,omitempty"`
	WaitTime   string `json:"wait_time,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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