photoprism/internal/session/token.go
2021-04-30 10:07:20 +02:00

17 lines
228 B
Go

package session
import (
"crypto/rand"
"fmt"
)
// NewID returns a random session id.
func NewID() string {
b := make([]byte, 24)
if _, err := rand.Read(b); err != nil {
log.Fatal(err)
}
return fmt.Sprintf("%x", b)
}