mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-28 12:12:12 +02:00
replace usage of IsValidPublicKeyHex() in subpackages.
This commit is contained in:
@@ -150,7 +150,7 @@ func (group *Group) MergeInAdminsEvent(evt *nostr.Event) error {
|
||||
if tag[0] != "p" {
|
||||
continue
|
||||
}
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ func (group *Group) MergeInMembersEvent(evt *nostr.Event) error {
|
||||
if tag[0] != "p" {
|
||||
continue
|
||||
}
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ var moderationActionFactories = map[int]func(*nostr.Event) (Action, error){
|
||||
nostr.KindSimpleGroupAddUser: func(evt *nostr.Event) (Action, error) {
|
||||
targets := make([]string, 0, len(evt.Tags))
|
||||
for _, tag := range evt.Tags.GetAll([]string{"p", ""}) {
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
return nil, fmt.Errorf("")
|
||||
}
|
||||
targets = append(targets, tag[1])
|
||||
@@ -37,7 +37,7 @@ var moderationActionFactories = map[int]func(*nostr.Event) (Action, error){
|
||||
nostr.KindSimpleGroupRemoveUser: func(evt *nostr.Event) (Action, error) {
|
||||
targets := make([]string, 0, len(evt.Tags))
|
||||
for _, tag := range evt.Tags.GetAll([]string{"p", ""}) {
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
return nil, fmt.Errorf("invalid public key hex")
|
||||
}
|
||||
targets = append(targets, tag[1])
|
||||
@@ -81,7 +81,7 @@ var moderationActionFactories = map[int]func(*nostr.Event) (Action, error){
|
||||
|
||||
targets := make([]string, 0, nTags-1)
|
||||
for _, tag := range evt.Tags.GetAll([]string{"p", ""}) {
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
return nil, fmt.Errorf("invalid public key hex")
|
||||
}
|
||||
targets = append(targets, tag[1])
|
||||
@@ -107,7 +107,7 @@ var moderationActionFactories = map[int]func(*nostr.Event) (Action, error){
|
||||
|
||||
targets := make([]string, 0, nTags-1)
|
||||
for _, tag := range evt.Tags.GetAll([]string{"p", ""}) {
|
||||
if !nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if !nostr.IsValid32ByteHex(tag[1]) {
|
||||
return nil, fmt.Errorf("invalid public key hex")
|
||||
}
|
||||
targets = append(targets, tag[1])
|
||||
@@ -127,7 +127,7 @@ var moderationActionFactories = map[int]func(*nostr.Event) (Action, error){
|
||||
|
||||
targets := make([]string, len(tags))
|
||||
for i, tag := range tags {
|
||||
if nostr.IsValidPublicKeyHex(tag[1]) {
|
||||
if nostr.IsValid32ByteHex(tag[1]) {
|
||||
targets[i] = tag[1]
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid event id hex")
|
||||
|
Reference in New Issue
Block a user