replace deprecated functions in multiple places.

This commit is contained in:
fiatjaf
2025-03-10 02:54:34 -03:00
parent 8d869009b0
commit 459273216c
7 changed files with 19 additions and 27 deletions

View File

@@ -113,13 +113,11 @@ func NewBunker(
go func() {
now := nostr.Now()
events := pool.SubMany(ctx, relays, nostr.Filters{
{
Tags: nostr.TagMap{"p": []string{clientPublicKey}},
Kinds: []int{nostr.KindNostrConnect},
Since: &now,
LimitZero: true,
},
events := pool.SubscribeMany(ctx, relays, nostr.Filter{
Tags: nostr.TagMap{"p": []string{clientPublicKey}},
Kinds: []int{nostr.KindNostrConnect},
Since: &now,
LimitZero: true,
}, nostr.WithLabel("bunker46client"))
for ie := range events {
if ie.Kind != nostr.KindNostrConnect {

View File

@@ -94,12 +94,12 @@ func (p *DynamicSigner) HandleRequest(ctx context.Context, event *nostr.Event) (
fmt.Errorf("event kind is %d, but we expected %d", event.Kind, nostr.KindNostrConnect)
}
handler := event.Tags.GetFirst([]string{"p", ""})
if handler == nil || !nostr.IsValid32ByteHex((*handler)[1]) {
handler := event.Tags.Find("p")
if handler == nil || !nostr.IsValid32ByteHex(handler[1]) {
return req, resp, eventResponse, fmt.Errorf("invalid \"p\" tag")
}
handlerPubkey := (*handler)[1]
handlerPubkey := handler[1]
handlerSecret, err := p.getHandlerSecretKey(handlerPubkey)
if err != nil {
return req, resp, eventResponse, fmt.Errorf("no private key for %s: %w", handlerPubkey, err)