NAME
Net::Nostr - Perl client and relay library for the Nostr protocol
SYNOPSIS
use Net::Nostr;
# Connect to a relay as a client
my $client = Net::Nostr->client;
$client->connect("ws://relay.example.com");
# Run a relay
my $relay = Net::Nostr->relay;
$relay->run('127.0.0.1', 8080);
DESCRIPTION
Net::Nostr is the top-level entry point for working with the Nostr protocol in Perl. It provides two factory methods that return client and relay objects.
For identity and key management see Net::Nostr::Key. For event creation and signing see Net::Nostr::Event.
SUPPORTED NIPS
- NIP-01 - Basic protocol flow
- NIP-02 - Follow list
- NIP-09 - Event deletion request
- NIP-10 - Text notes and threads
- NIP-19 - bech32-encoded entities
- NIP-42 - Authentication of clients to relays
- NIP-44 - Encrypted payloads (versioned)
METHODS
client
my $client = Net::Nostr->client;
Returns a new Net::Nostr::Client instance for connecting to relays.
my $client = Net::Nostr->client;
$client->on(event => sub { my ($sub_id, $event) = @_; ... });
$client->connect("ws://relay.example.com");
$client->subscribe('my-feed', $filter);
$client->publish($event);
$client->disconnect;
relay
my $relay = Net::Nostr->relay;
Returns a new Net::Nostr::Relay instance for running a relay server.
my $relay = Net::Nostr->relay;
$relay->run('127.0.0.1', 8080);
MODULES
- Net::Nostr::Client - WebSocket client for connecting to Nostr relays
- Net::Nostr::Relay - WebSocket relay server implementing NIP-01
- Net::Nostr::Event - Nostr event serialization, ID computation, and verification
- Net::Nostr::Filter - Filter objects for querying events
- Net::Nostr::Message - Protocol message serialization and parsing
- Net::Nostr::Key - Secp256k1 keypair management and BIP-340 Schnorr signatures
- Net::Nostr::Deletion - NIP-09 event deletion requests
- Net::Nostr::FollowList - NIP-02 follow list management
- Net::Nostr::Thread - NIP-10 text note threading
- Net::Nostr::Bech32 - NIP-19 bech32-encoded entities
- Net::Nostr::Encryption - NIP-44 versioned encrypted payloads