#!/usr/bin/env bash
# zeroknowledger: prove your company email from a terminal instead of the browser.
# Same as the web page: the email stays on this machine, only the proof is sent.
#   bash prove.sh <email.eml> '<link from /verify>'
# Runs the zkbadge npm package (source: cli/prove.mjs in the repo), pinned to one version.
set -euo pipefail

if ! command -v node >/dev/null; then
  echo "This needs Node.js 20 or newer: https://nodejs.org" >&2
  exit 1
fi
if [ "$(node -p 'process.versions.node.split(".")[0]')" -lt 20 ]; then
  echo "This needs Node.js 20 or newer (you have $(node -v))." >&2
  exit 1
fi

exec npx --yes zkbadge@0.1.0 "$@"
