aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/obs-auth.sh
blob: 8be20f07a4845683f8d91702372a16ada83da88b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# obs-websocket v5 authentication, which QML cannot compute: it has no
# SHA256. stdin is two lines, password+salt then challenge, so neither
# reaches a command line. stdout is
#   base64(sha256(base64(sha256(password + salt)) + challenge))

read -r ps || exit 1
read -r ch || exit 1
secret=$(printf %s "$ps" | openssl dgst -sha256 -binary | base64)
printf %s "$secret$ch" | openssl dgst -sha256 -binary | base64