Stop listening to incoming messages
Subscribes to incoming messages on this session
Function to be called when a message is received
Unsubscribe function to stop receiving messages
Sends a text message through the encrypted session. Sent in a Nostr event with the kind CHAT_MESSAGE_KIND.
The plaintext message to send
A verified Nostr event containing the encrypted message. You need to publish this event to the Nostr network.
Send a partial Nostr event through the encrypted session. In addition to chat messages, it could be files, webrtc negotiation or many other types of messages.
Partial Nostr event to send. Must be unsigned. Id and will be generated if not provided.
A verified Nostr event containing the encrypted message. You need to publish this event to the Nostr network.
Static
initInitializes a new secure communication session
Function to subscribe to Nostr events
Whether we are initiating the conversation (true) or responding (false)
Initial shared secret for securing the first message chain
Optional
name: stringOptional name for the session (for debugging)
A new Session instance
Double ratchet secure communication session over Nostr
Very similar to Signal's "Double Ratchet with header encryption" https://signal.org/docs/specifications/doubleratchet/