generar_secreto_transaccion
Generate cryptographic secrets for private payments on Starknet using claiming keys and recipient addresses to enable confidential transactions through zero-knowledge proofs.
Instructions
Generate a transaction secret for private payments. Creates a cryptographic secret using a claiming key and recipient address.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| claiming_key | Yes | Claiming key for the transaction | |
| recipient_address | Yes | Starknet address of the recipient (must start with 0x) |
Implementation Reference
- src/tools/generar-secreto.ts:9-31 (handler)Core handler function that validates input using schema, checks Starknet address, and generates transaction secret using txSecret from @mistcash/crypto.export async function generarSecretoTransaccion(params: unknown) { // Validate parameters const validated = GenerarSecretoTransaccionSchema.parse(params); // Additional validation if (!isValidStarknetAddress(validated.recipient_address)) { throw new Error(`Invalid recipient address format: ${validated.recipient_address}`); } try { // Generate transaction secret using MIST.cash crypto const secret = txSecret(validated.claiming_key, validated.recipient_address); return { success: true, secret, claiming_key: validated.claiming_key, recipient_address: validated.recipient_address }; } catch (error) { throw new Error(`Failed to generate transaction secret: ${(error as Error).message}`); } }
- src/utils/validation.ts:14-17 (schema)Zod schema defining input parameters: claiming_key (string, required) and recipient_address (Starknet address).export const GenerarSecretoTransaccionSchema = z.object({ claiming_key: z.string().min(1, 'Claiming key is required'), recipient_address: StarknetAddressSchema });
- src/index.ts:46-62 (registration)Tool registration in ListToolsRequestHandler, including name, description, and input schema.name: 'generar_secreto_transaccion', description: 'Generate a transaction secret for private payments. Creates a cryptographic secret using a claiming key and recipient address.', inputSchema: { type: 'object', properties: { claiming_key: { type: 'string', description: 'Claiming key for the transaction', }, recipient_address: { type: 'string', description: 'Starknet address of the recipient (must start with 0x)', }, }, required: ['claiming_key', 'recipient_address'], }, },
- src/index.ts:166-174 (registration)Tool dispatch in CallToolRequestHandler switch statement, calling the generarSecretoTransaccion function.case 'generar_secreto_transaccion': return { content: [ { type: 'text', text: JSON.stringify(await generarSecretoTransaccion(args), null, 2), }, ], };
- src/index.ts:18-18 (registration)Import of the handler function from tools directory.import { generarSecretoTransaccion } from './tools/generar-secreto.js';