Skip to content

Commit

Permalink
Merge pull request #8 from datatrails/dev/robin/9587-support-public-a…
Browse files Browse the repository at this point in the history
…nd-shared-assets

fix: support leaf hash direct from V3Event type
  • Loading branch information
robinbryce authored Jun 10, 2024
2 parents bdcf623 + f462622 commit 1156834
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions simplehash/schemav3.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,20 @@ func (h *HasherV3) HashEventFromJSON(eventJson []byte, opts ...HashOption) error

return V3HashEvent(h.hasher, v3Event)
}

// HashEventFromV3 hashes a single event according to the canonical simple hash event
// format available to api consumers. The source event a pre decoded V3Event type
// Options: same as HashEventFromJSON
func (h *HasherV3) HashEventFromV3(v3Event V3Event, opts ...HashOption) error {

o := HashOptions{}
for _, opt := range opts {
opt(&o)
}

h.applyEventOptions(o, &v3Event)

h.applyHashingOptions(o)

return V3HashEvent(h.hasher, v3Event)
}

0 comments on commit 1156834

Please sign in to comment.