first commit

This commit is contained in:
Awuqing
2026-03-17 13:29:09 +08:00
commit eadd3f8961
219 changed files with 22394 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package security
import (
"crypto/rand"
"encoding/base64"
)
func GenerateSecret(bytesLength int) (string, error) {
buffer := make([]byte, bytesLength)
if _, err := rand.Read(buffer); err != nil {
return "", err
}
return base64.RawURLEncoding.EncodeToString(buffer), nil
}