require "nostr" class NostrManagerService < ApplicationService def parse_tags(tags) out = {} # TODO support more than 1 item for each tag type tags.each do |tag| out[tag[0].to_sym] = tag[1, tag.length] end out end def site_keypair Nostr::KeyPair.new( private_key: Nostr::PrivateKey.new(Setting.nostr_private_key), public_key: Nostr::PublicKey.new(Setting.nostr_public_key) ) end def site_user Nostr::User.new(keypair: site_keypair) end def new_relay(url) Nostr::Relay.new(url: url, name: URI.parse(url).host) end end