facts

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: GPL-3.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExchangeIsExpiredOrWillBeExpiredVerySoon returned when exchange state is expired or will be expired very soon
	ErrExchangeIsExpiredOrWillBeExpiredVerySoon = errors.New("exchange is expired or will be expired very soon")
	// ErrExchangeHasNotExpired returned when exchange has not expired
	ErrExchangeHasNotExpired = errors.New("exchange has not expired")
	// ErrExchangeMustBeProposed returned when private data exchange is not in Proposed state
	ErrExchangeMustBeProposed = errors.New("private data exchange must be in Proposed state")
	// ErrExchangeMustBeClosedOrAccepted returned when private data exchange is not in Closed or Accepted state
	ErrExchangeMustBeClosedOrAccepted = errors.New("private data exchange must be in Closed or Accepted state")
	// ErrInvalidExchangeKey returned when hash of exchange key does not match exchange key hash stored in private data exchange
	ErrInvalidExchangeKey = errors.New("invalid exchange key")
	// ErrOnlyDataRequesterAllowedToCall returned when called by non-requester account
	ErrOnlyDataRequesterAllowedToCall = errors.New("only the data requester allowed to call")
)
View Source
var (
	// ErrExchangeMustBeAccepted returned when private data exchange is not in Accepted state
	ErrExchangeMustBeAccepted = errors.New("private data exchange must be in Accepted state")
	// ErrOnlyExchangeParticipantsAreAllowedToCall returned when called not by data requester or passport owner
	ErrOnlyExchangeParticipantsAreAllowedToCall = errors.New("only data requester or passport owner are allowed to call")
)
View Source
var (
	// ErrInvalidPassportOwnerKey returned when passport owner key is invalid
	ErrInvalidPassportOwnerKey = errors.New("facts: passport owner key is invalid")
	// ErrInvalidSecretKey returned when data decryption secret key is invalid
	ErrInvalidSecretKey = errors.New("facts: secret key to decrypt data is invalid")
)
View Source
var (
	// ErrIsNotAllowedFactProvider error returned when fact provider is not allowed to modify (write or delete) passport facts.
	ErrIsNotAllowedFactProvider = errors.New("facts: not allowed fact provider")
	// ErrOutOfUint256Range error returned when value is out of uint256 range [0; 2^256-1]
	ErrOutOfUint256Range = errors.New("facts: out of uint256 range")
	// ErrOutOfInt256Range error returned when value is out of int256 range [-2^255; 2^255-1]
	ErrOutOfInt256Range = errors.New("facts: out of int256 range")
)
View Source
var (
	// ErrDecryptedSecretKeyIsInvalid returned when secret key hash does not match secret key hash stored in private data exchange
	ErrDecryptedSecretKeyIsInvalid = errors.New("decrypted data secret key is invalid, it's safe to dispute")
)
View Source
var (
	// ErrOwnerMustClaimOwnership error returned when the owner hasn't claimed ownership of a passport, but an attempt is
	// made to retrieve the public address of the owner
	ErrOwnerMustClaimOwnership = errors.New("facts: owner must claim ownership of the passport")
)

Functions

This section is empty.

Types

type Change

type Change struct {
	// ChangeType represents type of data change
	ChangeType change.Type
	// DataType represents type of data
	DataType data.Type
	// Address of fact provider
	FactProvider common.Address
	// Key of the value
	Key [32]byte
	// Blockchain specific contextual infos
	Raw types.Log
}

Change contains information about data change

type ChangeIterator

type ChangeIterator struct {
	Change *Change // Change containing the info of the last retrieved change
	// contains filtered or unexported fields
}

ChangeIterator is returned from FilterChanges and is used to iterate over the changes and unpacked data for Updated and Deleted events raised by the PassportLogic contract.

func (*ChangeIterator) Close

func (it *ChangeIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*ChangeIterator) Error

func (it *ChangeIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ChangeIterator) Next

func (it *ChangeIterator) Next() bool

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

