Documentation ¶
Index ¶
- func GetHistoryForKey(ctx contractapi.TransactionContextInterface, key string) ([][]byte, error)
- func GetQueryResult(ctx contractapi.TransactionContextInterface, query string) ([][]byte, error)
- func PutState(ctx contractapi.TransactionContextInterface, key string, value interface{}, ...) error
- type PrivateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHistoryForKey ¶
func GetHistoryForKey( ctx contractapi.TransactionContextInterface, key string, ) ([][]byte, error)
GetHistoryForKey returns the history of a key It gets the encrypted history of a key and decrypts the history
using the secret key stored in the implicit private data colelction of the org
func GetQueryResult ¶ added in v1.1.0
func GetQueryResult( ctx contractapi.TransactionContextInterface, query string, ) ([][]byte, error)
GetQueryResult makes the query in private data collection and retieves the results from the encrypted data stored on public ledger Before returning it decryts the data. Secret key is stored in the implicit private data collection
func PutState ¶
func PutState( ctx contractapi.TransactionContextInterface, key string, value interface{}, pvtData *PrivateData, ) error
PutState saves the data secretly on the ledger. How it works: 1. Encrypts the data using the secret key passed via PrivateData struct 2. Stores the key and encrypted data on public ledger 3. Stores the private data (contains secret key) to the implicit private data collection of participating orgs
Types ¶
type PrivateData ¶ added in v1.1.0
type PrivateData struct { // Secret is used to encrypt the data stored on ledger Secret string // Tags are used for clouch db rich queries Tags interface{} // Endorsing Orgs, private data will be shared between the endorsing orgs MSPOrgs []string }
func GetState ¶
func GetState( ctx contractapi.TransactionContextInterface, key string, ) ([]byte, *PrivateData, error)
GetState returns
- Private data stored in the implicit data collection
- Public data which is decypted using the secret key. This secret key is available in the implicit private data collection of the org