khatru: add policies to validate event tags by kind and replace reactions.

This commit is contained in:
fiatjaf
2025-11-11 11:26:10 -03:00
parent 637de481e5
commit db835ef3c4
3 changed files with 55 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package policies
import (
"context"
"fiatjaf.com/nostr"
"fiatjaf.com/nostr/schema"
)
func ValidateAgainstSchema(ctx context.Context, evt nostr.Event) (bool, string) {
v := schema.NewDefaultValidator()
v.FailOnUnknown = true
err := v.ValidateEvent(evt)
if err != nil {
return true, err.Error()
}
return false, ""
}