Diff

mod_turncredentials/mod_turncredentials.lua @ 3773:915c7bd5f754

mod_turncredentials: Rename variable for clarity
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 23:01:19 +0100
parent 3642:2bbf655431be
child 3774:20346da6d241
line wrap: on
line diff
--- a/mod_turncredentials/mod_turncredentials.lua	Mon Dec 23 01:18:02 2019 +0100
+++ b/mod_turncredentials/mod_turncredentials.lua	Mon Dec 23 23:01:19 2019 +0100
@@ -23,8 +23,8 @@
     if origin.type ~= "c2s" then
         return;
     end
-    local now = os_time() + ttl;
-    local userpart = tostring(now);
+    local expires_at = os_time() + ttl;
+    local userpart = tostring(expires_at);
     local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false));
     origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:1"})
         :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up()
@@ -40,8 +40,8 @@
     if origin.type ~= "c2s" then
         return;
     end
-    local now = os_time() + ttl;
-    local userpart = tostring(now);
+    local expires_at = os_time() + ttl;
+    local userpart = tostring(expires_at);
     local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false));
     origin.send(st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:2"})
         :tag("service", { type = "stun", host = host, port = ("%d"):format(port) }):up()