forked from Qortal/qortal
Private key moved from command line argument to QORTAL_PRIVKEY env variable, to improve security.
This commit is contained in:
parent
f4c1671079
commit
dcdc48d917
@ -33,13 +33,12 @@ fi
|
|||||||
|
|
||||||
if [[ "${method}" == "PUT" || "${method}" == "PATCH" ]]; then
|
if [[ "${method}" == "PUT" || "${method}" == "PATCH" ]]; then
|
||||||
directory=$4
|
directory=$4
|
||||||
private_key=$5
|
|
||||||
|
|
||||||
if [ -z "${directory}" ]; then
|
if [ -z "${directory}" ]; then
|
||||||
echo "Error: missing directory"; exit
|
echo "Error: missing directory"; exit
|
||||||
fi
|
fi
|
||||||
if [ -z "${private_key}" ]; then
|
if [ -z "${QORTAL_PRIVKEY}" ]; then
|
||||||
echo "Error: missing private_key"; exit
|
echo "Error: missing private key. Set it by running: export QORTAL_PRIVKEY=privkeyhere"; exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Creating transaction - this can take a while..."
|
echo "Creating transaction - this can take a while..."
|
||||||
@ -49,7 +48,7 @@ if [[ "${method}" == "PUT" || "${method}" == "PATCH" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Signing..."
|
echo "Signing..."
|
||||||
signed_tx_data=$(curl --silent --insecure -X POST "http://${host}:${port}/transactions/sign" -H "Content-Type: application/json" -d "{\"privateKey\":\"${private_key}\",\"transactionBytes\":\"${tx_data}\"}")
|
signed_tx_data=$(curl --silent --insecure -X POST "http://${host}:${port}/transactions/sign" -H "Content-Type: application/json" -d "{\"privateKey\":\"${QORTAL_PRIVKEY}\",\"transactionBytes\":\"${tx_data}\"}")
|
||||||
if [[ "${signed_tx_data}" == *"error"* || "${signed_tx_data}" == *"ERROR"* ]]; then
|
if [[ "${signed_tx_data}" == *"error"* || "${signed_tx_data}" == *"ERROR"* ]]; then
|
||||||
echo "${signed_tx_data}"; exit
|
echo "${signed_tx_data}"; exit
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user