Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
set -e
# PROJECT_FROM="firebase-project-from"
# PROJECT_TO="firebase-project-to"
function getParam() {
echo $(cat .hashParameter | grep ${1}: | sed 's/.*: \(.*\),/\1/')
}
cd $(dirname "$0")
if [ ! -f .hashParameter ]; then
echo 'Place .hashParameter in same directory as this script. Exiting.'
exit 1
fi
algorithm=$(getParam algorithm)
base64_signer_key=$(getParam base64_signer_key)
base64_salt_separator=$(getParam base64_salt_separator)
rounds=$(getParam rounds)
mem_cost=$(getParam mem_cost)
echo "algorithm: ${algorithm}"
echo "base64_signer_key: ${base64_signer_key}"
echo "base64_salt_separator: ${base64_salt_separator}"
echo "rounds: ${rounds}"
echo "mem_cost: ${mem_cost}"
tmpfile="$(mktemp -u).json"
echo "tmpfile: ${tmpfile}"
firebase auth:export --project=${PROJECT_FROM} "${tmpfile}"
firebase auth:import \
--project="${PROJECT_TO}" \
--hash-algo="${algorithm}" \
--salt-separator="${base64_salt_separator}" \
--hash-key="${base64_salt_separator}" \
--rounds="${rounds}" \
--mem-cost="${mem_cost}" \
"${tmpfile}"
rm -f "${tmpfile}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.