idenpubonchain

package
Version: v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: GPL-3.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdenNotOnChain              = fmt.Errorf("Identity not found on chain")
	ErrIdenNotOnChainOrBlockTooNew = fmt.Errorf("Identity not found on chain or the queried block number is not yet on chain")
	ErrIdenNotOnChainOrTimeTooNew  = fmt.Errorf("Identity not found on chain or the queried time is not yet on chain")
	ErrIdenByBlockNotFound         = fmt.Errorf("Identity not found by the queried block number")
	ErrIdenByTimeNotFound          = fmt.Errorf("Identity not found by the queried block timestamp")
)

Functions

This section is empty.

Types

type ContractAddresses

type ContractAddresses struct {
	IdenStates common.Address
}

ContractAddresses are the list of Smart Contract addresses used for the on chain identity state data.

type DeployStateResult added in v0.0.8

type DeployStateResult struct {
	Verifier eth.ContractData
	State    eth.ContractData
}

func DeployState added in v0.0.8

func DeployState(client *eth.Client, depsAddrs *StateDepsAddresses) (DeployStateResult, error)

type IdenPubOnChain

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

IdenPubOnChain is the regular implementation of IdenPubOnChain

func New

func New(client *eth.Client, addresses ContractAddresses) *IdenPubOnChain

New creates a new IdenPubOnChain

func (*IdenPubOnChain) GetState

func (ip *IdenPubOnChain) GetState(id *core.ID) (*proof.IdenStateData, error)

GetState returns the Identity State Data of the given ID from the IdenStates Smart Contract.

func (*IdenPubOnChain) GetStateByBlock

func (ip *IdenPubOnChain) GetStateByBlock(id *core.ID, queryBlockN uint64) (*proof.IdenStateData, error)

GetStateByBlock returns the Identity State Data of the given ID published at queryBlockN from the IdenStates Smart Contract.

func (*IdenPubOnChain) GetStateByTime

func (ip *IdenPubOnChain) GetStateByTime(id *core.ID, queryBlockTs int64) (*proof.IdenStateData, error)

GetStateByTime returns the Identity State Data of the given ID published at queryBlockTs from the IdenStates Smart Contract.

func (*IdenPubOnChain) GetStateClosestToBlock

func (ip *IdenPubOnChain) GetStateClosestToBlock(id *core.ID, queryBlockN uint64) (*proof.IdenStateData, error)

GetStateClosestToBlock returns the Identity State Data of the given ID that is closest (equal or older) to the queryBlockN from the IdenStates Smart Contract. If a resut is found, BlockN <= queryBlockN.

func (*IdenPubOnChain) GetStateClosestToTime

func (ip *IdenPubOnChain) GetStateClosestToTime(id *core.ID, queryBlockTs int64) (*proof.IdenStateData, error)

GetStateClosestToTime returns the Identity State Data of the given ID closest (equal or older) to the queryBlockTs from the IdenStates Smart Contract. If a resut is found, BlockN <= queryBlockN.

func (*IdenPubOnChain) InitState

func (ip *IdenPubOnChain) InitState(id *core.ID, genesisState *merkletree.Hash,
	newState *merkletree.Hash, proof *zktypes.Proof) (*types.Transaction, error)

InitState initializes the first Identity State of the given ID in the IdenStates Smart Contract.

func (*IdenPubOnChain) SetState

func (ip *IdenPubOnChain) SetState(id *core.ID, newState *merkletree.Hash,
	proof *zktypes.Proof) (*types.Transaction, error)

SetState updates the Identity State of the given ID in the IdenStates Smart Contract.

func (*IdenPubOnChain) TxConfirmBlocks added in v0.0.8

func (ip *IdenPubOnChain) TxConfirmBlocks(tx *types.Transaction) (*big.Int, error)

TxConfirmBlocks returns the number of confirmed blocks of transaction tx.

type IdenPubOnChainer

type IdenPubOnChainer interface {
	GetState(id *core.ID) (*proof.IdenStateData, error)
	GetStateByBlock(id *core.ID, blockN uint64) (*proof.IdenStateData, error)
	GetStateByTime(id *core.ID, blockTimestamp int64) (*proof.IdenStateData, error)
	SetState(id *core.ID, newState *merkletree.Hash, proof *zktypes.Proof) (*types.Transaction, error)
	InitState(id *core.ID, genesisState *merkletree.Hash,
		newState *merkletree.Hash, proof *zktypes.Proof) (*types.Transaction, error)
	TxConfirmBlocks(tx *types.Transaction) (*big.Int, error)
}

IdenPubOnChainer is an interface that gives access to the IdenStates Smart Contract.

type StateDepsAddresses added in v0.0.8

type StateDepsAddresses struct {
	Verifier *common.Address
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL