Software /
code /
prosody
Changeset
6300:4b0172dc5e3a
mod_dialback: Keep the same dialback secret across module reloads
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 03 Jul 2014 15:38:53 +0200 |
parents | 6299:a1da78658a82 |
children | 6301:2fdd71b08126 |
files | plugins/mod_dialback.lua |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);