feat: add key creation

This commit is contained in:
2026-04-28 23:04:15 +02:00
parent 0a98ee455f
commit 88812ec865
14 changed files with 289 additions and 115 deletions
+24
View File
@@ -0,0 +1,24 @@
package security
import (
"crypto/rand"
"encoding/base64"
"orbits-server/internal/shared/utility"
"github.com/google/uuid"
)
func GenerateSafeCategoryName(category utility.MediaType, ext string) string {
return uuid.New().String() + "_" + string(category) + ext
}
func GenerateSafeName() string {
return uuid.New().String()
}
func GenerateChars(byteLen int) string {
b := make([]byte, byteLen)
rand.Read(b)
return base64.StdEncoding.EncodeToString(b)
}