2023-03-08 13:44:18 +07:00
|
|
|
require "nostr"
|
|
|
|
|
|
|
|
|
|
class NostrManagerService < ApplicationService
|
2024-04-16 19:10:48 +02:00
|
|
|
def parse_tags(tags)
|
|
|
|
|
out = {}
|
|
|
|
|
tags.each do |tag|
|
|
|
|
|
out[tag[0].to_sym] = tag[1, tag.length]
|
|
|
|
|
end
|
|
|
|
|
out
|
|
|
|
|
end
|
2024-05-09 14:31:37 +02:00
|
|
|
|
|
|
|
|
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
|
2023-03-08 13:44:18 +07:00
|
|
|
end
|