zetrix_crypto_validate_key
Validate private keys, public keys, or addresses for the Zetrix blockchain to ensure proper format and security before use in transactions or account operations.
Instructions
Validate private key, public key, or address format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Type of key to validate | |
| value | Yes | The key or address to validate |
Implementation Reference
- src/index.ts:1284-1308 (handler)Tool handler that validates the input key type (privateKey, publicKey, or address) by calling the corresponding validation method on ZetrixEncryption instance and returns validation result.case "zetrix_crypto_validate_key": { if (!args) { throw new Error("Missing arguments"); } let isValid = false; const type = args.type as string; const value = args.value as string; if (type === "privateKey") { isValid = await zetrixEncryption.isValidPrivateKey(value); } else if (type === "publicKey") { isValid = await zetrixEncryption.isValidPublicKey(value); } else if (type === "address") { isValid = await zetrixEncryption.isValidAddress(value); } return { content: [ { type: "text", text: JSON.stringify({ type, value, isValid }, null, 2), }, ], }; }
- src/index.ts:564-582 (schema)Input schema definition for the tool, specifying parameters 'type' (enum: privateKey/publicKey/address) and 'value'.{ name: "zetrix_crypto_validate_key", description: "Validate private key, public key, or address format", inputSchema: { type: "object", properties: { type: { type: "string", enum: ["privateKey", "publicKey", "address"], description: "Type of key to validate", }, value: { type: "string", description: "The key or address to validate", }, }, required: ["type", "value"], }, },
- src/zetrix-encryption.ts:115-123 (helper)Helper method to validate private key format using the underlying zetrix-encryption-nodejs library's KeyPair.checkEncPrivateKey.async isValidPrivateKey(privateKey: string): Promise<boolean> { await this.initEncryption(); try { return this.KeyPair.checkEncPrivateKey(privateKey); } catch (error) { return false; } }
- src/zetrix-encryption.ts:130-138 (helper)Helper method to validate public key format using the underlying zetrix-encryption-nodejs library's KeyPair.checkEncPublicKey.async isValidPublicKey(publicKey: string): Promise<boolean> { await this.initEncryption(); try { return this.KeyPair.checkEncPublicKey(publicKey); } catch (error) { return false; } }
- src/zetrix-encryption.ts:145-153 (helper)Helper method to validate address format using the underlying zetrix-encryption-nodejs library's KeyPair.checkAddress.async isValidAddress(address: string): Promise<boolean> { await this.initEncryption(); try { return this.KeyPair.checkAddress(address); } catch (error) { return false; } }