Skip to main content
Glama

decryptNip44

Decrypt NIP-44 encrypted messages on the Nostr protocol using sender public key and private key to access secure content.

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 handler function `decryptNip44Fn` that performs the NIP-44 decryption logic, supporting both direct key and bunker signing modes.
    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);
    }
  • Input validation schema 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-143 (registration)
    Registration of the 'decryptNip44' tool in the MCP server instance.
    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