Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_crypto_decrypt_key

Decrypt encrypted private keys with a password to access Zetrix blockchain accounts and perform secure operations.

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

  • src/index.ts:641-658 (registration)
    Tool registration including name, description, and input schema definition.
    {
      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"],
      },
    },
  • MCP tool handler in the switch statement that calls ZetrixEncryption.decryptPrivateKey with input arguments and formats the response.
    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),
          },
        ],
      };
    }
  • Core decryption logic wrapping zetrix-encryption-nodejs keystore.decrypt, handling promises and errors.
    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