Files
huly-platform/foundations/hulypulse/scripts/token.sh
T
Denis Bykhov 43fb903924 Add 'foundations/hulypulse/' from commit '27e5a23ee935ac15cdfdf032cd649644390572a5'
git-subtree-dir: foundations/hulypulse
git-subtree-mainline: 64e456e0ec
git-subtree-split: 27e5a23ee9
2025-11-26 22:57:14 +05:00

17 lines
401 B
Bash
Executable File

#!/bin/bash
CONFIG_PATH="../src/config/default.toml"
SECRET=$(grep '^token_secret' "$CONFIG_PATH" | sed -E 's/.*=\s*"(.*)"/\1/') # "
if [ -z "$SECRET" ]; then
echo "❌No token_secret in $CONFIG_PATH"
exit 1
fi
claims=$1 # "claims.json"
#TOKEN=$(echo -n "${SECRET}" | jwt -alg HS256 -key - -sign claims.json)
TOKEN=$(echo -n "${SECRET}" | jwt -alg HS256 -key - -sign ${claims})
echo "$TOKEN"