removed qr generate png function, unused

This commit is contained in:
localhost_frssoft 2023-10-02 15:22:30 +03:00
parent 2ba6870b68
commit 77debe610f

View file

@ -85,39 +85,6 @@ function fediauth.generate_tfediauth(secret_b32, unix_time)
return padded_code, valid_seconds
end
function fediauth.create_qr_png(data)
local height = #data + 2
local width = height
local png_data = {}
-- top padding
for _=1,width do
table.insert(png_data, 0xFFFFFFFF)
end
for _, row in ipairs(data) do
-- left padding
table.insert(png_data, 0xFFFFFFFF)
for _, v in ipairs(row) do
if v > 0 then
table.insert(png_data, 0xFF000000)
else
table.insert(png_data, 0xFFFFFFFF)
end
end
-- right padding
table.insert(png_data, 0xFFFFFFFF)
end
-- bottom padding
for _=1,width do
table.insert(png_data, 0xFFFFFFFF)
end
assert(#png_data == width*height)
return minetest.encode_png(width, height, png_data, 2)
end
function fediauth.generate_secret()
local buf = minetest.sha1("" .. math.random(10000), true)
local s = buf:sub(1, 20)