summaryrefslogtreecommitdiff
path: root/src/Support/Id.php
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2026-03-05 14:57:28 +0100
committerDaniel Weipert <git@mail.dweipert.de>2026-03-05 14:57:28 +0100
commitbd11271621bd3759cfd194ed0119c0dc28155fd0 (patch)
tree319b4790d4e2b05513abf023732ed6fb0717f603 /src/Support/Id.php
parent2386148b8f048ba40d9f26cc97898bdcdc778ea2 (diff)
updateHEADmain
Diffstat (limited to 'src/Support/Id.php')
-rw-r--r--src/Support/Id.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Support/Id.php b/src/Support/Id.php
new file mode 100644
index 0000000..dc23631
--- /dev/null
+++ b/src/Support/Id.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Support;
+
+class Id
+{
+ public static function generate(string $prefix = "", string $suffix = "", string $salt = ""): string
+ {
+ return $prefix . md5(time() . random_bytes(512)) . $suffix;
+ }
+
+ public static function generateRoomId(): string
+ {
+ return self::generate(prefix: "!", suffix: ":" . $_ENV["DOMAIN"]);
+ }
+
+ public static function generateEventId(): string
+ {
+ return self::generate(prefix: "$", suffix: ":" . $_ENV["DOMAIN"]);
+ }
+}