func (*ChangeIterator) ToSlice

func (it *ChangeIterator) ToSlice() (ps []*Change, err error)

ToSlice retrieves all changes and saves them into slice.

type ChangesFilterOpts

type ChangesFilterOpts struct {
	Start        uint64           // Start of the queried range
	End          *uint64          // End of the range (nil = latest)
	ChangeType   []change.Type    // ChangeType is a slice of change types to filter (nil = all change types)
	DataType     []data.Type      // DataType is a slice of data types to filter (nil = all data types)
	FactProvider []common.Address // FactProvider is a slice of fact providers to filter (nil = all fact providers)
	Key          [][32]byte       // Key is a slice of keys to filter (nil = all keys)
	Context      context.Context  // Network context to support cancellation and timeouts (nil = no timeout)
}

ChangesFilterOpts is the collection of options to fine tune filtering for changes.

type Clock

type Clock interface {
	Now() time.Time
}

Clock interface is used to "mock" time.Now and time.After

type DisputePrivateDataExchangeResult

type DisputePrivateDataExchangeResult struct {
	Successful bool
	Cheater    common.Address
}

DisputePrivateDataExchangeResult holds result of calling DisputePrivateDataExchange

type DisputePrivateDataExchangeResultNoWait

type DisputePrivateDataExchangeResultNoWait struct {
	ExchangeIdx *big.Int
	TxHash      common.Hash
}

DisputePrivateDataExchangeResultNoWait holds result of calling DisputePrivateDataExchangeNoWait

type ExchangeAcceptor

type ExchangeAcceptor struct {
	// contains filtered or unexported fields
}

ExchangeAcceptor allows passport owner to accept private data exchange proposition

func NewExchangeAcceptor

func NewExchangeAcceptor(e *eth.Eth, passportOwnerKey *ecdsa.PrivateKey, fs *ipfs.IPFS, clock Clock) *ExchangeAcceptor

NewExchangeAcceptor create new instance of ExchangeAcceptor

func (*ExchangeAcceptor) AcceptPrivateDataExchange

func (a *ExchangeAcceptor) AcceptPrivateDataExchange(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) error

AcceptPrivateDataExchange accepts private data exchange proposition (should be called only by the passport owner)

func (*ExchangeAcceptor) AcceptPrivateDataExchangeNoWait

func (a *ExchangeAcceptor) AcceptPrivateDataExchangeNoWait(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) (common.Hash, error)

AcceptPrivateDataExchangeNoWait accepts private data exchange proposition (should be called only by the passport owner) This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type ExchangeDataReader

type ExchangeDataReader struct {
	// contains filtered or unexported fields
}

ExchangeDataReader allows to read and decrypt private data from private data exchange

func NewExchangeDataReader

func NewExchangeDataReader(e *eth.Eth, fs *ipfs.IPFS) *ExchangeDataReader

NewExchangeDataReader creates new instance of ExchangeDataReader

func (*ExchangeDataReader) ReadPrivateData

func (r *ExchangeDataReader) ReadPrivateData(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int, exchangeKey [32]byte) ([]byte, error)

ReadPrivateData decrypts data secret key from private data exchange, then it reads and decrypts private data.

type ExchangeDisputer

type ExchangeDisputer struct {
	// contains filtered or unexported fields
}

ExchangeDisputer allows to dispute data exchange

func NewExchangeDisputer

func NewExchangeDisputer(s *eth.Session, clock Clock) *ExchangeDisputer

NewExchangeDisputer converts session to ExchangeDisputer

func (*ExchangeDisputer) DisputePrivateDataExchange

func (f *ExchangeDisputer) DisputePrivateDataExchange(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int, exchangeKey [32]byte) (*DisputePrivateDataExchangeResult, error)

DisputePrivateDataExchange closes private data exchange after acceptance by dispute.

func (*ExchangeDisputer) DisputePrivateDataExchangeNoWait

