Class: NostrAdapter ​
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:62
NostrAdapter implements the CommunicationService interface for Nostr protocol communication. It provides methods for starting the service, sending messages, and handling incoming events. NostrAdapter
Implements ​
Implements ​
Constructors ​
Constructor ​
new NostrAdapter(
config?):NostrAdapter
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:93
Constructs a new NostrAdapter instance with the given configuration.
Parameters ​
config? ​
NostrAdapterConfig = ...
The configuration for the NostrAdapter. If no configuration is provided, a new key pair is generated and default relays are used.
Returns ​
NostrAdapter
Properties ​
config ​
config:
NostrAdapterConfig
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:73
The configuration for the NostrAdapter.
name ​
name:
string='nostr'
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:67
The name of the NostrAdapter service.
Implementation of ​
pool? ​
optionalpool:SimplePool
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:85
The SimplePool instance for managing Nostr subscriptions.
Methods ​
generateIdentity() ​
generateIdentity(
keys?):ServiceAdapterConfig
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:296
TODO: Determine if this method is needed. Generates a Nostr identity using the Secp256k1SecretKey and Identifier classes.
Parameters ​
keys? ​
Optional keys to use for identity generation.
Returns ​
The generated Nostr identity configuration.
Implementation of ​
CommunicationService.generateIdentity
registerMessageHandler() ​
registerMessageHandler(
messageType,handler):void
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:185
Registers a message handler for a specific message type.
Parameters ​
messageType ​
string
The type of message to handle.
handler ​
The handler function that processes the message.
Returns ​
void
Implementation of ​
CommunicationService.registerMessageHandler
sendMessage() ​
sendMessage(
message,from,to?):Promise<void|Promise<string>[]>
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:199
TODO: Clean up and complete this method. Sends a message to a recipient using the Nostr protocol. This method is a placeholder and should be implemented with actual Nostr message sending logic.
Parameters ​
message ​
unknown
The message to send, typically containing the content and metadata.
from ​
string
The identifier of the sender.
to? ​
string
The identifier of the recipient.
Returns ​
Promise<void | Promise<string>[]>
A promise that resolves when the message is sent.
Implementation of ​
CommunicationService.sendMessage
setKeys() ​
setKeys(
keys):void
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:108
Sets the keys for the NostrAdapter.
Parameters ​
keys ​
The key pair to set.
Returns ​
void
Implementation of ​
start() ​
start():
NostrAdapter
Defined in: packages/method/src/core/beacon/aggregation/communication/adapter/nostr.ts:118
TODO: Complete this method. Figure out best subscription patterns. Starts the Nostr communication service by subscribing to relays.
Returns ​
NostrAdapter
Returns the NostrAdapter instance for method chaining.