Skip to main content
Glama

decryptNip44

Decrypt NIP-44 encrypted messages on Nostr using sender's public key and your private key to access secure communications.

Instructions

Decrypt NIP-44 ciphertext

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ciphertextYesNIP-44 encrypted text
senderPubkeyYesSender pubkey (hex or npub)
privateKeyNoPrivate key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured.

Implementation Reference

  • The implementation of the `decryptNip44Fn` handler, which decrypts NIP-44 ciphertext using either the Bunker signer or local key decryption.
    export async function decryptNip44Fn({ ciphertext, senderPubkey, privateKey }: z.infer<typeof decryptNip44Schema>) {
      const sender = normalizePubkey(senderPubkey);
      if (isBunkerMode()) {
        return nip44DecryptWithBunker(sender, ciphertext);
      }
      if (!privateKey) throw new Error('privateKey is required when NOSTR_BUNKER_URI is not configured');
      const sk = normalizePrivateKey(privateKey);
      const conversationKey = nip44.v2.utils.getConversationKey(sk, sender);
      return nip44.v2.decrypt(ciphertext, conversationKey);
    }
  • The schema definition for the `decryptNip44` tool.
    export const decryptNip44Schema = z.object({
      ciphertext: z.string().describe('NIP-44 encrypted text'),
      senderPubkey: z.string().describe('Sender pubkey (hex or npub)'),
      privateKey: z.string().optional().describe(privateKeyDesc),
    });
  • src/index.ts:141-142 (registration)
    Tool registration for `decryptNip44` in the MCP server.
    server.tool('decryptNip44', 'Decrypt NIP-44 ciphertext', decryptNip44Schema.shape, async (params) => {
      return textResult({ decrypted: await decryptNip44Fn(params) });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jorgenclaw/nostr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server