app

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MMRSaltSize = 32

	ExtraBytesSize = 24

	IDTimestapSizeBytes = 8
)
View Source
const (
	DefaultMassifHeight = 14

	// LeafTypePlain is the domain separator for events
	LeafTypePlain = uint8(0)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppEntry

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

AppEntry is the app provided data for a corresponding log entry.

It contains key information for verifying inclusion of the corresponding log entry.

NOTE: all fields are sourced from the app data, or derived from it. NONE of the fields in an AppEntry are sourced from the log.

func NewAppEntry

func NewAppEntry(
	appId string,
	logId []byte,
	mmrEntryFields *MMREntryFields,
	mmrIndex uint64,
) *AppEntry

NewAppEntry creates a new app entry entry

func (*AppEntry) AppID

func (ae *AppEntry) AppID() string

AppID gets the app id of the corresponding log entry.

func (*AppEntry) Domain

func (ae *AppEntry) Domain() byte

Domain gets the domain byte used to derive the mmr entry.

func (*AppEntry) ExtraBytes

func (ae *AppEntry) ExtraBytes(massifContext *massifs.MassifContext) ([]byte, error)

ExtraBytes gets the extrabytes of the corresponding log entry.

func (*AppEntry) IDTimestamp

func (ae *AppEntry) IDTimestamp(massifContext *massifs.MassifContext) ([]byte, error)

IDTimestamp gets the idtimestamp of the corresponding log entry.

func (*AppEntry) LogID

func (ae *AppEntry) LogID() []byte

LogID gets the log id of the corresponding log entry.

func (*AppEntry) LogTenant

func (ae *AppEntry) LogTenant() (string, error)

LogTenant returns the Log tenant that committed this app entry to the log as a tenant identity.

func (*AppEntry) MMREntry

func (ae *AppEntry) MMREntry(massifContext *massifs.MassifContext) ([]byte, error)

MMREntry derives the mmr entry of the corresponding log entry from the app data.

MMREntry is:

  • H( Domain | MMR Salt | Serialized Bytes)

The MMR Salt is sourced from the corresponding log entry

func (*AppEntry) MMRIndex

func (ae *AppEntry) MMRIndex() uint64

MMRIndex gets the mmr index of the corresponding log entry.

func (*AppEntry) MMRSalt

func (ae *AppEntry) MMRSalt(massifContext *massifs.MassifContext) ([]byte, error)

MMRSalt derives the MMR Salt of the corresponding log entry from the app data. MMRSalt is the datatrails provided fields included on the MMR Entry.

this is (extrabytes | idtimestamp) for any apps that adhere to log entry version 1.

func (*AppEntry) Proof

func (ae *AppEntry) Proof(massifContext *massifs.MassifContext) ([][]byte, error)

Proof gets the inclusion proof of the corresponding log entry for the app data.

func (*AppEntry) SerializedBytes

func (ae *AppEntry) SerializedBytes() []byte

SerializedBytes gets the serialized bytes used to generate hash of the corresponding mmr entry.

func (*AppEntry) TrieEntry

func (ae *AppEntry) TrieEntry(massifContext *massifs.MassifContext) ([]byte, error)

TrieEntry gets the corresponding log trie entry for the app entry.

func (*AppEntry) VerifyInclusion

func (ae *AppEntry) VerifyInclusion(massifContext *massifs.MassifContext) (bool, error)

VerifyInclusion verifies the inclusion of the app entry against the corresponding log entry in immutable merkle log

Returns true if the app entry is included on the log, otherwise false.

func (*AppEntry) VerifyProof

func (ae *AppEntry) VerifyProof(massifContext *massifs.MassifContext, proof [][]byte) (bool, error)

VerifyProof verifies the given inclusion proof of the corresponding log entry for the app data.

type LogVersion0Hasher

type LogVersion0Hasher struct {
}

func NewLogVersion0Hasher

func NewLogVersion0Hasher() *LogVersion0Hasher

func (*LogVersion0Hasher) HashEvent

func (h *LogVersion0Hasher) HashEvent(eventJson []byte, idTimestamp []byte) ([]byte, error)

HashEvent defines the hashing schema for log version 0 nodes, given the event data in json format.

The hashing schema is as follows:

hash(domain separator + id timestamp + simplehashv3(eventJson))

Where:

  • domain separator is 0 for plain leaf nodes (events)
  • id timestamp is the timestamp id found on the event merklelog entry
  • simplehashv3 is the datatrails simplehash v3 schema for hashing datatrails events

type MMREntryFields

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

MMREntryFields are the fields that when hashed result in the MMR Entry

func NewMMREntryFields

func NewMMREntryFields(domain byte, serializedBytes []byte) *MMREntryFields

Jump to

Keyboard shortcuts

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