fix type assertions from [32]byte to nostr.PubKey or nostr.ID.

This commit is contained in:
fiatjaf
2025-05-22 08:52:45 -03:00
parent d3fb25441a
commit f38ce069a9
3 changed files with 4 additions and 4 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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)
}