package grpc import ( pb "northwest.io/muxstr/api/nostr/v1" "northwest.io/muxstr/internal/nostr" ) func NostrToPB(n *nostr.Event) *pb.Event { tags := make([]*pb.Tag, len(n.Tags)) for i, tag := range n.Tags { tags[i] = &pb.Tag{Values: tag} } return &pb.Event{ Id: n.ID, Pubkey: n.PubKey, CreatedAt: n.CreatedAt, Kind: int32(n.Kind), Tags: tags, Content: n.Content, Sig: n.Sig, } } func PBToNostr(e *pb.Event) *nostr.Event { tags := make(nostr.Tags, len(e.Tags)) for i, tag := range e.Tags { tags[i] = tag.Values } return &nostr.Event{ ID: e.Id, PubKey: e.Pubkey, CreatedAt: e.CreatedAt, Kind: int(e.Kind), Tags: tags, Content: e.Content, Sig: e.Sig, } }