photoprism/internal/util/token.go
Michael Mayer 2c95d73520 Albums: Add photos by UUID #15
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-04 15:14:04 +01:00

16 lines
203 B
Go

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