wallet-core/packages/anastasis-webui/watch/reply.sh

18 lines
440 B
Bash
Raw Normal View History

2022-06-08 20:18:41 +02:00
#!/bin/bash
SERVER_KEY=258EAFA5-E914-47DA-95CA-C5AB0DC85B11
while read line; do
LINE=$(echo $line | tr -d '\r')
case $LINE in
Sec-WebSocket-Key:*)
CLIENT_KEY="${LINE:19}"
export WS_ACCEPT=$( echo -n $CLIENT_KEY$SERVER_KEY | sha1sum | xxd -r -p | base64 )
;;
"") break ;;
esac
done
cat watch/web_socket_server.reply | sed 's/$'"/`echo \\\r`/" | envsubst '$WS_ACCEPT'
socat UNIX-RECV:./send_signal STDOUT