util/id.lua
changeset 12979 d10957394a3c
parent 12115 f8d280215633
equal deleted inserted replaced
12978:ba409c67353b 12979:d10957394a3c
     6 -- This project is MIT/X11 licensed. Please see the
     6 -- This project is MIT/X11 licensed. Please see the
     7 -- COPYING file in the source package for more information.
     7 -- COPYING file in the source package for more information.
     8 --
     8 --
     9 
     9 
    10 local s_gsub = string.gsub;
    10 local s_gsub = string.gsub;
    11 local random_bytes = require "util.random".bytes;
    11 local random_bytes = require "prosody.util.random".bytes;
    12 local base64_encode = require "util.encodings".base64.encode;
    12 local base64_encode = require "prosody.util.encodings".base64.encode;
    13 
    13 
    14 local b64url = { ["+"] = "-", ["/"] = "_", ["="] = "" };
    14 local b64url = { ["+"] = "-", ["/"] = "_", ["="] = "" };
    15 local function b64url_random(len)
    15 local function b64url_random(len)
    16 	return (s_gsub(base64_encode(random_bytes(len)), "[+/=]", b64url));
    16 	return (s_gsub(base64_encode(random_bytes(len)), "[+/=]", b64url));
    17 end
    17 end