diff --git a/basice2e/client-session-tests.sh b/basice2e/client-session-tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..d6e90c56dea05b4e6c493ebb761d1847264984e5 --- /dev/null +++ b/basice2e/client-session-tests.sh @@ -0,0 +1,69 @@ +set -e +#set -o xtrace + +rm -rf client*.log blob* rick*.bin ben*.bin + +CLIENTOPTS="--password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1" + +# --- Pre-canned messaging to self --- +timeout 240s ../bin/client --password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1 -l client9-master.log --sendCount 2 --receiveCount 2 -s blob9/blob9 --sendid 9 --destid 9 -m "Hi 9->9, with E2E Encryption" +timeout 240s ../bin/client-release --force-legacy --password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1 -l client9-release.log --sendCount 2 --receiveCount 2 -s blob9/blob9 --sendid 9 --destid 9 -m "Hi 9->9, with E2E Encryption" + +# --- Messaging to another use, E2E --- + +# Init storage and request an E2E channel with each other +echo "SENDING E2E MESSAGES TO NEW USERS..." +CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-init.log -s blob42 --writeContact rick42-contact.bin --unsafe -m \"Hello from Rick42 to myself, without E2E Encryption\"" +eval $CLIENTCMD || true & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client43-master-init.log -s blob43 --writeContact ben43-contact.bin --destfile rick42-contact.bin --send-auth-request --sendCount 0 --receiveCount 0" +eval $CLIENTCMD || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" + +echo "Waiting for contact files to be created..." +while [ ! -s ben43-contact.bin ]; do + sleep 1 +done + +# Get the user's IDs +TMPID=$(cat client42-master-init.log | grep -a "User\:" | awk -F' ' '{print $5}') +RICKID=${TMPID} +echo "RICK ID: $RICKID" +TMPID=$(cat client43-master-init.log | grep -a "User\:" | awk -F' ' '{print $5}') +BENID=${TMPID} +echo "BEN ID: $BENID" + +# Confirm channel with each other +CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-confirm.log -s blob42 --destfile ben43-contact.bin --sendCount 0 --receiveCount 0" +eval $CLIENTCMD || true & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 + +# Send 5 messages to each other +CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-send.log -s blob42 --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\"" +eval $CLIENTCMD || true & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client43-master-send.log -s blob43 --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\"" +eval $CLIENTCMD || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 + +# Send 5 messages to each other with new client +CLIENTCMD="timeout 360s ../bin/client-release $CLIENTOPTS -l client42-release-send.log -s blob42 --force-legacy --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\"" +eval $CLIENTCMD || true & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +CLIENTCMD="timeout 360s ../bin/client-release $CLIENTOPTS -l client43-release-send.log -s blob43 --force-legacy --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\"" +eval $CLIENTCMD || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 \ No newline at end of file