#!/bin/sh

[ -z "$ROOT" ] && ROOT=/www
CONFIG="$ROOT/config"
SCRIPT="$ROOT/script"

source $CONFIG/ap.conf
[ -f $CONFIG/api.conf ] && source $CONFIG/api.conf
source $SCRIPT/utils/network.sh

getToken() {
  otp -i $WAN_ETH 2>/dev/null
}

getTokenHeader() {
  echo "--header=device-token:$(getToken)"
}

getAuthHeader() {
  mac="--header=device-mac:$(getWanMac)"
  token=`getTokenHeader`
  echo "$mac" "$token"
}
