Changeset

12111:f8d280215633

util.id: Add a 'tiny' variant Conversations uses this for its randomized resources. Presumably fine and collision resistant enough when you have a few devices at most.
author Kim Alvefur <zash@zash.se>
date Thu, 02 Dec 2021 00:13:23 +0100
parents 12110:b5b799a2a10c
children 12112:08a949e63541
files util/id.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/id.lua	Thu Dec 02 01:14:55 2021 +0100
+++ b/util/id.lua	Thu Dec 02 00:13:23 2021 +0100
@@ -19,6 +19,9 @@
 return {
 	-- sizes divisible by 3 fit nicely into base64 without padding==
 
+	-- for short lived things with low risk of collisions
+	tiny = function() return b64url_random(3); end;
+
 	-- close to 8 bytes, should be good enough for relatively short lived or uses
 	-- scoped by host or users, half the size of an uuid
 	short = function() return b64url_random(9); end;