Skip to content

Commit 1f91d91

Browse files
authored
fix(report): set report URL to fluence.chat (#113)
* fix(report): set report URL to fluence.chat * fix(report): replace age report url in 'age.stderr' * chore: add comments * chore: add quotes around STDERR_TMP
1 parent 29cb1b5 commit 1f91d91

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

proof-sh/proof.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fi
117117

118118
printf "\n\tNOTE: your SSH key is used ONLY LOCALLY to decrypt a message and generate Token Claim Proof."
119119
printf "\n\tScript will explicitly ask your consent before using the key."
120-
printf "\n\tIf you have any technical issues, take a look at $OPENSSL_STDERR and $AGE_STDERR files and report to https://fluence.chat \n\n"
120+
printf "\n\tIf you have any technical issues, take a look at the following logs:\n\t\t$OPENSSL_STDERR\n\t\t$AGE_STDERR\n\tReport any issues to https://fluence.chat \n\n"
121121

122122
printf "Now the script needs your ssh key to generate proof. \n"
123123

@@ -156,7 +156,7 @@ while true; do
156156
ENCRYPTED_DATA=$(echo "$encrypted" | cut -d',' -f2)
157157

158158
set +o errexit
159-
echo "$ENCRYPTED_DATA" | xxd -r -p -c 1000 | age --decrypt --identity "$KEY_PATH" --output "$DECRYPTED_DATA" 2>$OPENSSL_STDERR
159+
echo "$ENCRYPTED_DATA" | xxd -r -p -c 1000 | age --decrypt --identity "$KEY_PATH" --output "$DECRYPTED_DATA" 2>$AGE_STDERR
160160
exit_code=$?
161161
set -o errexit
162162

@@ -175,8 +175,15 @@ while true; do
175175
echo "Possible causes are:"
176176
echo "You have specified the file which doesn't contain valid private key."
177177
echo "Your private key doesn't match your public key in GitHub. It could happen if you've changed local ssh key recently."
178-
echo "Internal ape error:"
179-
cat $OPENSSL_STDERR
178+
echo "Internal error:"
179+
180+
# replace report URL in $AGE_STDERR
181+
STDERR_TMP="$(mktemp)"
182+
cat "$AGE_STDERR" | sed -e 's#https://filippo.io/age/report#https://fluence.chat#g' > "$STDERR_TMP"
183+
cat "$STDERR_TMP" > "$AGE_STDERR"
184+
185+
# print Age error with replaced report URL
186+
cat "$AGE_STDERR"
180187
fi
181188
done
182189

python/proof.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def decrypt_temp_eth_account(sshPubKey, sshPrivKey, username, metadata):
118118
input=data.encode(),
119119
env=env)
120120
if result.returncode != 0:
121-
raise OSError(result.stderr)
121+
age_stderr = result.stderr.replace('https://filippo.io/age/report', 'https://fluence.chat')
122+
raise OSError(age_stderr)
122123

123124
return w3.eth.account.from_key(result.stdout.decode())
124125

0 commit comments

Comments
 (0)