feat: add key creation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user