func (f *ExchangeDisputer) DisputePrivateDataExchangeNoWait(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int, exchangeKey [32]byte) (*DisputePrivateDataExchangeResultNoWait, error)

DisputePrivateDataExchangeNoWait closes private data exchange after acceptance by dispute. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*ExchangeDisputer) GetDisputePrivateDataExchangeResult

func (f *ExchangeDisputer) GetDisputePrivateDataExchangeResult(ctx context.Context, noWaitResult *DisputePrivateDataExchangeResultNoWait) (*DisputePrivateDataExchangeResult, error)

GetDisputePrivateDataExchangeResult waits for transaction to be mined if it's not mined yet and retrieves the dispute result for the provided private data exchange from tx logs.

type ExchangeFinisher

type ExchangeFinisher struct {
	// contains filtered or unexported fields
}

ExchangeFinisher allows to finish data exchange

func NewExchangeFinisher

func NewExchangeFinisher(s *eth.Session, clock Clock) *ExchangeFinisher

NewExchangeFinisher converts session to ExchangeFinisher

func (*ExchangeFinisher) FinishPrivateDataExchange

func (f *ExchangeFinisher) FinishPrivateDataExchange(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) error

FinishPrivateDataExchange closes private data exchange after acceptance. It's supposed to be called by the data requester, but passport owner also can call it after data exchange is expired.

func (*ExchangeFinisher) FinishPrivateDataExchangeNoWait

func (f *ExchangeFinisher) FinishPrivateDataExchangeNoWait(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) (common.Hash, error)

FinishPrivateDataExchangeNoWait closes private data exchange after acceptance. It's supposed to be called by the data requester, but passport owner also can call it after data exchange is expired. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type ExchangeProposer

type ExchangeProposer eth.Session

ExchangeProposer allows to propose data exchange

func NewExchangeProposer

func NewExchangeProposer(s *eth.Session) *ExchangeProposer

NewExchangeProposer converts session to ExchangeProposer

func (*ExchangeProposer) GetProposePrivateDataExchangeResult

func (e *ExchangeProposer) GetProposePrivateDataExchangeResult(ctx context.Context, noWaitResult *ProposePrivateDataExchangeResultNoWait) (*ProposePrivateDataExchangeResult, error)

GetProposePrivateDataExchangeResult waits for transaction to be mined if it's not mined yet and retrieves proposed private data exchange result.

func (*ExchangeProposer) ProposePrivateDataExchange

func (e *ExchangeProposer) ProposePrivateDataExchange(
	ctx context.Context,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
	exchangeStakeWei *big.Int,
	rand io.Reader,
) (*ProposePrivateDataExchangeResult, error)

ProposePrivateDataExchange creates private data exchange proposition

func (*ExchangeProposer) ProposePrivateDataExchangeNoWait

func (e *ExchangeProposer) ProposePrivateDataExchangeNoWait(
	ctx context.Context,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
	exchangeStakeWei *big.Int,
	rand io.Reader,
) (*ProposePrivateDataExchangeResultNoWait, error)

ProposePrivateDataExchangeNoWait creates private data exchange proposition. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type ExchangeStatusGetter

type ExchangeStatusGetter eth.Eth

ExchangeStatusGetter allows to get status of private data exchange

func NewExchangeStatusGetter

func NewExchangeStatusGetter(e *eth.Eth) *ExchangeStatusGetter

NewExchangeStatusGetter converts eth.Eth to ExchangeStatusGetter

func (*ExchangeStatusGetter) GetPrivateDataExchangeStatus

func (g *ExchangeStatusGetter) GetPrivateDataExchangeStatus(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) (*PrivateDataExchangeStatus, error)

GetPrivateDataExchangeStatus returns the status of private data exchange

type ExchangeTimeouter

type ExchangeTimeouter struct {
	// contains filtered or unexported fields
}

ExchangeTimeouter allows to timeout data exchange/close it after proposition has expired.

func NewExchangeTimeouter

func NewExchangeTimeouter(s *eth.Session, clock Clock) *ExchangeTimeouter

