diff --git a/filter_easyjson.go b/filter_easyjson.go index f9e7cc8..690d3a9 100644 --- a/filter_easyjson.go +++ b/filter_easyjson.go @@ -39,7 +39,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) { out.IDs = (out.IDs)[:0] } for !in.IsDelim(']') { - id := [32]byte{} + id := ID{} b := in.UnsafeBytes() if len(b) == 64 { hex.Decode(id[:], b) @@ -76,7 +76,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) { out.Authors = (out.Authors)[:0] } for !in.IsDelim(']') { - pk := [32]byte{} + pk := PubKey{} b := in.UnsafeBytes() if len(b) == 64 { hex.Decode(pk[:], b) diff --git a/khatru/README.md b/khatru/README.md index a559ff1..a8c190a 100644 --- a/khatru/README.md +++ b/khatru/README.md @@ -64,9 +64,9 @@ func main() { relay.RejectEvent = append(relay.RejectEvent, // built-in policies policies.ValidateKind, + policies.RejectUnprefixedNostrReferences, // define your own policies - policies.PreventLargeTags(100), func(ctx context.Context, event *nostr.Event) (reject bool, msg string) { if event.PubKey == nostr.MustPubKeyFromHex("fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52") { return true, "we don't allow this person to write here" diff --git a/khatru/examples/readme-demo/main.go b/khatru/examples/readme-demo/main.go index 27f7e59..f9503c2 100644 --- a/khatru/examples/readme-demo/main.go +++ b/khatru/examples/readme-demo/main.go @@ -50,7 +50,7 @@ func main() { relay.OnEvent = policies.SeqEvent( // built-in policies policies.ValidateKind, - policies.PreventLargeTags(100), + policies.RejectUnprefixedNostrReferences, // define your own policies func(ctx context.Context, event nostr.Event) (reject bool, msg string) { diff --git a/signature.go b/signature.go index 29b6cd1..d2db38e 100644 --- a/signature.go +++ b/signature.go @@ -42,7 +42,7 @@ func (evt *Event) Sign(secretKey [32]byte) error { sk, pk := btcec.PrivKeyFromBytes(secretKey[:]) pkBytes := pk.SerializeCompressed()[1:] - evt.PubKey = [32]byte(pkBytes) + evt.PubKey = PubKey(pkBytes) h := sha256.Sum256(evt.Serialize()) sig, err := schnorr.Sign(sk, h[:], schnorr.FastSign())