Skip to main content
Glama

zetrix_crypto_decrypt_key

Decrypt an encrypted private key using a password to access Zetrix blockchain accounts securely.

Instructions

Decrypt an encrypted private key with a password

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encryptedDataYesThe encrypted keystore data
passwordYesThe password used for encryption

Implementation Reference

  • MCP server tool handler case that executes the decryption by calling ZetrixEncryption.decryptPrivateKey
    case "zetrix_crypto_decrypt_key": { if (!args) { throw new Error("Missing arguments"); } const privateKey = await zetrixEncryption.decryptPrivateKey( args.encryptedData, // Can be object or string args.password as string ); return { content: [ { type: "text", text: JSON.stringify({ privateKey }, null, 2), }, ], }; }
  • src/index.ts:641-658 (registration)
    Tool registration in the MCP tools list, including name, description, and input schema
    { name: "zetrix_crypto_decrypt_key", description: "Decrypt an encrypted private key with a password", inputSchema: { type: "object", properties: { encryptedData: { type: "string", description: "The encrypted keystore data", }, password: { type: "string", description: "The password used for encryption", }, }, required: ["encryptedData", "password"], }, },
  • Core helper function implementing decryption logic using zetrix-encryption-nodejs library's keystore.decrypt with Promise wrapper
    async decryptPrivateKey( encryptedData: any, password: string ): Promise<string> { await this.initEncryption(); return new Promise((resolve, reject) => { try { // The decrypt function accepts the object directly this.keystore.decrypt(encryptedData, password, (decrypted: string) => { if (decrypted) { resolve(decrypted); } else { reject(new Error("Decryption failed: Invalid password or data")); } }); } catch (error) { reject( new Error( `Failed to decrypt private key: ${error instanceof Error ? error.message : String(error)}` ) ); } }); }

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/Zetrix-Chain/zetrix-mcp-server'

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