mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-19 20:16:00 +02:00
nip19: EncodePointer()
This commit is contained in:
18
nip19/pointer.go
Normal file
18
nip19/pointer.go
Normal file
@@ -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 ""
|
||||
}
|
Reference in New Issue
Block a user