Skip to content

Instantly share code, notes, and snippets.

@mecab
Last active April 11, 2019 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mecab/d83ea8eb881e07786cb3fa9819db8a71 to your computer and use it in GitHub Desktop.
Save mecab/d83ea8eb881e07786cb3fa9819db8a71 to your computer and use it in GitHub Desktop.
#!/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