mailbox

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNetworkNotSupportedError

func IsNetworkNotSupportedError(err error) bool

IsNetworkNotSupportedError network not supported errors can be resolved by selecting a different client or configuring the network.

func ReadMessage

func ReadMessage(txData []byte, decrypter cipher.Decrypter) (*mail.Message, error)

ReadMessage gets the messages, decrypts and checks to see if it's valid - Check transaction data - Decrypt location - Get message - Decrypt message - Check hash

func SendMessage

func SendMessage(ctx context.Context, msg *mail.Message, recipientKey keys.PublicKey,
	sender Sender, sent stores.Sent, signer Signer) error

SendMessage performs all the actions required to send a message. - Create a hash of encoded message - Encrypt message - Store sent message - Encrypt message location - Create transaction data with encrypted location and message hash - Send transaction

Types

type PubKeyFinder

type PubKeyFinder interface {
	PublicKeyFromAddress(ctx context.Context, network string, address []byte) ([]byte, error)
}

PubKeyFinder find public key to encrypt message with

type Receiver

type Receiver interface {
	Receive(ctx context.Context, network string, address []byte) ([]cipher.EncryptedContent, error)
}

Receiver gets encrypted data from blockchain.

type Sender

type Sender interface {
	Send(ctx context.Context, to []byte, from []byte, data []byte, signer Signer, opts SenderOpts) (err error)
}

Sender signs a transaction the sends it

type SenderOpts

type SenderOpts interface{}

SenderOpts options for sending a message

type Signer

type Signer interface {
	Sign(opts SignerOpts) (signedTransaction interface{}, err error)
}

Signer return a signed transaction

type SignerOpts

type SignerOpts interface{}

SignerOpts options related to different signers

Jump to

Keyboard shortcuts

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