NewExchangeTimeouter converts session to ExchangeTimeouter

func (*ExchangeTimeouter) TimeoutPrivateDataExchange

func (f *ExchangeTimeouter) TimeoutPrivateDataExchange(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) error

TimeoutPrivateDataExchange closes private data exchange after proposition has expired.

func (*ExchangeTimeouter) TimeoutPrivateDataExchangeNoWait

func (f *ExchangeTimeouter) TimeoutPrivateDataExchangeNoWait(ctx context.Context, passportAddress common.Address, exchangeIdx *big.Int) (common.Hash, error)

TimeoutPrivateDataExchangeNoWait closes private data exchange after proposition has expired. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type Historian

type Historian eth.Eth

Historian reads the fact history

func NewHistorian

func NewHistorian(e *eth.Eth) *Historian

NewHistorian converts eth to Historian

func (*Historian) FilterChanges

func (h *Historian) FilterChanges(opts *ChangesFilterOpts, passportAddress common.Address) (*ChangeIterator, error)

FilterChanges retrieves changes from event log of passport.

func (*Historian) GetHistoryItemOfWriteAddress

func (h *Historian) GetHistoryItemOfWriteAddress(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteAddressHistoryItem, error)

GetHistoryItemOfWriteAddress returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteBool

func (h *Historian) GetHistoryItemOfWriteBool(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteBoolHistoryItem, error)

GetHistoryItemOfWriteBool returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteBytes

func (h *Historian) GetHistoryItemOfWriteBytes(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteBytesHistoryItem, error)

GetHistoryItemOfWriteBytes returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteIPFSHash

func (h *Historian) GetHistoryItemOfWriteIPFSHash(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteIPFSHashHistoryItem, error)

GetHistoryItemOfWriteIPFSHash returns the IPFS hash value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteInt

func (h *Historian) GetHistoryItemOfWriteInt(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteIntHistoryItem, error)

GetHistoryItemOfWriteInt returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWritePrivateDataHashes

func (h *Historian) GetHistoryItemOfWritePrivateDataHashes(ctx context.Context, passport common.Address, txHash common.Hash) (*WritePrivateDataHashesHistoryItem, error)

GetHistoryItemOfWritePrivateDataHashes returns the private data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteString

func (h *Historian) GetHistoryItemOfWriteString(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteStringHistoryItem, error)

GetHistoryItemOfWriteString returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteTxData

func (h *Historian) GetHistoryItemOfWriteTxData(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteTxDataHistoryItem, error)

GetHistoryItemOfWriteTxData returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteUint

func (h *Historian) GetHistoryItemOfWriteUint(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteUintHistoryItem, error)

GetHistoryItemOfWriteUint returns the data value that was set in the given transaction.

type IPFSDataReader

type IPFSDataReader struct {
	// contains filtered or unexported fields
}

IPFSDataReader reads IPFS hash from Ethereum network and then retrieves data from IPFS

func NewIPFSDataReader

func NewIPFSDataReader(e *eth.Eth, fs *ipfs.IPFS) *IPFSDataReader

NewIPFSDataReader creates new instance of IPFSDataReader

func (*IPFSDataReader) ReadHistoryIPFSData

func (p *IPFSDataReader) ReadHistoryIPFSData(
	ctx context.Context,
	passportAddress common.Address,
	txHash common.Hash,
) (io.ReadCloser, error)

ReadHistoryIPFSData reads IPFS hash from transaction and then retrieves data from IPFS

func (*IPFSDataReader) ReadIPFSData

func (p *IPFSDataReader) ReadIPFSData(
	ctx context.Context,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
) (io.ReadCloser, error)

ReadIPFSData reads IPFS hash from Ethereum network and then retrieves data from IPFS

type IPFSDataWriter

type IPFSDataWriter struct {
	// contains filtered or unexported fields
}

IPFSDataWriter writes data to IPFS and stores IPFS hash to Ethereum storage

func NewIPFSDataWriter

