Fixed bug with authentication for external TURN(S) servers

This commit is contained in:
rainbow napkin 2026-10-09 08:36:59 -04:00
parent a11fec6240
commit 0968a5eba6

View file

@ -473,12 +473,16 @@ class queue{
//Seriously, to watch a deeply important puzzle piece of modern infrastructure get TURNed into LLM-Slop is just depressing
//At least I get to make puns about it
//Create token from server shared secret and username
const token = crypto.createHmac('sha1', `${server.secret}${user}`);
//Create token from server shared secret
const token = crypto.createHmac('sha1', server.secret);
//Add pre-calculated username value to token (doesn't work when added to string at token creation)
token.update(user);
//Hash token string and save it in base64
const hash = token.digest('base64');
//Add TURN(S) server to ICEConfig
iceServers.push({
urls: server.urls,
username: user,
@ -486,6 +490,7 @@ class queue{
})
}
//return ice config
return iceServers;
}
@ -2018,4 +2023,4 @@ class queue{
}
}
module.exports = queue;
module.exports = queue;