photoprism/internal/util/token.go

15 lines
180 B
Go
Raw Normal View History

package util
import (
"crypto/rand"
"fmt"
)
func RandomToken(size int) (string, error) {
b := make([]byte, size)
_, err := rand.Read(b)
return fmt.Sprintf("%x", b), err
}