func NewIPFSDataWriter(s *eth.Session, fs *ipfs.IPFS) *IPFSDataWriter

NewIPFSDataWriter creates new instance of IPFSDataWriter

func (*IPFSDataWriter) WriteIPFSData

func (p *IPFSDataWriter) WriteIPFSData(
	ctx context.Context,
	passportAddress common.Address,
	factKey [32]byte,
	r io.Reader,
) (*WriteIPFSDataResult, error)

WriteIPFSData writes data to IPFS and stores IPFS hash to Ethereum network

type PrivateDataExchangeStatus

type PrivateDataExchangeStatus struct {
	DataRequester        common.Address
	DataRequesterStaked  *big.Int
	PassportOwner        common.Address
	PassportOwnerStaked  *big.Int
	FactProvider         common.Address
	FactKey              [32]byte
	DataIPFSHash         string
	DataKeyHash          common.Hash
	EncryptedExchangeKey []byte
	ExchangeKeyHash      common.Hash
	EncryptedDataKey     [32]byte
	State                exchange.StateType
	StateExpirationTime  time.Time
}

PrivateDataExchangeStatus holds details of private data exchange

type PrivateDataHashes

type PrivateDataHashes struct {
	DataIPFSHash string
	DataKeyHash  [32]byte
}

PrivateDataHashes holds IPFS hash of the data and hash of data encryption key

type PrivateDataReader

type PrivateDataReader struct {
	// contains filtered or unexported fields
}

PrivateDataReader allows to decrypt private data

func NewPrivateDataReader

func NewPrivateDataReader(e *eth.Eth, fs *ipfs.IPFS) *PrivateDataReader

NewPrivateDataReader creates new instance of PrivateDataReader

func (*PrivateDataReader) DecryptPrivateData

func (r *PrivateDataReader) DecryptPrivateData(
	ctx context.Context,
	dataIPFSHash string,
	secretKey []byte,
	curve elliptic.Curve,
) ([]byte, error)

DecryptPrivateData reads encrypted data and HMAC and decrypts data using provided secret keyring material and elliptic curve. Default elliptic curve is used if it's nil.

func (*PrivateDataReader) DecryptSecretKey

func (r *PrivateDataReader) DecryptSecretKey(
	ctx context.Context,
	passportOwnerPrivateKey *ecdsa.PrivateKey,
	factProviderHashes *PrivateDataHashes,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
) ([]byte, error)

DecryptSecretKey reads ephemeral public key from IPFS and derives secret key using passport owner private key. It returns ErrInvalidPassportOwnerKey error when hash of decrypted secret key does not match data key hash from fact provider.

func (*PrivateDataReader) ReadHistoryPrivateData

func (r *PrivateDataReader) ReadHistoryPrivateData(
	ctx context.Context,
	passportOwnerPrivateKey *ecdsa.PrivateKey,
	passportAddress common.Address,
	txHash common.Hash,
) ([]byte, error)

ReadHistoryPrivateData decrypts secret key and then decrypts private data using decrypted secret key from specific Ethereum transaction

func (*PrivateDataReader) ReadHistoryPrivateDataUsingSecretKey

func (r *PrivateDataReader) ReadHistoryPrivateDataUsingSecretKey(
	ctx context.Context,
	secretKey []byte,
	passportAddress common.Address,
	txHash common.Hash,
) ([]byte, error)

ReadHistoryPrivateDataUsingSecretKey decrypts private data using decrypted secret key from specific Ethereum transaction

func (*PrivateDataReader) ReadPrivateData

func (r *PrivateDataReader) ReadPrivateData(
	ctx context.Context,
	passportOwnerPrivateKey *ecdsa.PrivateKey,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
) ([]byte, error)

ReadPrivateData decrypts secret key using passport owner key and then decrypts private data using decrypted secret key

func (*PrivateDataReader) ReadPrivateDataUsingSecretKey

