private

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

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
	// TxPayloadUri represents an IPFS address which actually a hash of content.
	TxPayloadUri []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 []*rsa.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