Software / code / prosody
Diff
plugins/mod_dialback.lua @ 6299:a1da78658a82
hostmanager, mod_dialback: Move generation of dialback secret out of core
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 22 May 2014 15:21:22 +0200 |
| parent | 5778:8ea6fa8459e3 |
| child | 6300:4b0172dc5e3a |
line wrap: on
line diff
--- a/plugins/mod_dialback.lua Fri Jul 04 15:54:37 2014 +0200 +++ b/plugins/mod_dialback.lua Thu May 22 15:21:22 2014 +0200 @@ -13,13 +13,16 @@ local st = require "util.stanza"; local sha256_hash = require "util.hashes".sha256; local nameprep = require "util.encodings".stringprep.nameprep; +local uuid_gen = require"util.uuid".generate; local xmlns_stream = "http://etherx.jabber.org/streams"; local dialback_requests = setmetatable({}, { __mode = 'v' }); +local dialback_secret = module.host .. (module:get_option_string("dialback_secret") or uuid_gen()); + function generate_dialback(id, to, from) - return sha256_hash(id..to..from..hosts[from].dialback_secret, true); + return sha256_hash(id..to..dialback_secret, true); end function initiate_dialback(session)