photoprism/internal/util/token.go
Michael Mayer 56c97ec057 Basic login for admin #16
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-11-08 06:53:40 +01:00

14 lines
180 B
Go

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
}