jsonutils

package
Version: v0.0.0-...-40a32e1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeResponse

func EncodeResponse(code string, status string, data interface{}, w http.ResponseWriter, fail2banData *utils.Fail2BanData) error

func ParseForm

func ParseForm(body string, form HTTPForm) error

func ReadAll

func ReadAll(r io.ReadCloser) (string, error)

func VerifyAndDecrypt

func VerifyAndDecrypt(request *Request, recipientPrivateKeyPem string, cryptoStorage *cryptoutils.CryptoStorage) (string, string, error)

Types

type HTTPForm

type HTTPForm interface {
	InputValidation() error
}

type Request

type Request struct {
	Response      string `json:"response"`
	Signature     string `json:"signature"`
	NonceResponse string `json:"nonceResponse"`
	ID            string `json:"id"`
	IDSignature   string `json:"idSignature"`
	NonceID       string `json:"nonceID"`
	Key           string `json:"key"`
	PublicKey     string `json:"publicKey"`
}

func ParseRequest

func ParseRequest(r *http.Request) (*Request, error)

func SignAndEncryptResponse

func SignAndEncryptResponse(data interface{}, id string,
	senderPrivateKeyPem string, senderPublicKeyPem string,
	recipientPublicKeyPem string, putSenderPublicKey bool) (*Request, error)

func (*Request) InputValidation

func (e *Request) InputValidation() error

type Response

type Response struct {
	Status string      `json:"status"`
	Code   string      `json:"code"`
	Data   interface{} `json:"data"`
}

func ParseResponse

func ParseResponse(resp *http.Response) (*Response, error)

func (*Response) InputValidation

func (e *Response) InputValidation() error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL