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 ¶
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.
Click to show internal directories.
Click to hide internal directories.