verify_presentation
Validate verifiable presentations by checking the signature, holder verification, and included credentials. Ensures integrity and authenticity within the HiveAuth ecosystem.
Instructions
Verify a verifiable presentation containing multiple credentials. Validates presentation signature, holder verification, and all included credentials.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| presentation | Yes | The verifiable presentation to verify |
Implementation Reference
- src/tools/verifyPresentation.ts:8-86 (handler)The core handler function for the 'verify_presentation' tool. Validates input using VerifyPresentationInputSchema, sends the presentation to the HiveAuth API for verification, processes the response, and returns formatted results including status, details, and raw JSON.export async function verifyPresentation(args: any): Promise<CallToolResult> { // Validate and sanitize input const validation = validateAndSanitizeInput(VerifyPresentationInputSchema, args, 'verify_presentation'); if (!validation.success) { return createValidationErrorResult(validation.error!); } const data = validation.data!; const { presentation } = data; const HIVEAUTH_API_BASE_URL = process.env.HIVEAUTH_API_BASE_URL || 'http://localhost:3000'; const VERIFY_PRESENTATION_ENDPOINT = `${HIVEAUTH_API_BASE_URL}/api/verify-presentation`; try { const response = await fetch(VERIFY_PRESENTATION_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ presentation }), }); if (!response.ok) { const errorData = await response.json().catch(() => ({ message: response.statusText })); throw new Error(`Failed to verify presentation: ${errorData.message}`); } const result = await response.json(); const statusText = result.verified ? '✅ VERIFIED' : '❌ INVALID'; const details = []; if (result.verified) { details.push('• Presentation signature: ✅ Valid'); details.push('• Holder verification: ✅ Valid'); const credentialCount = presentation.verifiableCredential?.length || 0; details.push(`• Credentials verified: ${credentialCount}`); if (result.credentialResults) { result.credentialResults.forEach((credResult: any, index: number) => { const credStatus = credResult.verified ? '✅' : '❌'; details.push(` - Credential ${index + 1}: ${credStatus} ${credResult.verified ? 'Valid' : 'Invalid'}`); }); } } else { details.push(`• Error: ${result.message || 'Unknown verification error'}`); if (result.errors) { result.errors.forEach((error: string) => { details.push(`• ${error}`); }); } } return { content: [ { type: 'text', text: `Presentation Verification Result: ${statusText}\n\n${details.join('\n')}` }, { type: 'text', text: `\`\`\`json\n${JSON.stringify(result, null, 2)}\n\`\`\`` } ] }; } catch (error: any) { return { content: [ { type: 'text', text: `Failed to verify presentation: ${error.message}` } ], isError: true }; } }
- src/schemas/toolSchemas.ts:105-107 (schema)Zod schema defining the input structure for the verify_presentation tool, requiring a verifiable presentation object.export const VerifyPresentationInputSchema = z.object({ presentation: PresentationSchema.describe('The verifiable presentation to verify') });
- src/index.ts:89-90 (registration)Tool dispatcher in the main MCP server switch statement that routes 'verify_presentation' calls to the verifyPresentation handler.case 'verify_presentation': return await verifyPresentation(args);
- src/utils/schemaConverter.ts:27-30 (registration)MCP Tool definition registration in schemaConverter, providing name, description, and input schema for the verify_presentation tool.name: 'verify_presentation', description: 'Verify a verifiable presentation containing multiple credentials. Validates presentation signature, holder verification, and all included credentials.', inputSchema: TOOL_SCHEMAS.verify_presentation },
- src/schemas/toolSchemas.ts:180-180 (schema)TOOL_SCHEMAS mapping entry linking 'verify_presentation' tool name to its input schema.verify_presentation: VerifyPresentationInputSchema,