api

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API added in v1.0.2

func API(w http.ResponseWriter, r *http.Request)

API Request path "/api", response json rest api spec.

func ConfigPeersGet

func ConfigPeersGet(w http.ResponseWriter, r *http.Request)

ConfigPeersGet Receive a GET request with index on path and return Status Code 200 and Peer json containing url, Status Code 404 if not found.

func ConfigPeersPut

func ConfigPeersPut(w http.ResponseWriter, r *http.Request)

ConfigPeersPut It receives a PUT request with a json containing a Peer url and returns Status Code 200.

func Delete

func Delete(w http.ResponseWriter, r *http.Request)

Delete Deprecated API It receives a POST request with a json containing a DeleteRequest with key and returns Status 200 if succeed, 404 otherwise.

func GetPartyInfo

func GetPartyInfo(w http.ResponseWriter, r *http.Request)

GetPartyInfo It receives a POST request with a json containing url and key, returns local publicKeys and a proof that private key is known.

func GetVersion

func GetVersion(w http.ResponseWriter, r *http.Request)

GetVersion Request path "/version", response plain text version ID

func Metrics

func Metrics(w http.ResponseWriter, r *http.Request)

Metrics Receive a GET request and return Status Code 200 and server internal status information in plain text.

func Push

func Push(w http.ResponseWriter, r *http.Request)

Push It receives a POST request with a payload and returns Status Code 201 with a payload generated hash, on error returns Status Code 500.

func PushTransactionForOtherNodes

func PushTransactionForOtherNodes(encryptedTransaction data.EncryptedTransaction, recipient []byte)

PushTransactionForOtherNodes will push encrypted transaction to other nodes

func Receive

func Receive(w http.ResponseWriter, r *http.Request)

Receive is a Deprecated API It receives a ReceiveRequest json with an encoded key (hash) and to values, returns decrypted payload

func ReceiveRaw

func ReceiveRaw(w http.ResponseWriter, r *http.Request)

ReceiveRaw Receive a GET request with header params bb0x-key and bb0x-to, return unencrypted payload

func Resend

func Resend(w http.ResponseWriter, r *http.Request)

Resend It receives a POST request with a json ResendRequest containing type (INDIVIDUAL, ALL), publicKey and key(for individual requests), it returns encoded payload for INDIVIDUAL or it does one push request for each payload and returns empty for type ALL.

func RetrieveAndDecryptPayload

func RetrieveAndDecryptPayload(w http.ResponseWriter, r *http.Request, key []byte, to []byte) []byte

RetrieveAndDecryptPayload will retrieve and decrypt the payload

func RetrieveJSONPayload added in v1.0.2

func RetrieveJSONPayload(w http.ResponseWriter, r *http.Request, key []byte, to []byte)

RetrieveJSONPayload will retrieve payload based on request

func Send

func Send(w http.ResponseWriter, r *http.Request)

Send It receives json SendRequest with from, to and payload, returns Status Code 200 and json KeyJSON with encoded key.

func SendRaw

func SendRaw(w http.ResponseWriter, r *http.Request)

SendRaw It receives headers "bb0x-from" and "bb0x-to", payload body and returns Status Code 200 and encoded key plain text.

func SendSignedTx added in v1.0.2

func SendSignedTx(w http.ResponseWriter, r *http.Request)

SendSignedTx It receives header "bb0x-to" and raw transaction hash body and returns Status Code 200 and transaction hash.

func SetLogger

func SetLogger(loggers *logrus.Entry)

SetLogger set the logger

func StoreRaw added in v1.0.2

func StoreRaw(w http.ResponseWriter, r *http.Request)

StoreRaw It receives a POST request with a payload and returns Status Code 201 with a payload generated hash, on error returns Status Code 500.

func TransactionDelete

func TransactionDelete(w http.ResponseWriter, r *http.Request)

TransactionDelete It receives a DELETE request with a key on path string and returns 204 if succeed, 404 otherwise.

func TransactionGet

func TransactionGet(w http.ResponseWriter, r *http.Request)

TransactionGet it receives a GET request with a hash on path and query var "to" with encoded hash and to, returns decrypted payload

func UnknownRequest

func UnknownRequest(w http.ResponseWriter, r *http.Request)

UnknownRequest will debug unknown reqs

func Upcheck

func Upcheck(w http.ResponseWriter, r *http.Request)

Upcheck Request path "/upcheck", response plain text upcheck message.

Types

type KeyJSON added in v1.0.2

type KeyJSON struct {
	// Key is the key that can be used to retrieve the submitted transaction.
	Key string `json:"key"`
}

KeyJSON marshal/unmarshal a key

type PeerURL added in v1.0.2

type PeerURL struct {
	URL string `json:"url"`
}

PeerURL will marshal/unmarshal url

type ReceiveRequest

type ReceiveRequest struct {
	Key string `json:"key"`
	To  string `json:"to"`
}

ReceiveRequest marshal/unmarshal key and to

func (*ReceiveRequest) Parse

func (e *ReceiveRequest) Parse() ([]byte, []byte, []string)

Parse will process receiving parsing

type ReceiveResponse

type ReceiveResponse struct {
	Payload string `json:"payload"`
}

ReceiveResponse will marshal/unmarshal payload

type ResendRequest

type ResendRequest struct {
	// Type is the resend request type. It should be either "all" or "individual" depending on if
	// you want to request an individual transaction, or all transactions associated with a node.
	Type      string `json:"type"`
	PublicKey string `json:"publicKey"`
	Key       string `json:"key,omitempty"`
}

ResendRequest will marshal/unmarshal type, pub and pk

type SendRequest

type SendRequest struct {
	// Payload is the transaction payload data we wish to store.
	Payload string `json:"payload"`
	// From is the sender node identification.
	From string `json:"from"`
	// To is a list of the recipient nodes that should be privy to this transaction payload.
	To []string `json:"to"`
}

SendRequest will marshal/unmarshal payload from and to

func (*SendRequest) Parse

func (e *SendRequest) Parse() ([]byte, []byte, [][]byte, []string)

Parse will process send parsing

type StoreRawRequest added in v1.0.2

type StoreRawRequest struct {
	Payload string `json:"payload"`
	From    string `json:"from,omitempty"`
}

StoreRawRequest will marshal/unmarshal payload and from

Jump to

Keyboard shortcuts

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