2c95d73520
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
16 lines
203 B
Go
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)
|
|
}
|