api

package
v0.0.0-...-76cb802 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePartyInfo

func EncodePartyInfo(pi PartyInfo) []byte

func EncodePayload

func EncodePayload(ep EncryptedPayload) []byte

func EncodePayloadWithRecipients

func EncodePayloadWithRecipients(ep EncryptedPayload, recipients [][]byte) []byte

func Push

func Push(encoded []byte, url string, client utils.HttpClient) (string, error)

Push is responsible for propagating the encoded payload to the given remote node.

func PushGrpc

func PushGrpc(encoded []byte, path string, epl EncryptedPayload) error

Types

type DeleteRequest

type DeleteRequest struct {
	Key string `json:"key"`
}

DeleteRequest deletes the entry matching the given key from the enclave.

type EncryptedPayload

type EncryptedPayload struct {
	Sender         nacl.Key
	CipherText     []byte
	Nonce          nacl.Nonce
	RecipientBoxes [][]byte
	RecipientNonce nacl.Nonce
}

EncryptedPayload is the struct used for storing all data associated with an encrypted transaction.

func DecodePayload

func DecodePayload(encoded []byte) EncryptedPayload

func DecodePayloadWithRecipients

func DecodePayloadWithRecipients(encoded []byte) (EncryptedPayload, [][]byte)

type PartyInfo

type PartyInfo struct {
	// contains filtered or unexported fields
}

PartyInfo is a struct that stores details of all enclave nodes (or parties) on the network.

func DecodePartyInfo

func DecodePartyInfo(encoded []byte) (PartyInfo, error)

func InitPartyInfo

func InitPartyInfo(rawUrl string, otherNodes []string, client utils.HttpClient, grpc bool) PartyInfo

InitPartyInfo initializes a new PartyInfo store.

func (*PartyInfo) GetAllValues

func (s *PartyInfo) GetAllValues() (string, map[[nacl.KeySize]byte]string, map[string]bool)

func (*PartyInfo) GetPartyInfo

func (s *PartyInfo) GetPartyInfo()

GetPartyInfo requests PartyInfo data from all remote nodes this node is aware of. The data provided in each response is applied to this node.

func (*PartyInfo) GetPartyInfoGrpc

func (s *PartyInfo) GetPartyInfoGrpc()

func (*PartyInfo) GetRecipient

func (s *PartyInfo) GetRecipient(key nacl.Key) (string, bool)

GetRecipient retrieves the URL associated with the provided recipient.

func (*PartyInfo) PollPartyInfo

func (s *PartyInfo) PollPartyInfo(pi *PartyInfo)

func (*PartyInfo) RegisterPublicKeys

func (s *PartyInfo) RegisterPublicKeys(pubKeys []nacl.Key)

RegisterPublicKeys associates the provided public keys with this node.

func (*PartyInfo) UpdatePartyInfo

func (s *PartyInfo) UpdatePartyInfo(encoded []byte)

UpdatePartyInfo updates the PartyInfo datastore with the provided encoded data. This can happen from the /partyinfo server endpoint being hit, or by a response from us hitting another nodes /partyinfo endpoint. TODO: Control access via a channel for updates.

func (*PartyInfo) UpdatePartyInfoGrpc

func (s *PartyInfo) UpdatePartyInfoGrpc(url string, recipients map[[nacl.KeySize]byte]string, parties map[string]bool)

type PartyInfoResponse

type PartyInfoResponse struct {
	Payload []byte `json:"payload"`
}

type PrivateKey

type PrivateKey struct {
	Data PrivateKeyBytes `json:"data"`
	Type string          `json:"type"`
}

PrivateKey is a container for a private key.

type PrivateKeyBytes

type PrivateKeyBytes struct {
	Bytes string `json:"bytes"`
}

type ReceiveRequest

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

ReceiveRequest .

type ReceiveResponse

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

ReceiveResponse returns the raw payload associated with the ReceiveRequest.

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 is used to resend previous transactions. There are two types of supported request. 1. All transactions associated with a node, in which case the Key field should be omitted. 2. A specific transaction with the given key value.

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 sends a new transaction to the enclave for storage and propagation to the provided recipients.

type SendResponse

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

SendResponse is the response to the SendRequest

type SendSignedRequest

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

type StoreRequest

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

StoreRequest is response from the server for the SendRequest

type UpdatePartyInfo

type UpdatePartyInfo struct {
	Url        string            `json:"url"`
	Recipients map[string][]byte `json:"recipients"`
	Parties    map[string]bool   `json:"parties"`
}

Jump to

Keyboard shortcuts

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