enclave

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package enclave provides enclaves for the secure storage and propagation of transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoKeyGeneration

func DoKeyGeneration(keyFile string) error

DoKeyGeneration is used to generate new public and private key-pairs, writing them to the provided file locations. Public keys have the "pub" suffix, whereas private keys have the "key" suffix.

Types

type SecureEnclave

type SecureEnclave struct {
	Db       storage.DataStore // The underlying key-value datastore for encrypted transactions
	PubKeys  []nacl.Key        // Public keys associated with this enclave
	PrivKeys []nacl.Key        // Private keys associated with this enclave

	PartyInfo api.PartyInfo // Details of all other nodes (or parties) on the network
	// contains filtered or unexported fields
}

SecureEnclave is the secure transaction enclave.

func Init

func Init(
	db storage.DataStore,
	pubKeyFiles, privKeyFiles []string,
	pi api.PartyInfo,
	client utils.HttpClient, grpc bool) *SecureEnclave

Init creates a new instance of the SecureEnclave.

func (*SecureEnclave) Delete

func (s *SecureEnclave) Delete(digestHash *[]byte) error

Delete deletes the payload associated with the given digestHash from the SecureEnclave's store.

func (*SecureEnclave) GetEncodedPartyInfo

func (s *SecureEnclave) GetEncodedPartyInfo() []byte

GetEncodedPartyInfo provides this SecureEnclaves PartyInfo details in a binary encoded format.

func (*SecureEnclave) GetEncodedPartyInfoGrpc

func (s *SecureEnclave) GetEncodedPartyInfoGrpc() []byte

func (*SecureEnclave) GetPartyInfo

func (s *SecureEnclave) GetPartyInfo() (string, map[[nacl.KeySize]byte]string, map[string]bool)

func (*SecureEnclave) Retrieve

func (s *SecureEnclave) Retrieve(digestHash *[]byte, to *[]byte) ([]byte, error)

Retrieve is used to retrieve the provided payload. If the payload cannot be found, or decrypted successfully an error is returned.

func (*SecureEnclave) RetrieveAllFor

func (s *SecureEnclave) RetrieveAllFor(reqRecipient *[]byte) error

RetrieveAllFor retrieves all payloads that the specified recipient was an original recipient for. Each payload found is published to the specified recipient.

func (*SecureEnclave) RetrieveDefault

func (s *SecureEnclave) RetrieveDefault(digestHash *[]byte) ([]byte, error)

RetrieveDefault is used to retrieve the provided payload. It attempts to use a default key value of the first public key associated with this SecureEnclave instance. If the payload cannot be found, or decrypted successfully an error is returned.

func (*SecureEnclave) RetrieveFor

func (s *SecureEnclave) RetrieveFor(digestHash *[]byte, reqRecipient *[]byte) (*[]byte, error)

RetrieveFor retrieves a payload with the given digestHash for a specific recipient who was one of the original recipients specified on the payload.

func (*SecureEnclave) Store

func (s *SecureEnclave) Store(
	message *[]byte, sender []byte, recipients [][]byte) ([]byte, error)

Store a payload submitted via an Ethereum node. This function encrypts the payload, and distributes the encrypted payload to the other specified recipients in the network. The hash of the encrypted payload is returned to the sender.

func (*SecureEnclave) StorePayload

func (s *SecureEnclave) StorePayload(encoded []byte) ([]byte, error)

Store a binary encoded payload within this SecureEnclave. This will be a payload that has been propagated to this node as it is a party on the transaction. I.e. it is not the original recipient of the transaction, but one of the recipients it is intended for.

func (*SecureEnclave) StorePayloadGrpc

func (s *SecureEnclave) StorePayloadGrpc(epl api.EncryptedPayload, encoded []byte) ([]byte, error)

func (*SecureEnclave) UpdatePartyInfo

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

UpdatePartyInfo applies the provided binary encoded party details to the SecureEnclave's own party details store.

func (*SecureEnclave) UpdatePartyInfoGrpc

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

Jump to

Keyboard shortcuts

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