exportsData=$(curl -X GET \
-H 'Accept: application/vnd.xxxxx+json; version=3.0' \
-H 'Authorization: Bearer RCexxxxxxxxxxxxxxxxxxxxxxxxxcVefI5mWy' \
-H 'Content-Type: application/json' \
https://api.xxxx.com/apps/9xxxxxxxxx15f96fe/exports)
status=$(echo $exportsData | jq '.[0].status')
downloadURL=$(echo $exportsData | jq '.[0].download_url')
export ENCRYPTED_AES_KEY=$(echo $exportsData | jq '.[0].encrypted_aes_key')
export AES_IV=$(echo $exportsData | jq '.[0].aes_iv')
export ENCRYPTED_TARBALL=encryptedChatDump.tar.gz.enc
$(curl -X GET -o ENCRYPTED_TARBALL \
-H 'Accept: application/vnd.xxxxx+json; version=3.0' \
-H 'Authorization: Bearer RCexxxxxxxxxxxxxxxxxxxxxxxxxcVefI5mWy' \
-H 'Content-Type: application/json' \
https://storage.googleapis.com/someUrlWhereTheFileIsBeingDownloadedFrom)
export OUTPUT_TAR=finalChatDumpUnencrypted.tar.gz
export PRIVATE_KEY_PATH=~/.ssh/id_rsa
openssl enc -in $ENCRYPTED_TARBALL -out $OUTPUT_TAR -d -aes-256-cbc | base64 --decode | openssl rsautl -decrypt -inkey $PRIVATE_KEY_PATH | base64 --decode
This is my first script and I am having a hard time writing the shortest possible code.