Mercurial > prosody-modules
comparison mod_unified_push/mod_unified_push.lua @ 5146:a86022d702b2
mod_unified_push: Fix JWT method parameter order (fixes #1791)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 13 Jan 2023 16:40:00 +0000 |
parents | 449e4ca4de32 |
children | 658658ea9323 |
comparison
equal
deleted
inserted
replaced
5145:885d696473d2 | 5146:a86022d702b2 |
---|---|
23 return s; | 23 return s; |
24 end | 24 end |
25 | 25 |
26 -- COMPAT w/0.12 | 26 -- COMPAT w/0.12 |
27 local function jwt_sign(data) | 27 local function jwt_sign(data) |
28 return jwt.sign(data, unified_push_secret); | 28 return jwt.sign(unified_push_secret, data); |
29 end | 29 end |
30 | 30 |
31 -- COMPAT w/0.12: add expiry check | 31 -- COMPAT w/0.12: add expiry check |
32 local function jwt_verify(token) | 32 local function jwt_verify(token) |
33 local ok, result = jwt.verify(token, unified_push_secret); | 33 local ok, result = jwt.verify(unified_push_secret, token); |
34 | |
34 if not ok then | 35 if not ok then |
35 return ok, result; | 36 return ok, result; |
36 end | 37 end |
37 if result.exp and result.exp < os.time() then | 38 if result.exp and result.exp < os.time() then |
38 return nil, "token-expired"; | 39 return nil, "token-expired"; |