Created
January 15, 2018 12:27
-
-
Save x3ak/3077acaafe26d0f4272734d17e17b961 to your computer and use it in GitHub Desktop.
onetimesecret generation of the secret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
credentials=$(cat ~/.config/onetimesecret/credentials) | |
if [ "$1" == "" ]; then | |
secret=$(pwgen 24) | |
else | |
secret=$1 | |
fi | |
temp_file=$(mktemp) | |
passphrase=$(pwgen 24) | |
echo secret: ${secret} | |
echo passphrase: ${passphrase} | |
$(curl -s -d "secret=${secret}&ttl=30&passphrase=${passphrase}" -u $(cat ~/.config/onetimesecret/credentials) https://onetimesecret.com/api/v1/share -o temp_file) | |
key=$(cat temp_file | python -c "import json,sys;obj=json.load(sys.stdin);print obj['secret_key'];") | |
rm temp_file | |
echo https://onetimesecret.com/secret/${key} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment