nostr_channel
nostr_channel
¶
NostrChannel — Nostr protocol adapter via pynostr.
Classes¶
NostrChannel
¶
NostrChannel(private_key: str = '', *, relays: str = '', bus: Optional[EventBus] = None)
Bases: BaseChannel
Nostr decentralized messaging channel adapter.
Uses the Nostr protocol via pynostr.
| PARAMETER | DESCRIPTION |
|---|---|
private_key
|
Nostr private key (hex or nsec format). Falls back to
TYPE:
|
relays
|
Comma-separated list of relay URLs. Falls back to
TYPE:
|
bus
|
Optional event bus for publishing channel events.
TYPE:
|
Source code in src/openjarvis/channels/nostr_channel.py
Functions¶
connect
¶
Validate credentials and mark as connected.
Source code in src/openjarvis/channels/nostr_channel.py
disconnect
¶
send
¶
send(channel: str, content: str, *, conversation_id: str = '', metadata: Dict[str, Any] | None = None) -> bool
Publish a Nostr event (kind 1 note or kind 4 DM).
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
For public notes, this is ignored or used as a tag. For encrypted DMs, this is the recipient public key (hex or npub).
TYPE:
|
content
|
Note or message content.
TYPE:
|
Source code in src/openjarvis/channels/nostr_channel.py
status
¶
status() -> ChannelStatus