Firehose coordinates the CLI and browser

Server-side pub/sub over Postgres, not WebSockets

class Terminal::Authorization < ApplicationModel
  # queue = Firehose queue over Postgres NOTIFY

  # 💤 CLI sleeps until the browser approves
  def wait = queue.subscribe && queue.pop(timeout: WAIT_TIMEOUT)

  # ✅ Browser approves, wakes up the CLI
  def save = queue.push(to_response)
end
39 / 45