From f38ce069a93ddd59295112405367a71ddfb53716 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 22 May 2025 08:52:45 -0300 Subject: [PATCH] fix type assertions from [32]byte to nostr.PubKey or nostr.ID. --- nip19/pointer.go | 4 ++-- sdk/input.go | 2 +- sdk/specific_event.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nip19/pointer.go b/nip19/pointer.go index 7682989..f5ca6b9 100644 --- a/nip19/pointer.go +++ b/nip19/pointer.go @@ -40,13 +40,13 @@ func ToPointer(code string) (nostr.Pointer, error) { switch prefix { case "npub": - return nostr.ProfilePointer{PublicKey: data.([32]byte)}, nil + return nostr.ProfilePointer{PublicKey: data.(nostr.PubKey)}, nil case "nprofile": return data.(nostr.ProfilePointer), nil case "nevent": return data.(nostr.EventPointer), nil case "note": - return nostr.EventPointer{ID: data.([32]byte)}, nil + return nostr.EventPointer{ID: data.(nostr.ID)}, nil case "naddr": return data.(nostr.EntityPointer), nil default: diff --git a/sdk/input.go b/sdk/input.go index b01e600..d9ffbdc 100644 --- a/sdk/input.go +++ b/sdk/input.go @@ -45,7 +45,7 @@ func InputToEventPointer(input string) *nostr.EventPointer { prefix, data, _ := nip19.Decode(input) switch prefix { case "note": - return &nostr.EventPointer{ID: data.([32]byte)} + return &nostr.EventPointer{ID: data.(nostr.ID)} case "nevent": if ep, ok := data.(nostr.EventPointer); ok { return &ep diff --git a/sdk/specific_event.go b/sdk/specific_event.go index ecc3194..cad0c94 100644 --- a/sdk/specific_event.go +++ b/sdk/specific_event.go @@ -41,7 +41,7 @@ func (sys *System) FetchSpecificEventFromInput( case "naddr": pointer = data.(nostr.EntityPointer) case "note": - pointer = nostr.EventPointer{ID: data.([32]byte)} + pointer = nostr.EventPointer{ID: data.(nostr.ID)} default: return nil, nil, fmt.Errorf("invalid code '%s'", input) }