func (r *PrivateDataReader) ReadPrivateDataUsingSecretKey(
	ctx context.Context,
	secretKey []byte,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
) ([]byte, error)

ReadPrivateDataUsingSecretKey decrypts private data using secret key

func (*PrivateDataReader) ReadSecretKey

func (r *PrivateDataReader) ReadSecretKey(
	ctx context.Context,
	passportOwnerPrivateKey *ecdsa.PrivateKey,
	passportAddress common.Address,
	factProviderAddress common.Address,
	factKey [32]byte,
) ([]byte, error)

ReadSecretKey reads hashes from Ethereum network, then reads public key from IPFS and derives secret key using passport owner private key. It returns ErrInvalidPassportOwnerKey error when hash of decrypted secret key does not match data key hash from fact provider.

type PrivateDataWriter

type PrivateDataWriter struct {
	// contains filtered or unexported fields
}

PrivateDataWriter allows to encrypt private data, add encrypted content to IPFS and write hashes of ecnrypted private data to Ethereum network

func NewPrivateDataWriter

func NewPrivateDataWriter(s *eth.Session, fs *ipfs.IPFS) *PrivateDataWriter

NewPrivateDataWriter creates new instance of PrivateDataWriter

func (*PrivateDataWriter) WritePrivateData

func (w *PrivateDataWriter) WritePrivateData(
	ctx context.Context,
	passportAddress common.Address,
	factKey [32]byte,
	data []byte,
	rand io.Reader,
) (*WritePrivateDataResult, error)

WritePrivateData encrypts private data, adds encrypted content to IPFS and then writes hashes of encrypted data to passport in Ethereum network. `rand` - used to generate random encryption key (use rand.Reader from "crypto/rand" package in real application)

func (*PrivateDataWriter) WritePrivateDataNoWait

func (w *PrivateDataWriter) WritePrivateDataNoWait(
	ctx context.Context,
	passportAddress common.Address,
	factKey [32]byte,
	data []byte,
	rand io.Reader,
) (*WritePrivateDataResult, error)

WritePrivateDataNoWait encrypts private data, adds encrypted content to IPFS and then writes hashes of encrypted data to passport in Ethereum network. `rand` - used to generate random encryption key (use rand.Reader from "crypto/rand" package in real application) This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type ProposePrivateDataExchangeResult

type ProposePrivateDataExchangeResult struct {
	ExchangeIdx     *big.Int    // exchange index
	ExchangeKey     [32]byte    // exchange key is a key to be XORed with the secret key of private data (should be kept in secret by the data requester)
	ExchangeKeyHash common.Hash // hash of exchange key hash
}

ProposePrivateDataExchangeResult holds result of calling ProposePrivateDataExchange

type ProposePrivateDataExchangeResultNoWait

type ProposePrivateDataExchangeResultNoWait struct {
	ExchangeKey     [32]byte
	ExchangeKeyHash common.Hash
	TxHash          common.Hash
}

ProposePrivateDataExchangeResultNoWait holds result of calling ProposePrivateDataExchangeNoWait

type Provider

type Provider eth.Session

Provider provides the facts

func NewProvider

func NewProvider(s *eth.Session) *Provider

NewProvider converts session to Provider

func (*Provider) DeleteAddress

