Update relay.sh to be able to specify REQUEST_MSG

This commit is contained in:
hu55a1n1 2024-02-29 07:40:58 -08:00
parent 917b139d3d
commit c5056ac477

View file

@ -3,7 +3,7 @@
set -eo pipefail set -eo pipefail
usage() { usage() {
echo "Usage: $0 <REQUEST>" echo "Usage: $0 <REQUEST> <REQUEST_MSG>"
echo " <REQUEST>: Instantiate | SessionCreate | SessionSetPubKey" echo " <REQUEST>: Instantiate | SessionCreate | SessionSetPubKey"
exit 1 exit 1
} }
@ -15,12 +15,13 @@ REPORT_FILE="/tmp/datareport"
REPORT_SIG_FILE="/tmp/datareportsig" REPORT_SIG_FILE="/tmp/datareportsig"
REQUEST="$1" REQUEST="$1"
REQUEST_MSG=${2:-"{}"}
# clear tmp files from previous runs # clear tmp files from previous runs
rm -f "$QUOTE_FILE" "$REPORT_FILE" "$REPORT_SIG_FILE" rm -f "$QUOTE_FILE" "$REPORT_FILE" "$REPORT_SIG_FILE"
# query the gRPC quartz enclave service # query the gRPC quartz enclave service
ATTESTED_MSG=$(grpcurl -plaintext -import-path ../../utils/quartz-proto/proto/ -proto quartz.proto -d '{}' '127.0.0.1:11090' quartz.Core/"$REQUEST" | jq -c '.message | fromjson') ATTESTED_MSG=$(grpcurl -plaintext -import-path ../../utils/quartz-proto/proto/ -proto quartz.proto -d "$REQUEST_MSG" '127.0.0.1:11090' quartz.Core/"$REQUEST" | jq -c '.message | fromjson')
# parse out the quote and the message # parse out the quote and the message
QUOTE=$(echo "$ATTESTED_MSG" | jq -c '.quote') QUOTE=$(echo "$ATTESTED_MSG" | jq -c '.quote')