Overview
This node provides utilities for working with Nostr protocol data, focusing on three main operations: converting events to special encoded formats, transforming cryptographic keys between different representations, and decrypting messages encrypted using the NIP-04 standard.
The DecryptNip04 operation specifically decrypts messages that were encrypted according to NIP-04, a Nostr encryption specification. It requires the user's secret key credential to perform decryption of content sent by another user identified by their public key.
Typical use cases include:
- Receiving and decrypting private messages in Nostr applications.
- Automating message processing workflows where encrypted communication is involved.
- Integrating Nostr-based messaging into broader automation pipelines.
Example: Given an encrypted message and the sender's public key, this node can decrypt the message content so it can be processed or displayed in clear text.
Properties
| Name | Meaning |
|---|---|
| Sender Public Key (Npub or Hex) | The public key of the message sender, provided either as a Bech32 npub string or a hex string. Required to identify the sender for decryption. |
| Encrypted Content | The encrypted message content following the NIP-04 encryption format that needs to be decrypted. |
| NIP-04 Security Warning | Notice that NIP-04 is deprecated and leaks metadata; recommended only for non-sensitive communications over authenticated relays. |
| NIP-04 Credentials Required | Notice indicating that API credentials containing the secret key must be configured to decrypt messages. |
Output
The node outputs a JSON array where each item corresponds to one input item processed. For the DecryptNip04 operation, each output object contains:
decryptedContent: The plaintext result of decrypting the encrypted message.senderPubkey: The sender's public key in hex format used during decryption.originalEncrypted: The original encrypted message content as input.
No binary data output is produced by this operation.
Dependencies
- Requires an API key credential that provides access to the user's secret key necessary for decryption.
- Uses the
nostr-toolslibrary internally for cryptographic operations related to NIP-04. - The environment must support WebSocket globally (the node sets a WebSocket implementation).
- No additional external services are explicitly required beyond the configured API credentials.
Troubleshooting
Invalid secret key was provided!
This error occurs if the stored secret key credential is missing or malformed. Ensure the secret key is correctly configured in the node credentials and is a valid Bech32 nsec string or hex string.Failed to decrypt NIP-04 message: [error message]
Common causes include incorrect sender public key format, corrupted encrypted content, or mismatched keys. Verify the sender public key is correct and matches the encryption source. Also confirm the encrypted content is intact and properly formatted.Invalid Event json value / Invalid transformTo value
These errors relate to other operations but indicate invalid inputs. For decryption, ensure you provide valid strings for sender public key and encrypted content.NIP-04 is deprecated warning
This is informational. Users should consider alternative encryption methods for sensitive data due to metadata leakage risks inherent in NIP-04.