photoprism/internal/util/token.go
Michael Mayer 1cc8cefc92 Labels: Add cache, fix bugs & improve SQL queries
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-16 23:33:52 +01:00

22 lines
292 B
Go

package util
import (
"crypto/rand"
"fmt"
uuid "github.com/satori/go.uuid"
)
func RandomToken(size int) string {
b := make([]byte, size)
if _, err := rand.Read(b); err != nil {
log.Fatal(err)
}
return fmt.Sprintf("%x", b)
}
func UUID() string {
return uuid.NewV4().String()
}