# HG changeset patch # User Kim Alvefur # Date 1404394733 -7200 # Node ID 4b0172dc5e3ac42c528b8c14b8370ed12ad96413 # Parent a1da78658a82c69d6ff58226be7a597217439abf mod_dialback: Keep the same dialback secret across module reloads diff -r a1da78658a82 -r 4b0172dc5e3a plugins/mod_dialback.lua --- a/plugins/mod_dialback.lua Thu May 22 15:21:22 2014 +0200 +++ b/plugins/mod_dialback.lua Thu Jul 03 15:38:53 2014 +0200 @@ -19,7 +19,15 @@ local dialback_requests = setmetatable({}, { __mode = 'v' }); -local dialback_secret = module.host .. (module:get_option_string("dialback_secret") or uuid_gen()); +local dialback_secret = module.host .. module:get_option_string("dialback_secret", uuid_gen()); + +function module.save() + return { dialback_secret = dialback_secret }; +end + +function module.restore(state) + dialback_secret = state.dialback_secret; +end function generate_dialback(id, to, from) return sha256_hash(id..to..dialback_secret, true);