other useless quibbles.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user