Documentation ¶
Index ¶
- Variables
- func AddEntriesToMerkleTree(ctx context.Context, mt mtAppender, entries []RDFEntry) error
- func SetHasher(h Hasher)
- type Hasher
- type MerkleTree
- type MerklizeOption
- type Merklizer
- func (m *Merklizer) MkValue(val any) (Value, error)
- func (m *Merklizer) Proof(ctx context.Context, path Path) (*merkletree.Proof, Value, error)
- func (m *Merklizer) RawValue(path Path) (any, error)
- func (m *Merklizer) ResolveDocPath(path string) (Path, error)
- func (m *Merklizer) Root() *merkletree.Hash
- type Options
- type Path
- type PoseidonHasher
- type RDFEntry
- type Value
Constants ¶
This section is empty.
Variables ¶
var ErrIncorrectType = errors.New("incorrect type")
var ErrorContextTypeIsEmpty = errors.New("ctxType is empty")
ErrorContextTypeIsEmpty is returned when context type tp resolve is empty
var ErrorFieldIsEmpty = errors.New("fieldPath is empty")
ErrorFieldIsEmpty is returned when field path to resolve is empty
Functions ¶
func AddEntriesToMerkleTree ¶
Types ¶
type Hasher ¶
type Hasher interface { Hash(inpBI []*big.Int) (*big.Int, error) HashBytes(msg []byte) (*big.Int, error) Prime() *big.Int }
Hasher is an interface to hash data
type MerkleTree ¶
type MerkleTree interface { Add(context.Context, *big.Int, *big.Int) error GenerateProof(context.Context, *big.Int) (*merkletree.Proof, error) Root() *merkletree.Hash }
MerkleTree is merkle tree structure
func MerkleTreeSQLAdapter ¶
func MerkleTreeSQLAdapter(mt *merkletree.MerkleTree) MerkleTree
MerkleTreeSQLAdapter is merkle tree sql adapter
type MerklizeOption ¶
type MerklizeOption func(m *Merklizer)
MerklizeOption is options for merklizer
func WithMerkleTree ¶
func WithMerkleTree(mt MerkleTree) MerklizeOption
WithMerkleTree sets MerkleTree option
type Merklizer ¶
type Merklizer struct {
// contains filtered or unexported fields
}
Merklizer is a struct to work with json-ld doc merklization
func MerklizeJSONLD ¶
MerklizeJSONLD takes a JSON-LD document, parses it and returns a Merklizer
type Options ¶
type Options struct {
Hasher Hasher
}
Options type allows to change hashing algorithm and create Path and RDFEntry instances with hasher different from default one.
func (Options) NewRDFEntry ¶
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
func NewFieldPathFromContext ¶
NewFieldPathFromContext resolves field path without type path prefix
func NewPathFromContext ¶
NewPathFromContext parses context and do its best to generate full Path from shortcut line field1.field2.field3...
type PoseidonHasher ¶
type PoseidonHasher struct{}
PoseidonHasher is an applier of poseidon hash algorithm
type RDFEntry ¶
type RDFEntry struct {
// contains filtered or unexported fields
}
func EntriesFromRDF ¶
func EntriesFromRDF(ds *ld.RDFDataset) ([]RDFEntry, error)
EntriesFromRDF creates entries from RDF dataset suitable to add to merkle tree
func EntriesFromRDFWithHasher ¶
func EntriesFromRDFWithHasher(ds *ld.RDFDataset, hasher Hasher) ([]RDFEntry, error)
EntriesFromRDFWithHasher creates entries from RDF dataset suitable to add to with a provided Hasher merkle tree