#!/usr/bin/env bash
set -eu

if ! command -v wg >/dev/null 2>&1; then
  echo "wg is required to generate gateway keys"
  exit 1
fi

PRIVATE_KEY="$(wg genkey)"
PUBLIC_KEY="$(printf '%s' "${PRIVATE_KEY}" | wg pubkey)"

echo "NEXAVPN_GATEWAY_PRIVATE_KEY=${PRIVATE_KEY}"
echo "GATEWAY_PUBLIC_KEY=${PUBLIC_KEY}"
