// In-memory QR value store for WAHA pairing
let cachedQrValue: string | null = null
let cachedQrTimestamp = 0

export function setQrValue(value: string) {
  cachedQrValue = value
  cachedQrTimestamp = Date.now()
}

export function getQrValue(): string | null {
  if (cachedQrValue && Date.now() - cachedQrTimestamp < 60000) return cachedQrValue
  return null
}

export function clearQrValue() {
  cachedQrValue = null
  cachedQrTimestamp = 0
}
