scripts: livekit participant (Phase 1) + proper-auth token script
This commit is contained in:
1 parent
df4d00ee29
commit
7fabeeef91
2 files changed
+207
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Proper-auth LiveKit token for the chaos-prime agent (MatrixRTC flow).
|
||||
# Usage: livekit_token.sh [room_id] (defaults to the chaos-prime DM)
|
||||
# Requires MATRIX_PASSWORD in env (see .matrix-env). Prints the JWT to stdout.
|
||||
set -a
|
||||
source /home/pierre/symbol-inferral/.matrix-env
|
||||
set +a
|
||||
HS=https://matrix.chaosmith.systems
|
||||
ROOM="${1:-!vp_58NnFUUE4dmniRdrFIuNbMaaqLrQLOzcC3UUpAi8:chaosmith.systems}"
|
||||
|
||||
TOKEN=$(curl -s -m 10 -X POST "$HS/_matrix/client/v3/login" \
|
||||
-d "{\"type\":\"m.login.password\",\"user\":\"chaos-prime\",\"password\":\"$MATRIX_PASSWORD\"}" | jq -r .access_token)
|
||||
USER_ID=$(curl -s -m 10 "$HS/_matrix/client/v3/account/whoami?access_token=$TOKEN" | jq -r .user_id)
|
||||
OID=$(curl -s -m 10 -X POST "$HS/_matrix/client/v3/user/$USER_ID/openid/request_token?access_token=$TOKEN" -d "{}")
|
||||
BODY=$(jq -nc --argjson oid "$OID" --arg room "$ROOM" --arg uid "$USER_ID" \
|
||||
'{room_id:$room, slot_id:"0", openid_token:$oid,
|
||||
member:{id:"chaos-prime-agent", claimed_user_id:$uid, claimed_device_id:"CHAOSPRIMEAGENT"}}')
|
||||
curl -s -m 20 -X POST "https://livekit.chaosmith.systems/get_token" \
|
||||
-H "Content-Type: application/json" --data-binary "$BODY" | jq -r .jwt
|
||||
Reference in new issue
Block a user