Skip to content

Commit

Permalink
fix: support leaf hash direct from V3Event type
Browse files Browse the repository at this point in the history
AB#9587
  • Loading branch information
Robin Bryce committed Jun 9, 2024
1 parent bdcf623 commit f462622
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 f462622

Please sign in to comment.