# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1657558137 -7200
# Node ID 0b68b021ce46c0455e577ab0a3bcafcd73564878
# Parent  5dd00f806e32baf9403fc961078f15a9628abd3d
util.paseto: Do strict type check in pae() function

Fixes a test failure on Lua 5.4 where ipairs("") does not produce an
error.

diff -r 5dd00f806e32 -r 0b68b021ce46 util/paseto.lua
--- a/util/paseto.lua	Mon Jul 11 17:11:38 2022 +0200
+++ b/util/paseto.lua	Mon Jul 11 18:48:57 2022 +0200
@@ -23,6 +23,9 @@
 end
 
 local function pae(parts)
+	if type(parts) ~= "table" then
+		error("bad argument #1 to 'pae' (table expected, got "..type(parts)..")");
+	end
 	local o = { le64(#parts) };
 	for _, part in ipairs(parts) do
 		table.insert(o, le64(#part)..part);