From 6be05416536db6296dc35158390c5c8757ca0818 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 17 Feb 2025 16:00:08 -0300 Subject: [PATCH] nip19: EncodePointer() --- nip19/pointer.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nip19/pointer.go diff --git a/nip19/pointer.go b/nip19/pointer.go new file mode 100644 index 0000000..4eef924 --- /dev/null +++ b/nip19/pointer.go @@ -0,0 +1,18 @@ +package nip19 + +import "github.com/nbd-wtf/go-nostr" + +func EncodePointer(pointer nostr.Pointer) string { + switch v := pointer.(type) { + case nostr.ProfilePointer: + res, _ := EncodeProfile(v.PublicKey, v.Relays) + return res + case nostr.EventPointer: + res, _ := EncodeEvent(v.ID, v.Relays, v.Author) + return res + case nostr.EntityPointer: + res, _ := EncodeEntity(v.PublicKey, v.Kind, v.Identifier, v.Relays) + return res + } + return "" +}