Actions4
Overview
This node enables sending encrypted direct messages using the Nostr protocol's NIP-04 specification. It allows users to create and send encrypted events (kind 4) between peers by encrypting content with the recipient’s public key. This is useful for scenarios where simple peer-to-peer encrypted communication is needed, such as sending private notes or messages on decentralized networks that support Nostr.
Practical examples include:
- Sending a private message to another user identified by their public key.
- Encrypting sensitive information before broadcasting it over Nostr relays.
- Integrating encrypted messaging into workflows that use Nostr events.
Note: The node includes a notice that NIP-04 encryption is not state-of-the-art and leaks metadata, so it should be used only if revealing sender and receiver info is acceptable.
Properties
| Name | Meaning |
|---|---|
| Content | The text content of the message to send. |
| SendTo | Recipient's public key in hex or npub format to whom the encrypted message will be sent. |
| Custom Relay | Comma-separated list of WebSocket relay URLs to which the event will be sent. Defaults to common public relays. |
| NIP-04 does not go anywhere near what is considered the state-of-the-art... | Notice about the limitations and metadata leakage of NIP-04 encryption. |
Output
The node outputs an array of objects, each containing:
event: The full event object that was created and sent. For NIP-04, this is an event of kind 4 with encrypted content and tags including the recipient’s public key.sendResults: An array of results from sending the event to each specified relay, indicating success or failure per relay connection.
No binary data output is produced by this node.
Dependencies
- Requires an API secret key credential (a private key) to sign and encrypt events.
- Uses the
nostr-toolslibrary for encryption and event finalization. - Uses WebSocket connections to communicate with Nostr relays.
- Default relay URLs are provided but can be customized via input property.
Troubleshooting
- Invalid secret key error: If the provided secret key is missing or malformed, the node throws an error. Ensure the secret key is correctly configured and formatted.
- Invalid tags error: When sending generic events with tags, the tags must be a valid JSON array. Invalid JSON or non-array values cause errors.
- Relay connection issues: If relays are unreachable or reject the event, sending may fail. Verify relay URLs and network connectivity.
- JSON parse failures: For raw JSON event input, invalid JSON strings cause parsing errors.
- Metadata leakage warning: Users should be aware that NIP-04 leaks sender and receiver metadata; do not use for highly sensitive communications.
Links and References
- Nostr Protocol
- NIP-04: Encrypted Direct Messages
- nostr-tools GitHub - JavaScript library used for encryption and event handling