Documentation
¶
Index ¶
- Constants
- type AppEntry
- func (ae *AppEntry) AppID() string
- func (ae *AppEntry) Domain() byte
- func (ae *AppEntry) ExtraBytes(massifContext *massifs.MassifContext) ([]byte, error)
- func (ae *AppEntry) IDTimestamp(massifContext *massifs.MassifContext) ([]byte, error)
- func (ae *AppEntry) LogID() []byte
- func (ae *AppEntry) LogTenant() (string, error)
- func (ae *AppEntry) MMREntry(massifContext *massifs.MassifContext) ([]byte, error)
- func (ae *AppEntry) MMRIndex() uint64
- func (ae *AppEntry) MMRSalt(massifContext *massifs.MassifContext) ([]byte, error)
- func (ae *AppEntry) Proof(massifContext *massifs.MassifContext) ([][]byte, error)
- func (ae *AppEntry) SerializedBytes() []byte
- func (ae *AppEntry) TrieEntry(massifContext *massifs.MassifContext) ([]byte, error)
- func (ae *AppEntry) VerifyInclusion(massifContext *massifs.MassifContext) (bool, error)
- func (ae *AppEntry) VerifyProof(massifContext *massifs.MassifContext, proof [][]byte) (bool, error)
- type LogVersion0Hasher
- type MMREntryFields
Constants ¶
const ( MMRSaltSize = 32 ExtraBytesSize = 24 IDTimestapSizeBytes = 8 )
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) 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) LogTenant ¶
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) 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 ¶
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 ¶
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