view mod_compact_resource/mod_compact_resource.lua @ 4940:1a58345d91a9

mod_auth_dovecot: Add luarocks metadata to make automatic packaging work This subdirectory is not handled by the luarocks packaging in module browser
author Kim Alvefur <zash@zash.se>
date Sat, 14 May 2022 15:50:44 +0200
parents 6f34e51a23f0
children
line wrap: on
line source


local base64_encode = require"util.encodings".base64.encode;
local random_bytes = require"util.random".bytes;

local b64url = { ["+"] = "-", ["/"] = "_", ["="] = "" };
local function random_resource()
	return base64_encode(random_bytes(8)):gsub("[+/=]", b64url);
end

module:hook("pre-resource-bind", function (event)
	event.resource = random_resource();
end);