func (p *Provider) DeleteAddress(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteAddress deletes address data for the specific key

func (*Provider) DeleteAddressNoWait

func (p *Provider) DeleteAddressNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteAddressNoWait deletes address data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteBool

func (p *Provider) DeleteBool(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBool deletes bool data for the specific key

func (*Provider) DeleteBoolNoWait

func (p *Provider) DeleteBoolNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBoolNoWait deletes bool data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteBytes

func (p *Provider) DeleteBytes(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBytes deletes bytes data for the specific key

func (*Provider) DeleteBytesNoWait

func (p *Provider) DeleteBytesNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBytesNoWait deletes bytes data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteIPFSHash

func (p *Provider) DeleteIPFSHash(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteIPFSHash deletes IPFS hash for the specific key

func (*Provider) DeleteIPFSHashNoWait

func (p *Provider) DeleteIPFSHashNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteIPFSHashNoWait deletes IPFS hash for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteInt

func (p *Provider) DeleteInt(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteInt deletes int data for the specific key

func (*Provider) DeleteIntNoWait

func (p *Provider) DeleteIntNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteIntNoWait deletes int data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeletePrivateDataHashes

func (p *Provider) DeletePrivateDataHashes(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeletePrivateDataHashes deletes IPFS private data for the specific key

func (*Provider) DeletePrivateDataHashesNoWait

func (p *Provider) DeletePrivateDataHashesNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeletePrivateDataHashesNoWait deletes IPFS private data for the specific key

func (*Provider) DeleteString

func (p *Provider) DeleteString(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteString deletes string data for the specific key

func (*Provider) DeleteStringNoWait

func (p *Provider) DeleteStringNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteStringNoWait deletes string data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteTxData

func (p *Provider) DeleteTxData(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteTxData deletes tx data for the specific key

func (*Provider) DeleteTxDataNoWait

func (p *Provider) DeleteTxDataNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteTxDataNoWait deletes tx data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) DeleteUint

func (p *Provider) DeleteUint(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteUint deletes uint data for the specific key

func (*Provider) DeleteUintNoWait

func (p *Provider) DeleteUintNoWait(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteUintNoWait deletes uint data for the specific key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteAddress

func (p *Provider) WriteAddress(ctx context.Context, passportAddress common.Address, key [32]byte, data common.Address) (common.Hash, error)

WriteAddress writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteAddressNoWait

func (p *Provider) WriteAddressNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data common.Address) (common.Hash, error)

WriteAddressNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteBool

func (p *Provider) WriteBool(ctx context.Context, passportAddress common.Address, key [32]byte, data bool) (common.Hash, error)

WriteBool writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteBoolNoWait

func (p *Provider) WriteBoolNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data bool) (common.Hash, error)

WriteBoolNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteBytes

func (p *Provider) WriteBytes(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteBytes writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteBytesNoWait

func (p *Provider) WriteBytesNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteBytesNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteIPFSHash

func (p *Provider) WriteIPFSHash(ctx context.Context, passportAddress common.Address, key [32]byte, hash string) (common.Hash, error)

WriteIPFSHash writes IPFS hash for specific key (uses Ethereum storage to store the hash)

func (*Provider) WriteIPFSHashNoWait

func (p *Provider) WriteIPFSHashNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, hash string) (common.Hash, error)

WriteIPFSHashNoWait writes IPFS hash for specific key (uses Ethereum storage to store the hash). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteInt

func (p *Provider) WriteInt(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteInt writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteIntNoWait

func (p *Provider) WriteIntNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteIntNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WritePrivateDataHashes

func (p *Provider) WritePrivateDataHashes(ctx context.Context, passportAddress common.Address, key [32]byte, privateData *PrivateDataHashes) (common.Hash, error)

WritePrivateDataHashes writes IPFS hash of encrypted private data and hash of data encryption key

func (*Provider) WritePrivateDataHashesNoWait

func (p *Provider) WritePrivateDataHashesNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, privateData *PrivateDataHashes) (common.Hash, error)

WritePrivateDataHashesNoWait writes IPFS hash of encrypted private data and hash of data encryption key. This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteString

func (p *Provider) WriteString(ctx context.Context, passportAddress common.Address, key [32]byte, data string) (common.Hash, error)

WriteString writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteStringNoWait

func (p *Provider) WriteStringNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data string) (common.Hash, error)

WriteStringNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteTxData

func (p *Provider) WriteTxData(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteTxData writes data for the specific key (uses transaction data)

func (*Provider) WriteTxDataNoWait

func (p *Provider) WriteTxDataNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteTxDataNoWait writes data for the specific key (uses transaction data). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

func (*Provider) WriteUint

func (p *Provider) WriteUint(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteUint writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteUintNoWait

func (p *Provider) WriteUintNoWait(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteUintNoWait writes data for the specific key (uses Ethereum storage). This method does not wait for the transaction to be mined. Use the method without the NoWait suffix if you need to make sure that the transaction was successfully mined.

type Reader

type Reader eth.Eth

Reader reads the facts

func NewReader

func NewReader(e *eth.Eth) *Reader

NewReader converts eth to Reader

func (*Reader) ReadAddress

func (r *Reader) ReadAddress(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (common.Address, error)

ReadAddress reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadBool

func (r *Reader) ReadBool(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (bool, error)

ReadBool reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadBytes

func (r *Reader) ReadBytes(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) ([]byte, error)

ReadBytes reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadIPFSHash

func (r *Reader) ReadIPFSHash(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (string, error)

ReadIPFSHash reads the IPFS hash from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadInt

func (r *Reader) ReadInt(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (*big.Int, error)

ReadInt reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadOwnerPublicKey

func (r *Reader) ReadOwnerPublicKey(ctx context.Context, passport common.Address) (pk *ecdsa.PublicKey, err error)

ReadOwnerPublicKey reads the Ethereum public key of the passport owner. Owner must claim ownership of the passport, before this method can be invoked.

func (*Reader) ReadPrivateDataHashes

func (r *Reader) ReadPrivateDataHashes(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (*PrivateDataHashes, error)

ReadPrivateDataHashes reads the private data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadString

func (r *Reader) ReadString(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (string, error)

ReadString reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadTxData

func (r *Reader) ReadTxData(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) ([]byte, error)

ReadTxData reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadUint

func (r *Reader) ReadUint(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (*big.Int, error)

ReadUint reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

type WriteAddressHistoryItem

type WriteAddressHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         common.Address
}

WriteAddressHistoryItem holds parameters of WriteAddress call

type WriteBoolHistoryItem

type WriteBoolHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         bool
}

WriteBoolHistoryItem holds parameters of WriteBool call

type WriteBytesHistoryItem

type WriteBytesHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         []byte
}

WriteBytesHistoryItem holds parameters of WriteBytes call

type WriteIPFSDataResult

type WriteIPFSDataResult struct {
	// IPFSHash is IPFS hash of data stored in IPFS
	IPFSHash string
	// TransactionHash is hash of storing IPFS hash transaction in Ethereum network
	TransactionHash common.Hash
}

WriteIPFSDataResult holds result of invoking WriteIPFSData

type WriteIPFSHashHistoryItem

type WriteIPFSHashHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Hash         string
}

WriteIPFSHashHistoryItem holds parameters of WriteIPFSHash call

type WriteIntHistoryItem

type WriteIntHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         *big.Int
}

WriteIntHistoryItem holds parameters of WriteInt call

type WritePrivateDataHashesHistoryItem

type WritePrivateDataHashesHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	DataIPFSHash string
	DataKeyHash  [32]byte
}

WritePrivateDataHashesHistoryItem holds parameters of WritePrivateDataHashes call

type WritePrivateDataResult

type WritePrivateDataResult struct {
	// DataIPFSHash is IPFS hash of encrypted private data bundle
	DataIPFSHash string
	// DataKey is secret key that was used to encrypt the data
	DataKey []byte
	// DataKeyHash is hash of secret key
	DataKeyHash [32]byte
	// TransactionHash is hash of storing IPFS hashes transaction in Ethereum network
	TransactionHash common.Hash
}

WritePrivateDataResult holds result of invoking WritePrivateData

type WriteStringHistoryItem

type WriteStringHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         string
}

WriteStringHistoryItem holds parameters of WriteString call

type WriteTxDataHistoryItem

type WriteTxDataHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         []byte
}

WriteTxDataHistoryItem holds parameters of WriteTxData call

type WriteUintHistoryItem

type WriteUintHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         *big.Int
}

WriteUintHistoryItem holds parameters of WriteUint call

Jump to

Keyboard shortcuts

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