import { createHash, randomUUID } from 'node:crypto'
import { readFile } from 'node:fs/promises'

export type KbxScenarioEvidenceArtifact = {
  type: string
  path: string
  sha256?: string
}

export async function sha256File(path: string) {
  const bytes = await readFile(path)
  return createHash('sha256').update(bytes).digest('hex')
}

export function createScenarioRunId() {
  return `kbx-scenario-${randomUUID()}`
}
