из lab2

This commit is contained in:
2026-10-21 17:35:51 +03:00
parent 0ab3a341aa
commit 665c37c0b8
37 changed files with 4442 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
package auth
import (
"crypto/rand"
"encoding/base64"
"fmt"
)
func GenerateSessionToken() (string, error) {
b := make([]byte, 32)
if _, err := rand.Read(b); err != nil {
return "", fmt.Errorf("generate token: %w", err)
}
return base64.RawURLEncoding.EncodeToString(b), nil
}