Mercurial > prosody-modules
comparison mod_unified_push/mod_unified_push.lua @ 5153:d69cc9a23fad
mod_unified_push: fix return values for paseto backend
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 14 Jan 2023 16:16:00 +0000 |
| parents | 342baedbd1c8 |
| children | 48ca519cd66a |
comparison
equal
deleted
inserted
replaced
| 5152:342baedbd1c8 | 5153:d69cc9a23fad |
|---|---|
| 88 if not key then | 88 if not key then |
| 89 key = paseto.new_key(); | 89 key = paseto.new_key(); |
| 90 push_store:set("_private", { paseto_v3_local_key = key }); | 90 push_store:set("_private", { paseto_v3_local_key = key }); |
| 91 end | 91 end |
| 92 local sign, verify = paseto.init(key); | 92 local sign, verify = paseto.init(key); |
| 93 backends.paseto = { sign = sign, verify = verify }; | 93 backends.paseto = { |
| 94 sign = sign; | |
| 95 verify = function (token) | |
| 96 local payload, err = verify(token); | |
| 97 if not payload then | |
| 98 return nil, err; | |
| 99 end | |
| 100 return true, payload; | |
| 101 end; | |
| 102 }; | |
| 94 end | 103 end |
| 95 | 104 |
| 96 local backend = module:get_option_string("unified_push_backend", backends.paseto and "paseto" or "storage"); | 105 local backend = module:get_option_string("unified_push_backend", backends.paseto and "paseto" or "storage"); |
| 97 | 106 |
| 98 local function register_route(params) | 107 local function register_route(params) |
