import { createHash } from 'node:crypto' /** * Generates a deterministic hex identifier for a device (URL-safe, 24 chars) */ export function getDeviceHashIdentifier(device: { oui: string productClass: string serialNumber: string manufacturer?: string }): string { const manufacturer = device.manufacturer ?? '' const canonical = `${manufacturer}-${device.oui}-${device.productClass}-${device.serialNumber}` return createHash('sha256').update(canonical).digest('hex').substring(0, 24) }