56c97ec057
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
14 lines
180 B
Go
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
|
|
}
|