photoprism/internal/session/token.go
Michael Mayer bdf0cde8a6 Backend: Add session package #169
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-28 09:48:36 +01:00

16 lines
190 B
Go

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