diff 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
line wrap: on
line diff
--- a/mod_unified_push/mod_unified_push.lua	Sat Jan 14 16:15:35 2023 +0000
+++ b/mod_unified_push/mod_unified_push.lua	Sat Jan 14 16:16:00 2023 +0000
@@ -90,7 +90,16 @@
 		push_store:set("_private", { paseto_v3_local_key = key });
 	end
 	local sign, verify = paseto.init(key);
-	backends.paseto = { sign = sign, verify = verify };
+	backends.paseto = {
+		sign = sign;
+		verify = function (token)
+			local payload, err = verify(token);
+			if not payload then
+				return nil, err;
+			end
+			return true, payload;
+		end;
+	 };
 end
 
 local backend = module:get_option_string("unified_push_backend", backends.paseto and "paseto" or "storage");