File size: 779 Bytes
35b8b9c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { IntegrityProof, TaskWorkflow } from '../types';
export const IntegrityService = {
signStep(
workflow: TaskWorkflow,
stepId: string,
intention: string,
agentId: string,
): IntegrityProof {
const dataToSign = `${workflow.id}-${stepId}-${intention}-${agentId}`;
return {
id: `PROOF-${Math.random().toString(36).substring(2, 9).toUpperCase()}`,
workflowId: workflow.id,
stepId,
signedIntention: intention,
cryptographicSignature: `SIG_${btoa(dataToSign).substring(0, 24)}`,
attestationAgentId: agentId,
timestamp: new Date().toISOString(),
};
},
verifyProof(proof: IntegrityProof): boolean {
// Simple verification logic
return proof.cryptographicSignature.startsWith('SIG_');
},
};
|