private

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIpfsUrl = "3.0.198.89:5001"
	Dummy          = "dummy"
	IPFS           = "ipfs"
	Swarm          = "swarm"
)

Variables

View Source
var (
	// Indicate whether support private transaction functionality
	SupportPrivateTx string
)

Functions

func RetrieveAndDecryptPayload

func RetrieveAndDecryptPayload(data []byte, txNonce uint64, remoteDB database.RemoteDatabase, decryptor accounts.AccountRsaDecryptor) (payload []byte, hasPermission bool, error error)

Read tx's payload replacement, retrieve encrypted payload from IPFS and decrypt it. Return decrypted payload, a flag indicating if the node has enough permission and error if there is.

Types

type Config

type Config struct {
	RemoteDBParams string
	RemoteDBType   string
}

func DefaultConfig

func DefaultConfig() Config

type PayloadReplacement

type PayloadReplacement struct {
	// Participants represents a list of public keys which belongs to defined participants. They are used for encryption of symmetric key.
	Participants []string
	// TxPayload represents the real tx payload which could be an IPFS address or ID of other kind of remote db
	TxPayload []byte
}

PayloadReplacement represents the replacement data which substitute the private tx payload.

func SealPrivatePayload

func SealPrivatePayload(payload []byte, txNonce uint64, participants []string, remoteDB database.RemoteDatabase) (PayloadReplacement, error)

SealPrivatePayload encrypts private tx's payload and sends it to IPFS, then replaces the payload with the address in IPFS. Returns an address which could be used to retrieve original payload from IPFS.

type SealedPrivatePayload

type SealedPrivatePayload struct {
	// Payload represents the encrypted payload with a random symmetric key.
	Payload []byte
	// For public keys, the order is consistent in SymmetricKeys and Participants.
	// SymmetricKeys represents the symmetric key encrypted with participants' public keys. The same symmetric key but encrypted with different RSA public key.
	SymmetricKeys [][]byte
	// Participants represents the public keys of participants.
	Participants [][]byte
}

SealedPrivatePayload represents a sealed payload entity in IPFS.

func NewSealedPrivatePayload

func NewSealedPrivatePayload(encryptedPayload []byte, symmetricKey [][]byte, participants []*ecdsa.PublicKey) SealedPrivatePayload

NewSealedPrivatePayload creates new SealedPrivatePayload instance with given parameters.

Jump to

Keyboard shortcuts

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